mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
To: Stefan Agner <stefan@agner.ch>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>,
	Wei Yongjun <weiyongjun1@huawei.com>,
	Aaron Brice <aaron.brice@datasoft.com>,
	Nicolae Rosia <nicolae_rosia@mentor.com>,
	linux-serial@vger.kernel.org, Chris Healy <cphealy@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: serial: fsl_lpuart: fix del_timer_sync() vs timer routine deadlock
Date: Sat, 3 Dec 2016 00:28:27 +0300	[thread overview]
Message-ID: <d858c7d2-c96c-f0dd-c5eb-bedd9187f8d8@cogentembedded.com> (raw)
In-Reply-To: <77e2726b8b84c55f9109ff18dfcfbbdf@agner.ch>

>> Problem found via lockdep:
>>
>> - lpuart_set_termios() calls del_timer_sync(&sport->lpuart_timer) while
>>   holding sport->port.lock
>>
>> - sport->lpuart_timer routine is lpuart_timer_func() that calls
>>   lpuart_copy_rx_to_tty() that acquires same lock.
>>
>> To fix, move Rx DMA stopping out of lock, as it already is in other places
>> in the same file.
>>
>> While at it, also make Rx DMA start/stop code to look the same is in
>> other places in the same file.
> 
> Yeah I saw that too, never really came around to look closer into it.
> 
> Thanks for looking into it.
> 
> You removed the check whether there was an old configuration, I think
> the idea of that was that we only resize DMA if it was configured
> differently before...

Per my code reading, checking for sport->lpuart_dma_rx_use should be
enough, this flag will be set only if DMA was previously enabled,

>> +	if (sport->lpuart_dma_rx_use) {
>> +		if (!lpuart_start_rx_dma(sport)) {
>>  			sport->lpuart_dma_rx_use = true;
> 
> No need to set to true here, it is guaranteed to be true at this point.

I've seen this...  However elsewhere in this file (namely in
lpuart_resume(), in very similar situation, code is exactly the same,
i.e. it sets sport->lpuart_dma_rx_use in both clauses. I thought it
could be for a reason (i.e. for readability).

Nikita

  reply	other threads:[~2016-12-02 21:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 10:28 Nikita Yushchenko
2016-12-02 18:05 ` Stefan Agner
2016-12-02 21:28   ` Nikita Yushchenko [this message]
2016-12-03  7:06     ` Bhuvanchandra DV
2016-12-03  8:55       ` Nikita Yushchenko
2016-12-03 10:06         ` Bhuvanchandra DV

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=d858c7d2-c96c-f0dd-c5eb-bedd9187f8d8@cogentembedded.com \
    --to=nikita.yoush@cogentembedded.com \
    --cc=aaron.brice@datasoft.com \
    --cc=bhuvanchandra.dv@toradex.com \
    --cc=cphealy@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=nicolae_rosia@mentor.com \
    --cc=stefan@agner.ch \
    --cc=weiyongjun1@huawei.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

all inboxes | Powered by JetHome®