All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timothy Pearson <tpearson@raptorengineering.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: regressions <regressions@lists.linux.dev>,
	 Pavel Begunkov <asml.silence@gmail.com>
Subject: Re: Regression in io_uring, leading to data corruption
Date: Tue, 14 Nov 2023 11:14:30 -0600 (CST)	[thread overview]
Message-ID: <2027589474.47298231.1699982070160.JavaMail.zimbra@raptorengineeringinc.com> (raw)
In-Reply-To: <3056f9eb-1656-4e6d-b063-849573e685cd@kernel.dk>



----- Original Message -----
> From: "Jens Axboe" <axboe@kernel.dk>
> To: "Timothy Pearson" <tpearson@raptorengineering.com>
> Cc: "regressions" <regressions@lists.linux.dev>, "Pavel Begunkov" <asml.silence@gmail.com>
> Sent: Tuesday, November 14, 2023 11:04:03 AM
> Subject: Re: Regression in io_uring, leading to data corruption

> On 11/14/23 9:59 AM, Timothy Pearson wrote:
>> 
>> 
>> ----- Original Message -----
>>> From: "Jens Axboe" <axboe@kernel.dk>
>>> To: "Timothy Pearson" <tpearson@raptorengineering.com>
>>> Cc: "regressions" <regressions@lists.linux.dev>, "Pavel Begunkov"
>>> <asml.silence@gmail.com>
>>> Sent: Tuesday, November 14, 2023 7:17:22 AM
>>> Subject: Re: Regression in io_uring, leading to data corruption
>> 
>>> On 11/13/23 10:06 PM, Timothy Pearson wrote:
>>>>
>>>>
>>>> ----- Original Message -----
>>>>> From: "Timothy Pearson" <tpearson@raptorengineering.com>
>>>>> To: "Jens Axboe" <axboe@kernel.dk>
>>>>> Cc: "regressions" <regressions@lists.linux.dev>, "Pavel Begunkov"
>>>>> <asml.silence@gmail.com>
>>>>> Sent: Monday, November 13, 2023 6:52:51 PM
>>>>> Subject: Re: Regression in io_uring, leading to data corruption
>>>>>
>>>>> Seemed to do what I wanted, however corruption remains.  Was worth a try...
>>>>>
>>>>> I guess I'll proceed under the assumption that somehow the thread setup is
>>>>> stomping on userspace for now.
>>>>
>>>> Finally found it!  Patch here:
>>>>
>>>> https://lore.kernel.org/regressions/19221908.47168775.1699937769845.JavaMail.zimbra@raptorengineeringinc.com/T/#u
>>>>
>>>> We were missing the appropriate barrier instruction inside the IPI
>>>> issued by the task_work_add() call, which was in turn issued during
>>>> queued io worker creation.  The explaination for how userspace was
>>>> getting corrupted boils down to an inconsistent view of main memory as
>>>> seen the two cores involved in the worker handoff and new worker
>>>> creation.
>>>>
>>>> Who doesn't love a one line fix after a week and a half of pulling
>>>> one's hair out? ;)
>>>
>>> Hate to be a debbie downer, but it still fails for me with that patch:
>>>
>>> debian@linux-kernel--io-uring:~/git/server/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=500
>>> [...]
>>> encryption.innodb_encryption 'innodb,undo0' [ 39 pass ]   3101
>>> encryption.innodb_encryption 'innodb,undo0' [ 40 fail ]
>>>        Test ended at 2023-11-14 13:02:52
>>>
>>> CURRENT_TEST: encryption.innodb_encryption
>>> mysqltest: At line 11: query 'SET @start_global_value =
>>> @@global.innodb_encryption_threads' failed: ER_UNKNOWN_SYSTEM_VARIABLE (1193):
>>> Unknown system variable 'innodb_encryption_threads'
>>>
>>> The result from queries just before the failure was:
>>> SET @start_global_value = @@global.innodb_encryption_threads;
>>>
>>> - saving '/dev/shm/mysql/log/encryption.innodb_encryption-innodb,undo0/' to
>>> '/dev/shm/mysql/log/encryption.innodb_encryption-innodb,undo0/'
>>> ***Warnings generated in error logs during shutdown after running tests:
>>> encryption.innodb_encryption
>>>
>>> 2023-11-14 13:02:51 0 [Warning] Plugin 'example_key_management' is of maturity
>>> level experimental while the server is stable
>>> 2023-11-14 13:02:51 0 [ERROR] InnoDB: Database page corruption on disk or a
>>> failed read of file './ibdata1' page [page id: space=0, page number=220]. You
>>> may have to recover from a backup.
>>> 2023-11-14 13:02:51 0 [ERROR] InnoDB: File './ibdata1' is corrupted
>>> 2023-11-14 13:02:51 0 [ERROR] InnoDB: Plugin initialization aborted with error
>>> Page read from tablespace is corrupted.
>>> 2023-11-14 13:02:52 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE
>>> failed.
>>>
>>> after about 40 loops. How consistent is it on your end? I know I've
>>> suspected the signaling before and tried the NO_IPI variant, but that
>>> still hit it.
>>>
>>> If it makes a difference for you, it must be close. But don't think it's
>>> quite there yet, unfortunately :-(
>> 
>> Interesting!  I've run it for thousands of loops on my test VM, no
>> failures.  Let me try on the shared test box.
> 
> So odd. I guess it must be close if it's enough to make yours sane. The
> other vm I've been using is just a small vm somewhere else, it has 8
> threads of:
> 
> debian@linux-kernel--io-uring:~$ cat /proc/cpuinfo
> processor	: 0
> cpu		: POWER9 (architected), altivec supported
> clock		: 2200.000000MHz
> revision	: 2.2 (pvr 004e 1202)
> [...]
> timebase	: 512000000
> platform	: pSeries
> model		: IBM pSeries (emulated by qemu)
> machine		: CHRP IBM pSeries (emulated by qemu)
> MMU		: Radix

At this point my concern is there might be two bugs, one related to the IPI and one related to the direct creation path.  Since I can't reproduce easily on my end, can you see if the box you have acecss to is ever hitting the io_wq_create_worker() call inside io_wq_enqueue()?

  reply	other threads:[~2023-11-14 17:14 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07 16:34 Regression in io_uring, leading to data corruption Timothy Pearson
2023-11-07 16:49 ` Jens Axboe
2023-11-07 16:57   ` Timothy Pearson
2023-11-07 17:14     ` Jens Axboe
2023-11-07 21:22 ` Jens Axboe
2023-11-07 21:39   ` Timothy Pearson
2023-11-07 21:46     ` Jens Axboe
2023-11-07 22:07       ` Timothy Pearson
2023-11-07 22:16         ` Jens Axboe
2023-11-07 22:29           ` Timothy Pearson
2023-11-07 22:44             ` Jens Axboe
2023-11-07 23:12               ` Timothy Pearson
2023-11-07 23:16                 ` Jens Axboe
2023-11-07 23:34                   ` Timothy Pearson
2023-11-07 23:52                     ` Jens Axboe
2023-11-08  0:02                       ` Timothy Pearson
2023-11-08  0:09                         ` Jens Axboe
2023-11-08  3:27                           ` Timothy Pearson
2023-11-08  3:30                             ` Timothy Pearson
2023-11-08  4:00                           ` Timothy Pearson
2023-11-08 15:10                             ` Jens Axboe
2023-11-08 15:14                               ` Jens Axboe
2023-11-08 17:10                                 ` Timothy Pearson
2023-11-08 17:26                                   ` Jens Axboe
2023-11-08 17:40                                     ` Timothy Pearson
2023-11-08 17:49                                       ` Jens Axboe
2023-11-08 17:57                                         ` Jens Axboe
2023-11-08 18:36                                           ` Timothy Pearson
2023-11-08 18:51                                             ` Timothy Pearson
2023-11-08 19:08                                               ` Jens Axboe
2023-11-08 19:06                                             ` Jens Axboe
2023-11-08 22:05                                               ` Jens Axboe
2023-11-08 22:15                                                 ` Timothy Pearson
2023-11-08 22:18                                                   ` Jens Axboe
2023-11-08 22:28                                                     ` Timothy Pearson
2023-11-08 23:58                                                     ` Jens Axboe
2023-11-09 15:12                                                       ` Jens Axboe
2023-11-09 17:00                                                         ` Timothy Pearson
2023-11-09 17:17                                                           ` Jens Axboe
2023-11-09 17:24                                                             ` Timothy Pearson
2023-11-09 17:30                                                               ` Jens Axboe
2023-11-09 17:36                                                                 ` Timothy Pearson
2023-11-09 17:38                                                                   ` Jens Axboe
2023-11-09 17:42                                                                     ` Timothy Pearson
2023-11-09 17:45                                                                       ` Jens Axboe
2023-11-09 18:20                                                                         ` tpearson
2023-11-10  3:51                                                                           ` Jens Axboe
2023-11-10  4:35                                                                             ` Timothy Pearson
2023-11-10  6:48                                                                               ` Timothy Pearson
2023-11-10 14:52                                                                                 ` Jens Axboe
2023-11-11 18:42                                                                                   ` Timothy Pearson
2023-11-11 18:58                                                                                     ` Jens Axboe
2023-11-11 19:04                                                                                       ` Timothy Pearson
2023-11-11 19:11                                                                                         ` Jens Axboe
2023-11-11 19:15                                                                                           ` Timothy Pearson
2023-11-11 19:23                                                                                             ` Jens Axboe
2023-11-11 21:57                                                                                     ` Timothy Pearson
2023-11-13 17:06                                                                                       ` Timothy Pearson
2023-11-13 17:39                                                                                         ` Jens Axboe
2023-11-13 19:02                                                                                           ` Timothy Pearson
2023-11-13 19:29                                                                                             ` Jens Axboe
2023-11-13 20:58                                                                                               ` Timothy Pearson
2023-11-13 21:22                                                                                                 ` Timothy Pearson
2023-11-13 22:15                                                                                                 ` Jens Axboe
2023-11-13 23:19                                                                                                   ` Timothy Pearson
2023-11-13 23:48                                                                                                     ` Jens Axboe
2023-11-14  0:04                                                                                                       ` Timothy Pearson
2023-11-14  0:13                                                                                                         ` Jens Axboe
2023-11-14  0:52                                                                                                           ` Timothy Pearson
2023-11-14  5:06                                                                                                             ` Timothy Pearson
2023-11-14 13:17                                                                                                               ` Jens Axboe
2023-11-14 16:59                                                                                                                 ` Timothy Pearson
2023-11-14 17:04                                                                                                                   ` Jens Axboe
2023-11-14 17:14                                                                                                                     ` Timothy Pearson [this message]
2023-11-14 17:17                                                                                                                       ` Jens Axboe
2023-11-14 17:21                                                                                                                         ` Timothy Pearson
2023-11-14 17:57                                                                                                                           ` Timothy Pearson
2023-11-14 18:02                                                                                                                             ` Jens Axboe
2023-11-14 18:12                                                                                                                               ` Timothy Pearson
2023-11-14 18:26                                                                                                                                 ` Jens Axboe
2023-11-15 11:03                                                                                                                                   ` Timothy Pearson
2023-11-15 16:46                                                                                                                                     ` Jens Axboe
2023-11-15 17:03                                                                                                                                       ` Timothy Pearson
2023-11-15 18:30                                                                                                                                         ` Jens Axboe
2023-11-15 18:35                                                                                                                                           ` Timothy Pearson
2023-11-15 18:37                                                                                                                                             ` Jens Axboe
2023-11-15 18:40                                                                                                                                               ` Timothy Pearson
2023-11-15 19:00                                                                                                                                           ` Jens Axboe
2023-11-16  3:28                                                                                                                                             ` Timothy Pearson
2023-11-16  3:46                                                                                                                                               ` Jens Axboe
2023-11-16  3:54                                                                                                                                                 ` Timothy Pearson
2023-11-19  0:16                                                                                                                                                   ` Timothy Pearson
2023-11-13 20:47                                                                                         ` Jens Axboe
2023-11-13 21:08                                                                                           ` Timothy Pearson
2023-11-10 14:48                                                                               ` Jens Axboe

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=2027589474.47298231.1699982070160.JavaMail.zimbra@raptorengineeringinc.com \
    --to=tpearson@raptorengineering.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=regressions@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.