All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Romain Naour <romain.naour@smile.fr>
Cc: linux-omap@vger.kernel.org
Subject: Re: AM5749: tty serial 8250 omap driver crash
Date: Thu, 5 May 2022 07:33:31 +0300	[thread overview]
Message-ID: <YnNTm35rqxSVqnt4@atomide.com> (raw)
In-Reply-To: <fc11fc68-d1f3-8e47-c5ff-c8ba10e8a7b3@smile.fr>

* Romain Naour <romain.naour@smile.fr> [220504 12:38]:
> Hello,
> 
> Le 03/05/2022 à 12:05, Tony Lindgren a écrit :
> > Hi,
> > 
> > * Romain Naour <romain.naour@smile.fr> [220402 10:13]:
> >> Le 17/02/2022 à 13:58, Tony Lindgren a écrit :
> >>> Yes but note that 8250_omap autosuspend does not do anything unless the
> >>> timeouts are manually enabled by the userspace. They are initialized to -1
> >>> during probe.
> >>
> >> Actually it's not initialized to -1 on my board, it's initialized to 0. See
> >> commit [1].
> > 
> > Oh you're right. The default should be initialized to 2000ms though, not 0.
> 
> How do you know it should use 2000ms by default?

Oh I recalled we had such default value.. Seems I was wrong. Sorry for the
wrong information.

> >> I'm starting to think that is an issue when the 8250_omap driver is used with
> >> another driver like the gnss serial driver (using a serdev driver).
> > 
> > Oh yes you are right. We do this conditionally now.
> > 
> >> Since the commit [1] there is no autosuspend delay at all, I would suggest to
> >> add a default autosuspend delay value. I tested with 200ms based on another example.
> >>
> >> diff --git a/drivers/tty/serial/8250/8250_omap.c
> >> b/drivers/tty/serial/8250/8250_omap.c
> >> index ec7304d57f5f..8ba830bd493a 100644
> >> --- a/drivers/tty/serial/8250/8250_omap.c
> >> +++ b/drivers/tty/serial/8250/8250_omap.c
> >> @@ -108,6 +108,9 @@
> >>  /* RX FIFO occupancy indicator */
> >>  #define UART_OMAP_RX_LVL               0x19
> >>
> >> +/* Runtime PM autosuspend timeout: 0ms may trigger wakeup issues */
> >> +#define UART_AUTOSUSPEND_TIMEOUT               200
> >> +
> >>  struct omap8250_priv {
> >>         int line;
> >>         u8 habit;
> >> @@ -1409,6 +1412,8 @@ static int omap8250_probe(struct platform_device *pdev)
> >>          */
> >>         if (!of_get_available_child_count(pdev->dev.of_node))
> >>                 pm_runtime_set_autosuspend_delay(&pdev->dev, -1);
> >> +       else
> >> +               pm_runtime_set_autosuspend_delay(&pdev->dev,
> >> UART_AUTOSUSPEND_TIMEOUT);
> >>
> >>         pm_runtime_irq_safe(&pdev->dev);
> > 
> > Hmm the value should be set to the default 2000ms already. If it's not, then we
> > need to find out what is setting it to 0.
> 
> I don't see where pm_runtime_set_autosuspend_delay() would be called to set the
> autosuspend delay to 0.
> 
> 2000ms seems to be related to USB_AUTOSUSPEND_DELAY and only relevant for the
> usb stack.

OK maybe that's where I got the idea.

> Here nothing seems calling pm_runtime_set_autosuspend_delay(), so the
> autosuspend delay is still using 0 as default value. I'm not sure that the
> serdev driver really handle the autosuspend delay.

OK. Is your serdev driver not configuring the autosuspend value either?

> Other driver like the omap-sham set the autosuspend delay default value just
> after pm_runtime_use_autosuspend(&pdev->dev):
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/crypto/omap-sham.c?h=linux-5.10.y#n2126
> 
> > 
> > For adjusting the timeout, you may want to check the child serdev driver
> > runtime PM autosuspend timeout, adjusting that seems a better place to
> > prevent the 8250 idle. Not sure how we should handle the 8250 specific
> > timeout though based on the serdev driver requirements.
> 
> For now, I'm not sure I need to adjust the timeout.

Well what is the child serdev driver setting the autosuspend timeout to?

That should prevent the parent 8250 device from suspending. If the serdev
driver is not using autosuspend, that should prevent the parent 8250 device
from suspending also until the serdev driver decides to runtime suspend.

I guess I'm not following why the 8250 autosuspend triggers with a serdev
unless your serdev driver runtime suspends.. Or is there maybe some issue
where runtime suspending 8250 still causes register access after that
somehow?

Regards,

Tony


> >> [1]
> >> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=627a545c6bb0c7de09208e6546f5111290477261
> 

      reply	other threads:[~2022-05-05  4:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04 13:39 AM5749: tty serial 8250 omap driver crash Romain Naour
2022-02-07  8:04 ` Tony Lindgren
2022-02-09  9:13   ` Romain Naour
2022-02-10 12:05     ` Tony Lindgren
2022-02-11 10:11       ` Romain Naour
2022-02-14  7:43         ` Tony Lindgren
2022-02-14 13:08           ` Tony Lindgren
2022-02-16  9:04             ` Romain Naour
2022-02-16 11:46               ` Tony Lindgren
2022-02-16 15:51                 ` Romain Naour
2022-02-17  8:08                   ` Tony Lindgren
2022-02-17  9:09                     ` Romain Naour
2022-02-17 12:58                       ` Tony Lindgren
2022-04-02 10:15                         ` Romain Naour
2022-05-03 10:05                           ` Tony Lindgren
2022-05-04 12:42                             ` Romain Naour
2022-05-05  4:33                               ` Tony Lindgren [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=YnNTm35rqxSVqnt4@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=romain.naour@smile.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.