Linux-mmc Archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Sergei Antonov <saproj@gmail.com>
Cc: linux-mmc@vger.kernel.org, Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: breaking commit: mmc: moxart-mmc: Use sg_miter for PIO
Date: Tue, 23 Apr 2024 13:32:24 +0200	[thread overview]
Message-ID: <CACRpkdY60cQYOC_-dbs7xgW5OH7oCRO2Y5PEDgiS-9V=4pBj_A@mail.gmail.com> (raw)
In-Reply-To: <CABikg9zHfiTX3gR2qUWRTaeuu1FG4rvc7qhJWEj59ukns_-dDg@mail.gmail.com>

On Tue, Apr 23, 2024 at 1:14 PM Sergei Antonov <saproj@gmail.com> wrote:
> On Mon, 22 Apr 2024 at 20:55, Linus Walleij <linus.walleij@linaro.org> wrote:
> > On Sat, Apr 20, 2024 at 10:38 PM Sergei Antonov <saproj@gmail.com> wrote:
> >
> > > [    7.018270] BUG: scheduling while atomic: kworker/0:1/9/0x00000002
> > (...)
> > > [    7.057443] CPU: 0 PID: 9 Comm: kworker/0:1 Not tainted 6.8.0-rc4+ #225
> > > [    7.064527] Hardware name: Generic DT based system
> > > [    7.069677] Workqueue: events_freezable mmc_rescan
> > > [    7.075121]  unwind_backtrace from show_stack+0x10/0x14
> > > [    7.080930]  show_stack from dump_stack_lvl+0x34/0x44
> > > [    7.086576]  dump_stack_lvl from __schedule_bug+0x64/0x84
> > > [    7.092608]  __schedule_bug from __schedule+0x58/0x594
> > > [    7.098320]  __schedule from schedule+0x74/0xa8
> > > [    7.103368]  schedule from schedule_timeout+0xd4/0x108
> > > [    7.109070]  schedule_timeout from __wait_for_common+0x94/0x120
> > > [    7.115547]  __wait_for_common from moxart_request+0x278/0x468
> > > [    7.121980]  moxart_request from mmc_start_request+0x94/0xa8
> >
> > moxart_transfer_pio() is called from the interrupt handler and
> > should be properly atomic right, so the flags to sg_miter should
> > be fine.
>
> The stack in my message does not include moxart_irq() or
> moxart_transfer_pio(). It is not an IRQ.
>
> As a result of commit 3ee0e7c3e67cab83ffbbe7707b43df8d41c9fe47
> SG_MITER_ATOMIC is used in the context of moxart_request():
> moxart_request() -> moxart_prepare_data() -> sg_miter_start(,,,SG_MITER_ATOMIC)
> and in the same context down in the code a
> wait_for_completion_interruptible_timeout() is called.

This puzzles me since sg_miter_start() isn't doing anything
that is atomic, such as kmap_atomic(), which is only done in
sg_miter_next(). It doesn't even look at the flags, just assign it
to __flags in struct sg_mapping_iter.

I.e. calling sg_miter_start(,,,SG_MITER_ATOMIC) does not
need to happen in an atomic context.

Yours,
Linus Walleij

  reply	other threads:[~2024-04-23 11:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-20 20:38 breaking commit: mmc: moxart-mmc: Use sg_miter for PIO Sergei Antonov
2024-04-22 17:55 ` Linus Walleij
2024-04-23 11:14   ` Sergei Antonov
2024-04-23 11:32     ` Linus Walleij [this message]
2024-05-23 19:53 ` Linus Walleij

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='CACRpkdY60cQYOC_-dbs7xgW5OH7oCRO2Y5PEDgiS-9V=4pBj_A@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=saproj@gmail.com \
    --cc=ulf.hansson@linaro.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).