lkml.org 
[lkml]   [2016]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv6 3/7] printk: introduce per-cpu safe_print seq buffer
Hi Sergey,

[auto build test ERROR on linus/master]
[also build test ERROR on next-20161221]
[cannot apply to v4.9]
[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/Sergey-Senozhatsky/printk-use-vprintk_func-in-vprintk/20161222-075616
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64

Note: the linux-review/Sergey-Senozhatsky/printk-use-vprintk_func-in-vprintk/20161222-075616 HEAD 43ffcdc67ed0e40d3cf6137a37fbe557bfee4fb7 builds fine.
It only hurts bisectibility.

All error/warnings (new ones prefixed by >>):

In file included from arch/ia64/include/asm/intrinsics.h:10:0,
from arch/ia64/include/asm/bitops.h:18,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/list.h:8,
from include/linux/preempt.h:10,
from kernel/printk/printk_safe.c:18:
kernel/printk/printk_safe.c: In function 'printk_safe_log_store':
>> kernel/printk/printk_safe.c:82:15: error: 'nmi_message_lost' undeclared (first use in this function)
atomic_inc(&nmi_message_lost);
^
arch/ia64/include/uapi/asm/intrinsics.h:60:24: note: in definition of macro 'ia64_fetchadd'
volatile __typeof__(*(v)) *_v = (v); \
^
>> arch/ia64/include/asm/atomic.h:75:5: note: in expansion of macro 'ia64_fetch_and_add'
? ia64_fetch_and_add(__ia64_aar_i, &(v)->counter) \
^~~~~~~~~~~~~~~~~~
>> arch/ia64/include/asm/atomic.h:316:33: note: in expansion of macro 'atomic_add_return'
#define atomic_add(i,v) (void)atomic_add_return((i), (v))
^~~~~~~~~~~~~~~~~
>> arch/ia64/include/asm/atomic.h:318:25: note: in expansion of macro 'atomic_add'
#define atomic_inc(v) atomic_add(1, (v))
^~~~~~~~~~
>> kernel/printk/printk_safe.c:82:3: note: in expansion of macro 'atomic_inc'
atomic_inc(&nmi_message_lost);
^~~~~~~~~~
kernel/printk/printk_safe.c:82:15: note: each undeclared identifier is reported only once for each function it appears in
atomic_inc(&nmi_message_lost);
^
arch/ia64/include/uapi/asm/intrinsics.h:60:24: note: in definition of macro 'ia64_fetchadd'
volatile __typeof__(*(v)) *_v = (v); \
^
>> arch/ia64/include/asm/atomic.h:75:5: note: in expansion of macro 'ia64_fetch_and_add'
? ia64_fetch_and_add(__ia64_aar_i, &(v)->counter) \
^~~~~~~~~~~~~~~~~~
>> arch/ia64/include/asm/atomic.h:316:33: note: in expansion of macro 'atomic_add_return'
#define atomic_add(i,v) (void)atomic_add_return((i), (v))
^~~~~~~~~~~~~~~~~
>> arch/ia64/include/asm/atomic.h:318:25: note: in expansion of macro 'atomic_add'
#define atomic_inc(v) atomic_add(1, (v))
^~~~~~~~~~
>> kernel/printk/printk_safe.c:82:3: note: in expansion of macro 'atomic_inc'
atomic_inc(&nmi_message_lost);
^~~~~~~~~~

vim +/nmi_message_lost +82 kernel/printk/printk_safe.c

42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 12 * GNU General Public License for more details.
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 13 *
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 14 * You should have received a copy of the GNU General Public License
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 16 */
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 17
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 @18 #include <linux/preempt.h>
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 19 #include <linux/spinlock.h>
cf9b1106 kernel/printk/nmi.c Petr Mladek 2016-05-20 20 #include <linux/debug_locks.h>
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 21 #include <linux/smp.h>
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 22 #include <linux/cpumask.h>
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 23 #include <linux/irq_work.h>
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 24 #include <linux/printk.h>
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 25
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 26 #include "internal.h"
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 27
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 28 /*
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 29 * printk() could not take logbuf_lock in NMI context. Instead,
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 30 * it uses an alternative implementation that temporary stores
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 31 * the strings into a per-CPU buffer. The content of the buffer
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 32 * is later flushed into the main ring buffer via IRQ work.
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 33 *
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 34 * The alternative implementation is chosen transparently
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 35 * by examinig current printk() context mask stored in @printk_context
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 36 * per-CPU variable.
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 37 *
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 38 * The implementation allows to flush the strings also from another CPU.
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 39 * There are situations when we want to make sure that all buffers
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 40 * were handled or when IRQs are blocked.
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 41 */
c178cb8a kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 42 static int printk_safe_irq_ready;
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 43
c178cb8a kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 44 #define SAFE_LOG_BUF_LEN ((1 << CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT) - \
427934b8 kernel/printk/nmi.c Petr Mladek 2016-05-20 45 sizeof(atomic_t) - sizeof(struct irq_work))
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 46
c178cb8a kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 47 struct printk_safe_seq_buf {
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 48 atomic_t len; /* length of written data */
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 49 struct irq_work work; /* IRQ work that flushes the buffer */
c178cb8a kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 50 unsigned char buffer[SAFE_LOG_BUF_LEN];
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 51 };
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 52
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 53 static DEFINE_PER_CPU(struct printk_safe_seq_buf, safe_print_seq);
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 54 static DEFINE_PER_CPU(int, printk_context);
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 55
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 56 #ifdef CONFIG_PRINTK_NMI
c178cb8a kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 57 static DEFINE_PER_CPU(struct printk_safe_seq_buf, nmi_print_seq);
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 58 atomic_t nmi_message_lost;
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 59 #endif
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 60
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 61 /*
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 62 * Add a message to per-CPU context-dependent buffer. NMI and printk-safe
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 63 * have dedicated buffers, because otherwise printk-safe preempted by
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 64 * NMI-printk would have overwritten the NMI messages.
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 65 *
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 66 * The messages are fushed from irq work (of from panic()), possibly,
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 67 * from other CPU, concurrently with printk_safe_log_store(). Should this
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 68 * happen, printk_safe_log_store() will notice the buffer->len mismatch
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 69 * and repeat the write.
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 70 */
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 71 static int printk_safe_log_store(struct printk_safe_seq_buf *s,
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 72 const char *fmt, va_list args)
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 73 {
927f128d kernel/printk/printk_safe.c Sergey Senozhatsky 2016-12-21 74 int add;
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 75 size_t len;
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 76
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 77 again:
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 78 len = atomic_read(&s->len);
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 79
4a998e32 kernel/printk/nmi.c Petr Mladek 2016-12-12 80 /* The trailing '\0' is not counted into len. */
4a998e32 kernel/printk/nmi.c Petr Mladek 2016-12-12 81 if (len >= sizeof(s->buffer) - 1) {
b522deab kernel/printk/nmi.c Petr Mladek 2016-05-20 @82 atomic_inc(&nmi_message_lost);
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 83 return 0;
b522deab kernel/printk/nmi.c Petr Mladek 2016-05-20 84 }
42a0bb3f kernel/printk/nmi.c Petr Mladek 2016-05-20 85

:::::: The code at line 82 was first introduced by commit
:::::: b522deabc6f18e4f938d93a84f345f2cbf3347d1 printk/nmi: warn when some message has been lost in NMI context

:::::: TO: Petr Mladek <pmladek@suse.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2016-12-22 01:54    [W:1.261 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site