From: Wolfram Sang <wsa@the-dreams.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ulrich Hecht <uli+renesas@fpond.eu>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
Linux I2C <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH v2] i2c: sh_mobile: implement atomic transfers
Date: Thu, 25 Jun 2020 09:06:37 +0200 [thread overview]
Message-ID: <20200625070636.GB970@ninjato> (raw)
In-Reply-To: <CAMuHMdUE4v+8Dz+eowX5RNJuRGmXcFuYQCe7JQxrFXEQV3xKJA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1886 bytes --]
Hi Geert,
thanks for the review!
> > @@ -581,12 +585,14 @@ static void start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg,
> > pd->pos = -1;
> > pd->sr = 0;
> >
>
> if (pd->atomic_xfer)
> return;
>
> and be done with it?
I like Uli's version a tad better in case we ever add something for both
cases after the following if-block. But I don't care much, we could
change it later.
> > - pd->dma_buf = i2c_get_dma_safe_msg_buf(pd->msg, 8);
> > - if (pd->dma_buf)
> > - sh_mobile_i2c_xfer_dma(pd);
> > -
> > - /* Enable all interrupts to begin with */
> > - iic_wr(pd, ICIC, ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
> > + if (!pd->atomic_xfer) {
> > + pd->dma_buf = i2c_get_dma_safe_msg_buf(pd->msg, 8);
> > + if (pd->dma_buf)
> > + sh_mobile_i2c_xfer_dma(pd);
> > + /* Enable all interrupts to begin with */
> > + iic_wr(pd, ICIC,
> > + ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
> > + }
...
> After removing that check, it starts complaining:
>
> BUG: sleeping function called from invalid context at
> kernel/locking/mutex.c:281
> in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 1, name:
> systemd-shutdow
>
> In general, pm_runtime_get_sync() is not safe to call from atomic
> context.
> For Renesas SoCs, I think both the power and clock domains are safe, as
> the respective drivers don't sleep. The PM core might, though.
Still, that sounds to me like we should protect these calls as in V1?
> > + time_left = time_before_eq(jiffies, j);
> > + while (time_left &&
>
> Who's updating time_left?
Good question :)
Kind regards,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-06-25 7:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-18 15:05 [PATCH v2] i2c: sh_mobile: implement atomic transfers Ulrich Hecht
2020-06-18 16:39 ` Geert Uytterhoeven
2020-06-21 11:39 ` Geert Uytterhoeven
2020-06-25 6:59 ` Wolfram Sang
2020-06-25 7:06 ` Wolfram Sang [this message]
2020-06-25 8:18 ` Geert Uytterhoeven
2020-06-25 8:33 ` Wolfram Sang
2020-06-25 15:16 ` Wolfram Sang
2020-06-30 19:45 ` Wolfram Sang
2020-06-30 19:58 ` Geert Uytterhoeven
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=20200625070636.GB970@ninjato \
--to=wsa@the-dreams.de \
--cc=geert@linux-m68k.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=uli+renesas@fpond.eu \
/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