From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Marco Elver <elver@google.com>
Cc: syzkaller-bugs@googlegroups.com,
syzbot <syzbot+5f47a8cea6a12b77a876@syzkaller.appspotmail.com>,
gregkh@linuxfoundation.org, jirislaby@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [syzbot] BUG: sleeping function called from invalid context in __might_resched
Date: Tue, 16 Nov 2021 12:35:27 +0100 [thread overview]
Message-ID: <5073833.kmqaQDgJIs@localhost.localdomain> (raw)
In-Reply-To: <CANpmjNMNC=3FiBB0aVVP9LXA9-03ug-sE4CqgJu2-sjdxA14TQ@mail.gmail.com>
On Tuesday, November 16, 2021 11:24:54 AM CET Marco Elver wrote:
> On Tue, 16 Nov 2021 at 08:57, Fabio M. De Francesco
> <fmdefrancesco@gmail.com> wrote:
> [...]
> > I think that this is more readable and comprehensible.
> >
> > Therefore, if I'm not wrong, Marco's "!preemptible()", that is "if (!
> > (preempt_count() == 0 && !irqs_disabled())", might be rewritten to an
easier
> > to understand "if (preempt_count() || irqs_disabled())".
> >
> > Am I wrong? Let's test it...
>
> It's right, but why not use preemptible()? The definition of
> preemptible() might change and then you'd have to fix the code again.
>
> I actually find (preempt_count() || irqs_disabled()) tells me less of
> what your intent here is vs. just writing !preemptible().
>
You are right :)
If we have a macro, there must be a good reason behind its existence. So
let's use it.
For I didn't know that we have that macro, I had to read its definition. Then
I had to understand what means the negation of its parts. It was a bit
difficult to understand, so I thought that open coding if we have preemption
disabled or irqs disabled was easier to understand.
But now I see that, as said, if we have an API we should use it.
I'm preparing a patch and give you proper credit for suggestions.
Thanks,
Fabio M. De Francesco
prev parent reply other threads:[~2021-11-16 11:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 10:18 [syzbot] BUG: sleeping function called from invalid context in __might_resched syzbot
2021-11-12 12:22 ` Fabio M. De Francesco
2021-11-12 13:58 ` Marco Elver
2021-11-12 16:05 ` Fabio M. De Francesco
2021-11-12 16:27 ` Marco Elver
2021-11-12 17:15 ` Fabio M. De Francesco
2021-11-13 20:13 ` syzbot
2021-11-16 7:57 ` Fabio M. De Francesco
2021-11-16 8:09 ` syzbot
2021-11-16 8:53 ` Fabio M. De Francesco
2021-11-16 8:55 ` syzbot
2021-11-16 9:03 ` Fabio M. De Francesco
2021-11-16 9:03 ` syzbot
2021-11-16 9:20 ` syzbot
2021-11-16 9:13 ` Fabio M. De Francesco
2021-11-16 9:38 ` syzbot
2021-11-16 10:24 ` Marco Elver
2021-11-16 11:35 ` Fabio M. De Francesco [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=5073833.kmqaQDgJIs@localhost.localdomain \
--to=fmdefrancesco@gmail.com \
--cc=elver@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+5f47a8cea6a12b77a876@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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