From: Mike Snitzer <snitzer@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-block <linux-block@vger.kernel.org>,
Sarthak Kukreti <sarthakkukreti@google.com>,
device-mapper development <dm-devel@redhat.com>,
Kees Cook <keescook@chromium.org>,
Alasdair G Kergon <agk@redhat.com>
Subject: Re: [git pull] device mapper fixes for 5.19-rc1
Date: Wed, 1 Jun 2022 19:10:36 -0400 [thread overview]
Message-ID: <Ypfx7MPYGehYdwCo@redhat.com> (raw)
In-Reply-To: <CAHk-=wjTOB7yuygFwz64xFHYthwdTOYoC=L2kM4k1GW2a80uNQ@mail.gmail.com>
On Wed, Jun 01 2022 at 5:43P -0400,
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Wed, Jun 1, 2022 at 1:59 PM Mike Snitzer <snitzer@kernel.org> wrote:
> >
> > ----------------------------------------------------------------
> > - Fix DM core's dm_table_supports_poll to return false if no data
> > devices.
>
> So looking at that one (mainly because of the incomprehensible
> explanation), I do note:
>
> (a) the caller does
>
> for (i = 0; i < t->num_targets; i++) {
> ti = t->targets + i;
>
> while the callee does
>
> unsigned i = 0;
>
> while (i < dm_table_get_num_targets(t)) {
> ti = dm_table_get_target(t, i++);
>
> Now, those things are entirely equivalent, but that latter form is
> likely to generate horribly bad code because those helper functions
> aren't some kind of trivial inline, they are actually normal functions
> that are defined later in that same source file.
Yes, that needs fixing.. but not urgently so.
> Maybe a compiler will do optimizations within that source file even
> for functions that haven't been defined yet. Traditionally not.
>
> Whatever. Probably not a case where anybody cares about performance,
> but it does strike me that the "use abstractions" version probably not
> only generates worse code, it seems less legible too.
>
> Very odd pattern.
OK, I can just nuke those wrappers. But yeah, none of this setup code
is fast path.
> (b) The commit message (which is why I started looking at this) says
> that it used to return true even if there are no data devices.
>
> But dm_table_supports_poll() actually _still_ returns true for at
> least one case of no data devices: if the dm_table has no targets at
> all.
Right, I'm aware.. ugly but not a case that really matters (more below).
> So I don't know. Maybe that is a "can't happen". But since I looked at
> this, I thought I'd just point out the two oddities I found while
> doing so.
It can happen that someone loads a table without any targets but it
isn't a case that matters given IO cannot be sent anywhere. For that
to happen the DM table will have been reloaded to have targets (at
which point all will be setup properly, assuming no bugs like was
fixed here).
I do see you've since pulled the changes.
Thanks,
Mike
next prev parent reply other threads:[~2022-06-01 23:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-01 20:59 [git pull] device mapper fixes for 5.19-rc1 Mike Snitzer
2022-06-01 21:43 ` Linus Torvalds
2022-06-01 23:10 ` Mike Snitzer [this message]
2022-06-01 21:52 ` pr-tracker-bot
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=Ypfx7MPYGehYdwCo@redhat.com \
--to=snitzer@kernel.org \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-block@vger.kernel.org \
--cc=sarthakkukreti@google.com \
--cc=torvalds@linux-foundation.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