Web lists-archives.com

Re: [PATCH v8 2/2] x86/kvm: use __bss_decrypted attribute in shared variables




Hi Brijesh,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/x86/core]
[also build test WARNING on v4.19-rc3 next-20180913]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Brijesh-Singh/x86-mm-add-bss-decrypted-section-to-hold-shared-variables/20180914-080110
config: x86_64-randconfig-x019-201836 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/cpumask.h:5:0,
                    from arch/x86/include/asm/msr.h:11,
                    from arch/x86/include/asm/processor.h:21,
                    from arch/x86/include/asm/cpufeature.h:5,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:38,
                    from arch/x86/include/asm/preempt.h:7,
                    from include/linux/preempt.h:81,
                    from include/linux/spinlock.h:51,
                    from include/linux/seqlock.h:36,
                    from include/linux/time.h:6,
                    from include/uapi/linux/timex.h:56,
                    from include/linux/timex.h:56,
                    from include/linux/clocksource.h:13,
                    from arch/x86/kernel/kvmclock.c:19:
   arch/x86/kernel/kvmclock.c: In function 'kvmclock_init_mem':
>> include/linux/cpumask.h:109:29: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define num_possible_cpus() 1U
                                ^
>> arch/x86/kernel/kvmclock.c:243:23: note: in expansion of macro 'num_possible_cpus'
     unsigned int ncpus = num_possible_cpus() - HVC_BOOT_ARRAY_SIZE;
                          ^~~~~~~~~~~~~~~~~
--
   In file included from arch/x86/include/asm/cpumask.h:5:0,
                    from arch/x86/include/asm/msr.h:11,
                    from arch/x86/include/asm/processor.h:21,
                    from arch/x86/include/asm/cpufeature.h:5,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:38,
                    from arch/x86/include/asm/preempt.h:7,
                    from include/linux/preempt.h:81,
                    from include/linux/spinlock.h:51,
                    from include/linux/seqlock.h:36,
                    from include/linux/time.h:6,
                    from include/uapi/linux/timex.h:56,
                    from include/linux/timex.h:56,
                    from include/linux/clocksource.h:13,
                    from arch/x86//kernel/kvmclock.c:19:
   arch/x86//kernel/kvmclock.c: In function 'kvmclock_init_mem':
>> include/linux/cpumask.h:109:29: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define num_possible_cpus() 1U
                                ^
   arch/x86//kernel/kvmclock.c:243:23: note: in expansion of macro 'num_possible_cpus'
     unsigned int ncpus = num_possible_cpus() - HVC_BOOT_ARRAY_SIZE;
                          ^~~~~~~~~~~~~~~~~

vim +/num_possible_cpus +243 arch/x86/kernel/kvmclock.c

   240	
   241	static void __init kvmclock_init_mem(void)
   242	{
 > 243		unsigned int ncpus = num_possible_cpus() - HVC_BOOT_ARRAY_SIZE;
   244		unsigned int order = get_order(ncpus * sizeof(*hvclock_mem));
   245		struct page *p;
   246		int r;
   247	
   248		p = alloc_pages(GFP_KERNEL, order);
   249		if (p) {
   250			hvclock_mem = page_address(p);
   251	
   252			/*
   253			 * hvclock is shared between the guest and the hypervisor, must
   254			 * be mapped decrypted.
   255			 */
   256			if (sev_active()) {
   257				r = set_memory_decrypted((unsigned long) hvclock_mem,
   258							 1UL << order);
   259				if (r) {
   260					__free_pages(p, order);
   261					hvclock_mem = NULL;
   262					return;
   263				}
   264			}
   265	
   266			memset(hvclock_mem, 0, PAGE_SIZE << order);
   267		}
   268	}
   269	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip