From: kbuild test robot <lkp@intel.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: kbuild-all@01.org, linux-kernel@vger.kernel.org,
Mark Rutland <mark.rutland@arm.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH] perf/ring_buffer: ensure atomicity and order of updates
Date: Fri, 11 May 2018 09:19:44 +0800 [thread overview]
Message-ID: <201805110700.0mgGxEvX%fengguang.wu@intel.com> (raw)
In-Reply-To: <20180510130632.34497-1-mark.rutland@arm.com>
[-- Attachment #1: Type: text/plain, Size: 10800 bytes --]
Hi Mark,
I love your patch! Perhaps something to improve:
[auto build test WARNING on tip/perf/core]
[also build test WARNING on v4.17-rc4 next-20180510]
[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/Mark-Rutland/perf-ring_buffer-ensure-atomicity-and-order-of-updates/20180511-070205
config: i386-randconfig-s1-201818 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from include/uapi/linux/swab.h:6:0,
from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/x86/include/uapi/asm/byteorder.h:5,
from include/uapi/linux/perf_event.h:20,
from include/linux/perf_event.h:17,
from kernel//events/ring_buffer.c:12:
kernel//events/ring_buffer.c: In function 'perf_output_put_handle':
include/linux/compiler.h:339:38: error: call to '__compiletime_assert_86' declared with attribute error: Need native word sized stores/loads for atomicity.
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:319:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:339:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:342:2: note: in expansion of macro 'compiletime_assert'
compiletime_assert(__native_word(t), \
^~~~~~~~~~~~~~~~~~
>> include/asm-generic/barrier.h:181:2: note: in expansion of macro 'compiletime_assert_atomic_type'
compiletime_assert_atomic_type(*p); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel//events/ring_buffer.c:86:2: note: in expansion of macro 'smp_store_release'
smp_store_release(&rb->user_page->data_head, head); /* B, matches C */
^~~~~~~~~~~~~~~~~
kernel//events/ring_buffer.c: In function 'perf_aux_output_skip':
include/linux/compiler.h:339:38: error: call to '__compiletime_assert_498' declared with attribute error: Need native word sized stores/loads for atomicity.
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:319:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:339:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:342:2: note: in expansion of macro 'compiletime_assert'
compiletime_assert(__native_word(t), \
^~~~~~~~~~~~~~~~~~
>> include/asm-generic/barrier.h:181:2: note: in expansion of macro 'compiletime_assert_atomic_type'
compiletime_assert_atomic_type(*p); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel//events/ring_buffer.c:498:2: note: in expansion of macro 'smp_store_release'
smp_store_release(&rb->user_page->aux_head, rb->aux_head);
^~~~~~~~~~~~~~~~~
kernel//events/ring_buffer.c: In function 'perf_aux_output_end':
include/linux/compiler.h:339:38: error: call to '__compiletime_assert_466' declared with attribute error: Need native word sized stores/loads for atomicity.
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:319:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:339:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:342:2: note: in expansion of macro 'compiletime_assert'
compiletime_assert(__native_word(t), \
^~~~~~~~~~~~~~~~~~
>> include/asm-generic/barrier.h:181:2: note: in expansion of macro 'compiletime_assert_atomic_type'
compiletime_assert_atomic_type(*p); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel//events/ring_buffer.c:466:2: note: in expansion of macro 'smp_store_release'
smp_store_release(&rb->user_page->aux_head, rb->aux_head);
^~~~~~~~~~~~~~~~~
--
In file included from include/uapi/linux/swab.h:6:0,
from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/x86/include/uapi/asm/byteorder.h:5,
from include/uapi/linux/perf_event.h:20,
from include/linux/perf_event.h:17,
from kernel/events/ring_buffer.c:12:
kernel/events/ring_buffer.c: In function 'perf_output_put_handle':
include/linux/compiler.h:339:38: error: call to '__compiletime_assert_86' declared with attribute error: Need native word sized stores/loads for atomicity.
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:319:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:339:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:342:2: note: in expansion of macro 'compiletime_assert'
compiletime_assert(__native_word(t), \
^~~~~~~~~~~~~~~~~~
>> include/asm-generic/barrier.h:181:2: note: in expansion of macro 'compiletime_assert_atomic_type'
compiletime_assert_atomic_type(*p); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/ring_buffer.c:86:2: note: in expansion of macro 'smp_store_release'
smp_store_release(&rb->user_page->data_head, head); /* B, matches C */
^~~~~~~~~~~~~~~~~
kernel/events/ring_buffer.c: In function 'perf_aux_output_skip':
include/linux/compiler.h:339:38: error: call to '__compiletime_assert_498' declared with attribute error: Need native word sized stores/loads for atomicity.
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:319:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:339:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:342:2: note: in expansion of macro 'compiletime_assert'
compiletime_assert(__native_word(t), \
^~~~~~~~~~~~~~~~~~
>> include/asm-generic/barrier.h:181:2: note: in expansion of macro 'compiletime_assert_atomic_type'
compiletime_assert_atomic_type(*p); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/ring_buffer.c:498:2: note: in expansion of macro 'smp_store_release'
smp_store_release(&rb->user_page->aux_head, rb->aux_head);
^~~~~~~~~~~~~~~~~
kernel/events/ring_buffer.c: In function 'perf_aux_output_end':
include/linux/compiler.h:339:38: error: call to '__compiletime_assert_466' declared with attribute error: Need native word sized stores/loads for atomicity.
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:319:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:339:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
>> include/linux/compiler.h:342:2: note: in expansion of macro 'compiletime_assert'
compiletime_assert(__native_word(t), \
^~~~~~~~~~~~~~~~~~
>> include/asm-generic/barrier.h:181:2: note: in expansion of macro 'compiletime_assert_atomic_type'
compiletime_assert_atomic_type(*p); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/ring_buffer.c:466:2: note: in expansion of macro 'smp_store_release'
smp_store_release(&rb->user_page->aux_head, rb->aux_head);
^~~~~~~~~~~~~~~~~
vim +/smp_store_release +86 kernel//events/ring_buffer.c
44
45 static void perf_output_put_handle(struct perf_output_handle *handle)
46 {
47 struct ring_buffer *rb = handle->rb;
48 unsigned long head;
49
50 again:
51 head = local_read(&rb->head);
52
53 /*
54 * IRQ/NMI can happen here, which means we can miss a head update.
55 */
56
57 if (!local_dec_and_test(&rb->nest))
58 goto out;
59
60 /*
61 * Since the mmap() consumer (userspace) can run on a different CPU:
62 *
63 * kernel user
64 *
65 * if (LOAD ->data_tail) { LOAD ->data_head
66 * (A) smp_rmb() (C)
67 * STORE $data LOAD $data
68 * smp_mb() (D)
69 * RELEASE ->data_head (B) STORE ->data_tail
70 * }
71 *
72 * Where A pairs with D, and B pairs with C.
73 *
74 * In our case (A) is a control dependency that separates the load of
75 * the ->data_tail and the stores of $data. In case ->data_tail
76 * indicates there is no room in the buffer to store $data we do not.
77 *
78 * D needs to be a full barrier since it separates the data READ
79 * from the tail WRITE.
80 *
81 * For B a WMB is sufficient since it separates two WRITEs, and for C
82 * an RMB is sufficient since it separates two READs.
83 *
84 * See perf_output_begin().
85 */
> 86 smp_store_release(&rb->user_page->data_head, head); /* B, matches C */
87
88 /*
89 * Now check if we missed an update -- rely on previous implied
90 * compiler barriers to force a re-read.
91 */
92 if (unlikely(head != local_read(&rb->head))) {
93 local_inc(&rb->nest);
94 goto again;
95 }
96
97 if (handle->wakeup != local_read(&rb->wakeup))
98 perf_output_wakeup(handle);
99
100 out:
101 preempt_enable();
102 }
103
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30272 bytes --]
next prev parent reply other threads:[~2018-05-11 1:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 13:06 [PATCH] perf/ring_buffer: ensure atomicity and order of updates Mark Rutland
2018-05-11 1:19 ` kbuild test robot [this message]
2018-05-11 1:19 ` kbuild test robot
2018-05-11 10:59 ` Mark Rutland
2018-05-11 16:22 ` Peter Zijlstra
2018-05-14 11:05 ` Mark Rutland
2018-05-14 11:28 ` Peter Zijlstra
2018-05-14 15:02 ` Peter Zijlstra
2018-05-14 15:20 ` Mark Rutland
2018-05-14 15:24 ` Peter Zijlstra
2018-05-23 16:42 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201805110700.0mgGxEvX%fengguang.wu@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).