From: Jan Kara <jack@suse.cz>
To: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Cc: Jan Kara <jack@suse.cz>, Philipp Stanner <pstanner@redhat.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>, Chris Mason <clm@fb.com>,
Andrew Morton <akpm@linux-foundation.org>,
Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org, linux-mm@kvack.org,
Yury Norov <yury.norov@gmail.com>
Subject: Re: [PATCH v1 1/1] xarray: fix the data-race in xas_find_chunk() by using READ_ONCE()
Date: Mon, 18 Sep 2023 16:17:22 +0200 [thread overview]
Message-ID: <20230918141722.gasntomhkkp2fwy2@quack3> (raw)
In-Reply-To: <c50b5eb4-afcd-d810-4411-c43e373a5a95@alu.unizg.hr>
On Mon 18-09-23 15:34:46, Mirsad Todorovac wrote:
> On 9/18/23 15:18, Jan Kara wrote:
> > On Mon 18-09-23 14:46:02, Mirsad Todorovac wrote:
> > > Hi,
> > >
> > > I tried this patch and the
> > >
> > > > > 95 _find_first_and_bit (lib/find_bit.c:114 (discriminator 10))
> > > > > 31 _find_first_zero_bit (lib/find_bit.c:125 (discriminator 10))
> > > > > 173 _find_next_and_bit (lib/find_bit.c:171 (discriminator 2))
> > > > > 655 _find_next_bit (lib/find_bit.c:133 (discriminator 2))
> > > > > 5 _find_next_zero_bit
> > >
> > > data-races do not seem to appear any longer.
> >
> > Yup. You've just missed one case in _find_last_bit() and then all the
> > functions in include/linux/find.h need a similar treatment...
>
> I seem to have this:
>
> -----------------------------------------------------------------------------------
> #ifndef find_last_bit
> unsigned long _find_last_bit(const unsigned long *addr, unsigned long size)
> {
> if (size) {
> unsigned long val = BITMAP_LAST_WORD_MASK(size);
> unsigned long idx = (size-1) / BITS_PER_LONG;
>
> do {
> val &= READ_ONCE(addr[idx]);
> if (val)
> return idx * BITS_PER_LONG + __fls(val);
>
> val = ~0ul;
> } while (idx--);
> }
> return size;
> }
> EXPORT_SYMBOL(_find_last_bit);
> #endif
> -----------------------------------------------------------------------------------
>
> Is there something I did not notice?
No, this looks correct. I just somehow didn't see this hunk in the diff
you've posted.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2023-09-18 14:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-18 4:47 Mirsad Goran Todorovac
2023-09-18 9:41 ` Jan Kara
2023-09-18 10:20 ` Mirsad Todorovac
2023-09-18 11:38 ` Jan Kara
2023-09-18 12:46 ` Mirsad Todorovac
2023-09-18 13:18 ` Jan Kara
2023-09-18 13:34 ` Mirsad Todorovac
2023-09-18 14:17 ` Jan Kara [this message]
2023-09-18 14:59 ` Yury Norov
2023-09-18 15:33 ` Mirsad Todorovac
2023-09-18 15:54 ` Jan Kara
2023-09-18 16:28 ` Mirsad Todorovac
2023-09-18 18:56 ` Yury Norov
2023-09-19 4:20 ` Matthew Wilcox
2023-10-06 14:39 ` Mirsad Todorovac
2023-10-09 10:15 ` Jan Kara
2023-10-11 22:09 ` Mirsad Todorovac
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=20230918141722.gasntomhkkp2fwy2@quack3 \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mirsad.todorovac@alu.unizg.hr \
--cc=pstanner@redhat.com \
--cc=willy@infradead.org \
--cc=yury.norov@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