All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/2] printk: stop including cache.h from printk.h
@ 2022-04-26 20:32 ` Peter Collingbourne
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Collingbourne @ 2022-04-26 20:32 UTC (permalink / raw)
  To: Andrey Konovalov, Hyeonggon Yoo, Andrew Morton, Catalin Marinas
  Cc: Peter Collingbourne, Linux ARM, Linux Memory Management List,
	Linux Kernel Mailing List, vbabka, penberg, roman.gushchin,
	iamjoonsoo.kim, rientjes, Herbert Xu, Andrey Ryabinin,
	Alexander Potapenko, Dmitry Vyukov, kasan-dev, Eric Biederman,
	Kees Cook

An inclusion of cache.h in printk.h was added in 2014 in
commit c28aa1f0a847 ("printk/cache: mark printk_once test variable
__read_mostly") in order to bring in the definition of __read_mostly. The
usage of __read_mostly was later removed in commit 3ec25826ae33 ("printk:
Tie printk_once / printk_deferred_once into .data.once for reset")
which made the inclusion of cache.h unnecessary, so remove it.

We have a small amount of code that depended on the inclusion of cache.h
from printk.h; fix that code to include the appropriate header.

This fixes a circular inclusion on arm64 (linux/printk.h -> linux/cache.h
-> asm/cache.h -> linux/kasan-enabled.h -> linux/static_key.h ->
linux/jump_label.h -> linux/bug.h -> asm/bug.h -> linux/printk.h) that
would otherwise be introduced by the next patch.

Build tested using {allyesconfig,defconfig} x {arm64,x86_64}.

Link: https://linux-review.googlesource.com/id/I8fd51f72c9ef1f2d6afd3b2cbc875aa4792c1fba
Signed-off-by: Peter Collingbourne <pcc@google.com>
---
 arch/arm64/include/asm/mte-kasan.h | 1 +
 arch/arm64/include/asm/percpu.h    | 1 +
 drivers/firmware/smccc/kvm_guest.c | 1 +
 include/linux/printk.h             | 1 -
 4 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/mte-kasan.h b/arch/arm64/include/asm/mte-kasan.h
index a857bcacf0fe..9f79425fc65a 100644
--- a/arch/arm64/include/asm/mte-kasan.h
+++ b/arch/arm64/include/asm/mte-kasan.h
@@ -6,6 +6,7 @@
 #define __ASM_MTE_KASAN_H
 
 #include <asm/compiler.h>
+#include <asm/cputype.h>
 #include <asm/mte-def.h>
 
 #ifndef __ASSEMBLY__
diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h
index 8f1661603b78..b9ba19dbdb69 100644
--- a/arch/arm64/include/asm/percpu.h
+++ b/arch/arm64/include/asm/percpu.h
@@ -10,6 +10,7 @@
 #include <asm/alternative.h>
 #include <asm/cmpxchg.h>
 #include <asm/stack_pointer.h>
+#include <asm/sysreg.h>
 
 static inline void set_my_cpu_offset(unsigned long off)
 {
diff --git a/drivers/firmware/smccc/kvm_guest.c b/drivers/firmware/smccc/kvm_guest.c
index 2d3e866decaa..89a68e7eeaa6 100644
--- a/drivers/firmware/smccc/kvm_guest.c
+++ b/drivers/firmware/smccc/kvm_guest.c
@@ -4,6 +4,7 @@
 
 #include <linux/arm-smccc.h>
 #include <linux/bitmap.h>
+#include <linux/cache.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 1522df223c0f..8e8d74edf121 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -6,7 +6,6 @@
 #include <linux/init.h>
 #include <linux/kern_levels.h>
 #include <linux/linkage.h>
-#include <linux/cache.h>
 #include <linux/ratelimit_types.h>
 #include <linux/once_lite.h>
 
-- 
2.36.0.rc2.479.g8af0fa9b8e-goog


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/2] printk: stop including cache.h from printk.h
@ 2022-04-28  2:00 kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2022-04-28  2:00 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 8292 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220426203231.2107365-1-pcc@google.com>
References: <20220426203231.2107365-1-pcc@google.com>
TO: Peter Collingbourne <pcc@google.com>
TO: Andrey Konovalov <andreyknvl@gmail.com>
TO: Hyeonggon Yoo <42.hyeyoo@gmail.com>
TO: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Catalin Marinas <catalin.marinas@arm.com>
CC: Peter Collingbourne <pcc@google.com>
CC: Linux ARM <linux-arm-kernel@lists.infradead.org>
CC: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
CC: vbabka(a)suse.cz
CC: penberg(a)kernel.org
CC: roman.gushchin(a)linux.dev
CC: iamjoonsoo.kim(a)lge.com
CC: rientjes(a)google.com
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: Andrey Ryabinin <ryabinin.a.a@gmail.com>
CC: Alexander Potapenko <glider@google.com>
CC: Dmitry Vyukov <dvyukov@google.com>
CC: "kasan-dev" <kasan-dev@googlegroups.com>
CC: Eric Biederman <ebiederm@xmission.com>
CC: Kees Cook <keescook@chromium.org>

Hi Peter,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on vbabka-slab/for-next]
[also build test ERROR on arm64/for-next/core linus/master v5.18-rc4 next-20220427]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Peter-Collingbourne/printk-stop-including-cache-h-from-printk-h/20220427-043357
base:   git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git for-next
:::::: branch date: 28 hours ago
:::::: commit date: 28 hours ago
config: parisc-randconfig-s031-20220425 (https://download.01.org/0day-ci/archive/20220428/202204280806.pOcl1gU4-lkp(a)intel.com/config)
compiler: hppa-linux-gcc (GCC) 11.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.4-dirty
        # https://github.com/intel-lab-lkp/linux/commit/edcb0f592304f7849a39586f9e3fe0d8f6e6c6b9
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Peter-Collingbourne/printk-stop-including-cache-h-from-printk-h/20220427-043357
        git checkout edcb0f592304f7849a39586f9e3fe0d8f6e6c6b9
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from kernel/bpf/bpf_lru_list.c:8:
>> kernel/bpf/bpf_lru_list.h:36:29: error: expected ':', ',', ';', '}' or '__attribute__' before '____cacheline_aligned_in_smp'
      36 |         raw_spinlock_t lock ____cacheline_aligned_in_smp;
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from kernel/bpf/bpf_lru_list.c:5:
   kernel/bpf/bpf_lru_list.c: In function 'bpf_lru_list_push_free':
>> kernel/bpf/bpf_lru_list.c:313:33: error: 'struct bpf_lru_list' has no member named 'lock'
     313 |         raw_spin_lock_irqsave(&l->lock, flags);
         |                                 ^~
   include/linux/spinlock.h:242:48: note: in definition of macro 'raw_spin_lock_irqsave'
     242 |                 flags = _raw_spin_lock_irqsave(lock);   \
         |                                                ^~~~
   kernel/bpf/bpf_lru_list.c:315:38: error: 'struct bpf_lru_list' has no member named 'lock'
     315 |         raw_spin_unlock_irqrestore(&l->lock, flags);
         |                                      ^~
   include/linux/spinlock.h:280:45: note: in definition of macro 'raw_spin_unlock_irqrestore'
     280 |                 _raw_spin_unlock_irqrestore(lock, flags);       \
         |                                             ^~~~
   kernel/bpf/bpf_lru_list.c: In function 'bpf_lru_list_pop_free_to_local':
   kernel/bpf/bpf_lru_list.c:325:25: error: 'struct bpf_lru_list' has no member named 'lock'
     325 |         raw_spin_lock(&l->lock);
         |                         ^~
   include/linux/spinlock.h:215:48: note: in definition of macro 'raw_spin_lock'
     215 | #define raw_spin_lock(lock)     _raw_spin_lock(lock)
         |                                                ^~~~
   kernel/bpf/bpf_lru_list.c:344:27: error: 'struct bpf_lru_list' has no member named 'lock'
     344 |         raw_spin_unlock(&l->lock);
         |                           ^~
   include/linux/spinlock.h:274:58: note: in definition of macro 'raw_spin_unlock'
     274 | #define raw_spin_unlock(lock)           _raw_spin_unlock(lock)
         |                                                          ^~~~
   kernel/bpf/bpf_lru_list.c: In function 'bpf_percpu_lru_pop_free':
   kernel/bpf/bpf_lru_list.c:410:33: error: 'struct bpf_lru_list' has no member named 'lock'
     410 |         raw_spin_lock_irqsave(&l->lock, flags);
         |                                 ^~
   include/linux/spinlock.h:242:48: note: in definition of macro 'raw_spin_lock_irqsave'
     242 |                 flags = _raw_spin_lock_irqsave(lock);   \
         |                                                ^~~~
   kernel/bpf/bpf_lru_list.c:426:38: error: 'struct bpf_lru_list' has no member named 'lock'
     426 |         raw_spin_unlock_irqrestore(&l->lock, flags);
         |                                      ^~
   include/linux/spinlock.h:280:45: note: in definition of macro 'raw_spin_unlock_irqrestore'
     280 |                 _raw_spin_unlock_irqrestore(lock, flags);       \
         |                                             ^~~~
   kernel/bpf/bpf_lru_list.c: In function 'bpf_percpu_lru_push_free':
   kernel/bpf/bpf_lru_list.c:544:33: error: 'struct bpf_lru_list' has no member named 'lock'
     544 |         raw_spin_lock_irqsave(&l->lock, flags);
         |                                 ^~
   include/linux/spinlock.h:242:48: note: in definition of macro 'raw_spin_lock_irqsave'
     242 |                 flags = _raw_spin_lock_irqsave(lock);   \
         |                                                ^~~~
   kernel/bpf/bpf_lru_list.c:548:38: error: 'struct bpf_lru_list' has no member named 'lock'
     548 |         raw_spin_unlock_irqrestore(&l->lock, flags);
         |                                      ^~
   include/linux/spinlock.h:280:45: note: in definition of macro 'raw_spin_unlock_irqrestore'
     280 |                 _raw_spin_unlock_irqrestore(lock, flags);       \
         |                                             ^~~~
   kernel/bpf/bpf_lru_list.c: In function 'bpf_lru_list_init':
   kernel/bpf/bpf_lru_list.c:643:30: error: 'struct bpf_lru_list' has no member named 'lock'
     643 |         raw_spin_lock_init(&l->lock);
         |                              ^~
   include/linux/spinlock.h:106:31: note: in definition of macro 'raw_spin_lock_init'
     106 |         __raw_spin_lock_init((lock), #lock, &__key, LD_WAIT_SPIN);      \
         |                               ^~~~


vim +36 kernel/bpf/bpf_lru_list.h

3a08c2fd763450 Martin KaFai Lau 2016-11-11  29  
3a08c2fd763450 Martin KaFai Lau 2016-11-11  30  struct bpf_lru_list {
3a08c2fd763450 Martin KaFai Lau 2016-11-11  31  	struct list_head lists[NR_BPF_LRU_LIST_T];
3a08c2fd763450 Martin KaFai Lau 2016-11-11  32  	unsigned int counts[NR_BPF_LRU_LIST_COUNT];
0ac16296ffc638 Qiujun Huang     2020-04-03  33  	/* The next inactive list rotation starts from here */
3a08c2fd763450 Martin KaFai Lau 2016-11-11  34  	struct list_head *next_inactive_rotation;
3a08c2fd763450 Martin KaFai Lau 2016-11-11  35  
3a08c2fd763450 Martin KaFai Lau 2016-11-11 @36  	raw_spinlock_t lock ____cacheline_aligned_in_smp;
3a08c2fd763450 Martin KaFai Lau 2016-11-11  37  };
3a08c2fd763450 Martin KaFai Lau 2016-11-11  38  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-04-28  2:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 20:32 [PATCH v4 1/2] printk: stop including cache.h from printk.h Peter Collingbourne
2022-04-26 20:32 ` Peter Collingbourne
2022-04-26 20:32 ` [PATCH v4 2/2] mm: make minimum slab alignment a runtime property Peter Collingbourne
2022-04-26 20:32   ` Peter Collingbourne
2022-04-27  3:25 ` [PATCH v4 1/2] printk: stop including cache.h from printk.h kernel test robot
2022-04-27  3:25   ` kernel test robot
2022-04-27  9:25 ` kernel test robot
2022-04-27  9:25   ` kernel test robot
2022-04-28  2:00 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.