From: NeilBrown <neilb@suse.com>
To: David R <david@unsolicited.net>, Shaohua Li <shli@kernel.org>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
Shaohua Li <shli@fb.com>,
linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org
Subject: Re: [MD] Crash with 4.12+ kernel and high disk load -- bisected to 4ad23a976413: MD: use per-cpu counter for writes_pending
Date: Tue, 08 Aug 2017 17:04:07 +1000 [thread overview]
Message-ID: <87h8xisfq0.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20170808065526.Horde.9rrpLi3TCaOrBk9KfEU4ZFP@vinovium.com>
[-- Attachment #1: Type: text/plain, Size: 2117 bytes --]
On Tue, Aug 08 2017, David R wrote:
> Quoting Shaohua Li <shli@kernel.org>:
>
>> Spent some time to check this one, unfortunately I can't find how that patch
>> makes rcu stall. the percpu part looks good to me too. Can you
>> double check if
>> reverting 4ad23a976413aa57 makes the issue go away? When the rcu
>> stall happens,
>> what the /sys/block/md/md0/array_state? please also attach /proc/mdstat. When
>> you say the mdx_raid1 threads are in 'R' state, can you double check if the
>> /proc/pid/stack always 0xffffffffff?
>>
>> Thanks,
>> Shaohua
>
> I confess to knowing absolutely nothing about the md code, so please
> don't be too hard on me. However
> :-
>
> static bool set_in_sync(struct mddev *mddev)
> {
> WARN_ON_ONCE(!spin_is_locked(&mddev->lock));
> if (!mddev->in_sync) {
> mddev->sync_checkers++;
> spin_unlock(&mddev->lock);
> percpu_ref_switch_to_atomic_sync(&mddev->writes_pending);
> spin_lock(&mddev->lock);
> if (!mddev->in_sync &&
> percpu_ref_is_zero(&mddev->writes_pending)) {
> mddev->in_sync = 1;
> /*
> * Ensure ->in_sync is visible before we clear
> * ->sync_checkers.
> */
> smp_mb();
> set_bit(MD_SB_CHANGE_CLEAN, &mddev->sb_flags);
> sysfs_notify_dirent_safe(mddev->sysfs_state);
> }
> if (--mddev->sync_checkers == 0)
> percpu_ref_switch_to_percpu(&mddev->writes_pending);
>
>
> The switch_to_percpu() takes place under mddev->lock however
> switch_to_atomic_sync() does not. A thread can be in the middle of (or
> about to execute) switch_to_atomic_sync() at the same time as another
> is calling switch_to_percpu(). This can't be correct surely?
No, that wouldn't be correct.
When switch_to_atomic_sync is called, ->sync_checkers > 0.
When switch_to_percpu is called ->sync_checkers == 0.
So they cannot happen at the same time.
Thanks for looking at the code!
NeilBrown
>
> Cheers
> David
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-08-08 7:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ee7921d2-d3ff-2381-1f05-2c07b8001d08@unsolicited.net>
2017-08-06 17:37 ` RESEND: Crash with 4.12.4 kernel and high disk load (monthly RAID 6 check) David R
2017-08-07 11:20 ` [MD] Crash with 4.12+ kernel and high disk load -- bisected to 4ad23a976413: MD: use per-cpu counter for writes_pending Dominik Brodowski
2017-08-08 4:51 ` Shaohua Li
2017-08-08 6:55 ` David R
2017-08-08 7:01 ` David R
2017-08-08 7:04 ` NeilBrown [this message]
2017-08-08 7:10 ` Dominik Brodowski
2017-08-08 7:01 ` NeilBrown
2017-08-08 7:36 ` Dominik Brodowski
2017-08-08 9:06 ` Dominik Brodowski
2017-08-09 6:28 ` David R
2017-08-08 8:02 ` David R
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=87h8xisfq0.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=david@unsolicited.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=shli@fb.com \
--cc=shli@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