mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Will Deacon <will@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Andrea Parri <parri.andrea@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	David Howells <dhowells@redhat.com>,
	Jade Alglave <j.alglave@ucl.ac.uk>,
	Luc Maranget <luc.maranget@inria.fr>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Akira Yokosawa <akiyks@gmail.com>,
	Daniel Lustig <dlustig@nvidia.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [PATCH] wait_on_bit: add an acquire memory barrier
Date: Fri, 26 Aug 2022 07:46:13 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.2208260727020.17585@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <20220826112327.GA19774@willie-the-truck>



On Fri, 26 Aug 2022, Will Deacon wrote:

> On Thu, Aug 25, 2022 at 05:03:40PM -0400, Mikulas Patocka wrote:
> > Here I reworked your patch, so that test_bit_acquire is defined just like 
> > test_bit. There's some code duplication (in 
> > include/asm-generic/bitops/generic-non-atomic.h and in 
> > arch/x86/include/asm/bitops.h), but that duplication exists in the 
> > test_bit function too.
> > 
> > I tested it on x86-64 and arm64. On x86-64 it generates the "bt" 
> > instruction for variable-bit test and "shr; and $1" for constant bit test. 
> > On arm64 it generates the "ldar" instruction for both constant and 
> > variable bit test.
> > 
> > For me, the kernel 6.0-rc2 doesn't boot in an arm64 virtual machine at all 
> > (with or without this patch), so I only compile-tested it on arm64. I have 
> > to bisect it.
> 
> It's working fine for me and I haven't had any other reports that it's not
> booting. Please could you share some more details about your setup so we
> can try to reproduce the problem?

I'm bisecting it now. I'll post the offending commit when I'm done.

It gets stuck without printing anything at this point:
Loading Linux 6.0.0-rc2 ...
Loading initial ramdisk ...
EFI stub: Booting Linux Kernel...
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services...

I uploaded my .config here: 
https://people.redhat.com/~mpatocka/testcases/arm64-config/config-6.0.0-rc2 
so you can try it on your own.

The host system is MacchiatoBIN board with Debian 10.12.

> This looks good to me, thanks for doing it! Just one thing that jumped out
> at me:
> 
> > Index: linux-2.6/include/linux/buffer_head.h
> > ===================================================================
> > --- linux-2.6.orig/include/linux/buffer_head.h
> > +++ linux-2.6/include/linux/buffer_head.h
> > @@ -156,7 +156,7 @@ static __always_inline int buffer_uptoda
> >  	 * make it consistent with folio_test_uptodate
> >  	 * pairs with smp_mb__before_atomic in set_buffer_uptodate
> >  	 */
> > -	return (smp_load_acquire(&bh->b_state) & (1UL << BH_Uptodate)) != 0;
> > +	return test_bit_acquire(BH_Uptodate, &bh->b_state);
> 
> Do you think it would be worth adding set_bit_release() and then relaxing
> set_buffer_uptodate() to use that rather than the smp_mb__before_atomic()?
> 
> Will

Yes, we could add this (but it would be better to add it in a separate 
patch, so that backporting of the origianal patch to -stable is easier).

Mikulas


  reply	other threads:[~2022-08-26 11:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22  9:38 Mikulas Patocka
2022-08-22 17:08 ` Linus Torvalds
2022-08-22 17:39   ` Linus Torvalds
2022-08-22 18:00     ` Joel Fernandes
2022-08-25 21:03     ` Mikulas Patocka
2022-08-25 21:54       ` Linus Torvalds
2022-08-26 13:17         ` [PATCH v3] " Mikulas Patocka
2022-08-26 16:45           ` Linus Torvalds
2022-08-26 17:19             ` Linus Torvalds
2022-08-26 17:50               ` Mikulas Patocka
2022-08-26 19:23           ` Geert Uytterhoeven
2022-08-26 20:03             ` [PATCH] provide arch_test_bit_acquire for architectures that define test_bit Mikulas Patocka
2022-08-26 20:07               ` Linus Torvalds
2022-08-26 20:03             ` [PATCH v3] wait_on_bit: add an acquire memory barrier Linus Torvalds
2022-08-26 20:43               ` [PATCH] provide arch_test_bit_acquire for architectures that define test_bit Mikulas Patocka
2022-08-26 23:10                 ` Linus Torvalds
2022-08-26 23:18                   ` Linus Torvalds
2022-08-27 11:38                   ` Mikulas Patocka
2022-08-27 16:50                     ` Linus Torvalds
2022-08-26  0:57       ` [PATCH] wait_on_bit: add an acquire memory barrier Alan Stern
2022-08-26 11:23       ` Will Deacon
2022-08-26 11:46         ` Mikulas Patocka [this message]
2022-08-26 14:08           ` Mikulas Patocka
2022-08-26 17:43             ` Will Deacon
2022-08-26 18:25               ` Mikulas Patocka
2022-08-26 18:31                 ` Ard Biesheuvel
2022-08-26 19:10                   ` Mikulas Patocka
2022-08-27  6:32                     ` Ard Biesheuvel
2022-08-27  6:56                       ` Ard Biesheuvel
2022-08-27  8:42                         ` Mikulas Patocka

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=alpine.LRH.2.02.2208260727020.17585@file01.intranet.prod.int.rdu2.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=akiyks@gmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dlustig@nvidia.com \
    --cc=j.alglave@ucl.ac.uk \
    --cc=joel@joelfernandes.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc.maranget@inria.fr \
    --cc=npiggin@gmail.com \
    --cc=parri.andrea@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=stern@rowland.harvard.edu \
    --cc=torvalds@linux-foundation.org \
    --cc=will@kernel.org \
    /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

all inboxes | Powered by JetHome®