From: "Darrick J. Wong" <djwong@kernel.org>
To: Nikolay Borisov <nborisov@suse.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Pavel Reichl <preichl@redhat.com>,
linux-xfs@vger.kernel.org, david@fromorbit.com
Subject: Re: [RFC PATCH 0/3] Remove mrlock
Date: Wed, 20 Jan 2021 12:14:57 -0800 [thread overview]
Message-ID: <20210120201457.GS3134581@magnolia> (raw)
In-Reply-To: <bc16a831-8d5d-c2e7-6065-3cbb7a1f92e5@suse.com>
On Wed, Jan 13, 2021 at 02:17:29PM +0200, Nikolay Borisov wrote:
>
>
> On 13.01.21 г. 14:09 ч., Christoph Hellwig wrote:
> > On Wed, Jan 13, 2021 at 01:41:09PM +0200, Nikolay Borisov wrote:
> >>
> >>
> >> On 13.01.21 ??. 13:27 ??., Christoph Hellwig wrote:
> >>> Pavel has looked into this before and got stuck on the allocator
> >>> workqueue offloads:
> >>>
> >>> [PATCH v13 0/4] xfs: Remove wrappers for some semaphores
> >>
> >> I haven't looked into his series but I fail to see how lifting
> >> rwsemaphore out of the nested structure can change the behavior ? It
> >> just removes a level of indirection. My patches are semantically
> >> identical to the original code.
> >
> > mrlocks have the mr_writer field that annotate that the is a writer
> > locking the lock. The XFS asserts use it to assert that the lock that
> > the current thread holds it for exclusive protection, which isn't
> > actually what the field says, and this breaks when XFS uses synchronous
> > execution of work_struct as basically an extension of the kernel stack.
>
> I'm still failing to see what's the problem of checking the last bit of
> the rwsem ->count field. It is set when the sem is held for writing
> (identical to what mr_write does). As I mention in the cover letter this
> might be considered a bit hacky because it exposes an internal detail of
> the rwsem i.e that the bit of interest is bit 0.
I don't want to tear into the implementation details of rwsems if I can
avoid it. Just because we all have one big happy address space doesn't
mean shortcuts won't hose everyone.
> But I believe the same
> can be achieved using lockdep_is_held_type(xx, 0/1) and making XFS's
> debug routines depend on lockdep being on.
Pavel Reichl tried that two months ago in:
https://lore.kernel.org/linux-xfs/20201102194135.174806-2-preichl@redhat.com/
which resulted in fstests regressions:
https://lore.kernel.org/linux-xfs/20201104005345.GC7115@magnolia/
TLDR: the ILOCK semaphore is data-centric, but lockdep's debugging
chains are task-centric, which causes incorrect lock validation reports.
The solutions as I see them are: (a) figure out if we really still need
to defer bmbt splits to workers to avoid overflowing the kernel stack;
or (b) making it possible to transfer rwsem ownership to shut up
lockdep; or (c) fix the is_held predicate to ignore ownership.
--D
>
> >
prev parent reply other threads:[~2021-01-20 20:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 11:17 [RFC PATCH 0/3] Remove mrlock Nikolay Borisov
2021-01-13 11:17 ` [RFC PATCH 1/3] xfs: Add is_rwsem_write_locked function Nikolay Borisov
2021-01-13 11:17 ` [RFC PATCH 2/3] xfs: Convert i_lock/i_mmaplock to rw_semaphore Nikolay Borisov
2021-01-13 11:17 ` [RFC PATCH 3/3] xfs: Remove mrlock Nikolay Borisov
2021-01-13 11:17 ` Nikolay Borisov
2021-01-13 11:27 ` [RFC PATCH 0/3] " Christoph Hellwig
2021-01-13 11:41 ` Nikolay Borisov
2021-01-13 12:09 ` Christoph Hellwig
2021-01-13 12:17 ` Nikolay Borisov
2021-01-20 20:14 ` Darrick J. Wong [this message]
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=20210120201457.GS3134581@magnolia \
--to=djwong@kernel.org \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
--cc=nborisov@suse.com \
--cc=preichl@redhat.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