[arm64:for-next/kexec 4/12] arch/arm64/kernel/hibernate.c:181:39: sparse: sparse: cast to restricted gfp_t

Pavel Tatashin pasha.tatashin at soleen.com
Fri Jan 29 16:34:13 EST 2021


On Fri, Jan 29, 2021 at 8:34 AM kernel test robot <lkp at intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/kexec
> head:   a360190e8a42d47ea80355f286939ba82b02405a
> commit: 50f53fb721817a6efa541cca24f1b7caa84801c1 [4/12] arm64: trans_pgd: make trans_pgd_map_page generic
> config: arm64-randconfig-s031-20210129 (attached as .config)
> compiler: aarch64-linux-gcc (GCC) 9.3.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # apt-get install sparse
>         # sparse version: v0.6.3-215-g0fb77bb6-dirty
>         # https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?id=50f53fb721817a6efa541cca24f1b7caa84801c1
>         git remote add arm64 https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
>         git fetch --no-tags arm64 for-next/kexec
>         git checkout 50f53fb721817a6efa541cca24f1b7caa84801c1
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp at intel.com>
>
>
> "sparse warnings: (new ones prefixed by >>)"
> >> arch/arm64/kernel/hibernate.c:181:39: sparse: sparse: cast to restricted gfp_t
> >> arch/arm64/kernel/hibernate.c:202:44: sparse: sparse: cast from restricted gfp_t


Hi Will,

__force attribute is needed in order to fix these warnings from
sparse. Do you want me to send you an updated version of

"arm64: trans_pgd: make trans_pgd_map_page generic" ?

Thank you,
Pasha

diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
index c173f280bfea..ca4f945d03a2 100644
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -178,7 +178,7 @@ EXPORT_SYMBOL(arch_hibernation_header_restore);

 static void *hibernate_page_alloc(void *arg)
 {
-       return (void *)get_safe_page((gfp_t)(unsigned long)arg);
+       return (void *)get_safe_page((__force gfp_t)(unsigned long)arg);
 }

 /*
@@ -199,7 +199,7 @@ static int create_safe_exec_page(void *src_start,
size_t length,
 {
        struct trans_pgd_info trans_info = {
                .trans_alloc_page       = hibernate_page_alloc,
-               .trans_alloc_arg        = (void *)GFP_ATOMIC,
+               .trans_alloc_arg        = (__force void *)GFP_ATOMIC,
        };

        void *page = (void *)get_safe_page(GFP_ATOMIC);



More information about the linux-arm-kernel mailing list