linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Jens Axboe <axboe@kernel.dk>, Nicholas Piggin <npiggin@gmail.com>,
	Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: Memory coherency issue with IO thread offloading?
Date: Tue, 28 Mar 2023 00:53:04 +1100	[thread overview]
Message-ID: <87zg7ycncv.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <872a1b2b-5fe6-e1ac-5dda-dc806b21b3f5@kernel.dk>

Jens Axboe <axboe@kernel.dk> writes:
> On 3/24/23 6:42?PM, Michael Ellerman wrote:
>> Jens Axboe <axboe@kernel.dk> writes:
>>> I got a report sent to me from mariadb, in where 5.10.158 works fine and
>>> 5.10.162 is broken. And in fact, current 6.3-rc also fails the test
>>> case. Beware that this email is long, as I'm trying to include
>>> everything that may be relevant...
>>>
>>> The test case in question is pretty simple. On debian testing, do:
>>>
>>> $ sudo apt-get install mariadb-test
>>> $ cd /usr/share/mysql/mysql-test
>>> $ ./mtr --mysqld=--innodb-flush-method=fsync --mysqld=--innodb-use-native-aio=1 --vardir=/dev/shm/mysql  --force encryption.innodb_encryption,innodb,undo0 --repeat=200
>> 
>> I mostly use Fedora, the package name is the same but the mtr binary
>> ends up in /usr/share/mysql.
>> 
>>> and if it fails, you'll see something like:
>>>
>>> encryption.innodb_encryption 'innodb,undo0' [ 6 pass ]   3120
>>> encryption.innodb_encryption 'innodb,undo0' [ 7 pass ]   3123
>>> encryption.innodb_encryption 'innodb,undo0' [ 8 pass ]   3042
>>> encryption.innodb_encryption 'innodb,undo0' [ 9 fail ]
>>>         Test ended at 2023-03-23 16:55:17
>> 
>> I haven't been able to get this to fail yet. I've done several runs with
>> --repeat=500 and haven't seen any errors yet.
>> 
>> Are there any CONFIG options I'd need to trip this?
>
> I don't think you need any special CONFIG options. I'll attach my config
> here, and I know the default distro one hits it too. But perhaps the
> mariadb version is not new enough? I think you need 10.6 or above, as
> will use io_uring by default. What version are you running?

Yeah I had 10.5.

I ended up building mariadb git, and now I have it reproducing on one VM
I have.

For some reason I can't reproduce with the same setup on a bare metal
machine, which is odd.

...
>> My first guess would be that there's some missing barriers between the
>> thread that queues the IO and the IO worker thread. 
>
> That was my guess too, and I consulted Paul McKenney as well on that.
> And he had some ideas of course, in terms of ordering of the CQ ring.
> But tried it all out, and it still failed in the same way...
>
>> I think you're using schedule_work() for that though, which should be a
>> full barrier. Could it be on the completion side?
>
> queue_work() for the patch, before that it's io-wq which is an internal
> IO thread worker pool. The latter just needs a spin_lock() around
> queueing the work, and then a wake of the task. Typing this out, maybe
> this is where a barrier is now missing? If the IO thread is already
> running rather than sleeping?

It sounded promising, but I've tried adding barriers around all the spin
locks and it hasn't made any difference.

Are there barriers in the userspace code also? If so would they be in
liburing or in the actual mariadb code?

Possibly I'm completely wrong about barriers and it's something else,
but I can't think what.

I checked that the liburing tests are passing. Any idea what mariadb is
doing different that's likely to be triggering the bug?

cheers

  parent reply	other threads:[~2023-03-27 13:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 18:54 Memory coherency issue with IO thread offloading? Jens Axboe
2023-03-24  7:27 ` Christophe Leroy
2023-03-24 12:06   ` Jens Axboe
2023-03-25  0:15     ` Michael Ellerman
2023-03-25  0:20       ` Jens Axboe
2023-03-25  0:42 ` Michael Ellerman
2023-03-25  1:15   ` Jens Axboe
2023-03-25  1:20     ` Jens Axboe
2023-03-27  4:22       ` Nicholas Piggin
2023-03-27 12:39         ` Jens Axboe
2023-03-27 21:24           ` Jens Axboe
2023-03-28 12:51             ` Michael Ellerman
2023-03-28 16:38               ` Jens Axboe
2023-03-27 13:53     ` Michael Ellerman [this message]
2023-03-28  6:20 Daniel Black
2023-03-28 12:10 ` Michael Ellerman

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=87zg7ycncv.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=axboe@kernel.dk \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.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).