From: Mark Rutland <mark.rutland@arm.com> To: linux-kernel@vger.kernel.org Cc: 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 11:59:32 +0100 Message-ID: <20180511105931.yyarmtz2gjkbuq2a@lakrids.cambridge.arm.com> (raw) In-Reply-To: <20180510130632.34497-1-mark.rutland@arm.com> On Thu, May 10, 2018 at 02:06:32PM +0100, Mark Rutland wrote: > - smp_wmb(); /* B, matches C */ > - rb->user_page->data_head = head; > + smp_store_release(&rb->user_page->data_head, head); /* B, matches C */ > - rb->user_page->aux_head = rb->aux_head; > + smp_store_release(&rb->user_page->aux_head, rb->aux_head); > - rb->user_page->aux_head = rb->aux_head; > + smp_store_release(&rb->user_page->aux_head, rb->aux_head); The kbuild test robot has helpfully discovered another latent bug here. We assume we can make single-copy-atomic accesses to {aux,data}_{head,tail}, but this isn't necessarily true on 32-bit architectures, and smp_store_release() rightly complains at build time. READ_ONCE() and WRITE_ONCE() "helpfully" make a silent fallback to a memcpy in this case, so we're broken today, regardless of this change. I suspect that in practice we get single-copy-atomicity for the 32-bit halves, and sessions likely produce less than 4GiB of ringbuffer data, so failures would be rare. I'm not sure how to fix the ABI here. The same issue applies on the userspace side, so whatever we do we need to fix both sides. Thanks, Mark.
next prev parent reply index Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-05-10 13:06 Mark Rutland 2018-05-11 1:19 ` kbuild test robot 2018-05-11 1:19 ` kbuild test robot 2018-05-11 10:59 ` Mark Rutland [this message] 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=20180511105931.yyarmtz2gjkbuq2a@lakrids.cambridge.arm.com \ --to=mark.rutland@arm.com \ --cc=linux-kernel@vger.kernel.org \ --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
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ linux-kernel@vger.kernel.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git