lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gov=Tra2Z7H99CSnMt7Vf4LKEH3rGzVUjXiiBrusYdGQ@mail.gmail.com>
Date:   Tue, 25 Jan 2022 18:35:19 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Amadeusz Sławiński 
        <amadeuszx.slawinski@...ux.intel.com>
Cc:     Linux PM <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Cezary Rojewski <cezary.rojewski@...el.com>
Subject: Re: [PATCH] x86: Remove register_nosave_region_late()

On Wed, Jan 19, 2022 at 11:48 AM Amadeusz Sławiński
<amadeuszx.slawinski@...ux.intel.com> wrote:
>
> It is an unused wrapper forcing kmalloc allocation for registering
> nosave regions. Also, rename __register_nosave_region() to
> register_nosave_region() now that there is no need for disambiguation.
>
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@...ux.intel.com>
> Reviewed-by: Cezary Rojewski <cezary.rojewski@...el.com>
> ---
>  include/linux/suspend.h | 11 +----------
>  kernel/power/snapshot.c | 21 +++++++--------------
>  2 files changed, 8 insertions(+), 24 deletions(-)
>
> diff --git a/include/linux/suspend.h b/include/linux/suspend.h
> index 5785d909c321..3e8ecdebe601 100644
> --- a/include/linux/suspend.h
> +++ b/include/linux/suspend.h
> @@ -430,15 +430,7 @@ struct platform_hibernation_ops {
>
>  #ifdef CONFIG_HIBERNATION
>  /* kernel/power/snapshot.c */
> -extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
> -static inline void __init register_nosave_region(unsigned long b, unsigned long e)
> -{
> -       __register_nosave_region(b, e, 0);
> -}
> -static inline void __init register_nosave_region_late(unsigned long b, unsigned long e)
> -{
> -       __register_nosave_region(b, e, 1);
> -}
> +extern void register_nosave_region(unsigned long b, unsigned long e);
>  extern int swsusp_page_is_forbidden(struct page *);
>  extern void swsusp_set_page_free(struct page *);
>  extern void swsusp_unset_page_free(struct page *);
> @@ -458,7 +450,6 @@ int pfn_is_nosave(unsigned long pfn);
>  int hibernate_quiet_exec(int (*func)(void *data), void *data);
>  #else /* CONFIG_HIBERNATION */
>  static inline void register_nosave_region(unsigned long b, unsigned long e) {}
> -static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
>  static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
>  static inline void swsusp_set_page_free(struct page *p) {}
>  static inline void swsusp_unset_page_free(struct page *p) {}
> diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
> index f7a986078213..330d49937692 100644
> --- a/kernel/power/snapshot.c
> +++ b/kernel/power/snapshot.c
> @@ -978,8 +978,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm)
>   * Register a range of page frames the contents of which should not be saved
>   * during hibernation (to be used in the early initialization code).
>   */
> -void __init __register_nosave_region(unsigned long start_pfn,
> -                                    unsigned long end_pfn, int use_kmalloc)
> +void __init register_nosave_region(unsigned long start_pfn, unsigned long end_pfn)
>  {
>         struct nosave_region *region;
>
> @@ -995,18 +994,12 @@ void __init __register_nosave_region(unsigned long start_pfn,
>                         goto Report;
>                 }
>         }
> -       if (use_kmalloc) {
> -               /* During init, this shouldn't fail */
> -               region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL);
> -               BUG_ON(!region);
> -       } else {
> -               /* This allocation cannot fail */
> -               region = memblock_alloc(sizeof(struct nosave_region),
> -                                       SMP_CACHE_BYTES);
> -               if (!region)
> -                       panic("%s: Failed to allocate %zu bytes\n", __func__,
> -                             sizeof(struct nosave_region));
> -       }
> +       /* This allocation cannot fail */
> +       region = memblock_alloc(sizeof(struct nosave_region),
> +                               SMP_CACHE_BYTES);
> +       if (!region)
> +               panic("%s: Failed to allocate %zu bytes\n", __func__,
> +                     sizeof(struct nosave_region));
>         region->start_pfn = start_pfn;
>         region->end_pfn = end_pfn;
>         list_add_tail(&region->list, &nosave_regions);
> --

Applied as 5.18 material, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ