Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1337966

Re: [PATCH] serial: samsung: fix the inconsistency in spinlock

From Anand Moon <linux.amoon@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] serial: samsung: fix the inconsistency in spinlock
Date 2016-02-19 09:30 +0100
Message-ID <r3OBQ-2dz-9@gated-at.bofh.it> (permalink)
References (1 earlier) <r3ASe-CA-7@gated-at.bofh.it> <r3Chk-1Pm-7@gated-at.bofh.it> <r3MA1-Re-1@gated-at.bofh.it> <r3NcK-17e-5@gated-at.bofh.it> <r3NZ8-1H6-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Krzysztof,

On 19 February 2016 at 13:14, Krzysztof Kozlowski
<k.kozlowski@samsung.com> wrote:
> On 19.02.2016 15:51, Anand Moon wrote:
>> Hi Krzysztof,
>>
>> On 19 February 2016 at 11:39, Krzysztof Kozlowski
>> <k.kozlowski@samsung.com> wrote:
>>> 2016-02-19 4:14 GMT+09:00 Anand Moon <linux.amoon@gmail.com>:
>>>> Hi Peter,
>>>>
>>>> On 18 February 2016 at 23:18, Peter Hurley <peter@hurleysoftware.com> wrote:
>>>>> Hi Anand,
>>>>>
>>>>> On 02/18/2016 09:40 AM, Anand Moon wrote:
>>>>>> From: Anand Moon <linux.amoon@gmail.com>
>>>>>>
>>>>>> changes fix the correct order of the spin_lock_irqrestore/save.
>>>>>>
>>>>>> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
>>>>>> ---
>>>>>>  drivers/tty/serial/samsung.c | 4 ++--
>>>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
>>>>>> index d72cd73..96fe14d 100644
>>>>>> --- a/drivers/tty/serial/samsung.c
>>>>>> +++ b/drivers/tty/serial/samsung.c
>>>>>> @@ -759,9 +759,9 @@ static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
>>>>>>       }
>>>>>>
>>>>>>       if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) {
>>>>>> -             spin_unlock(&port->lock);
>>>>>> +             spin_unlock_irqrestore(&port->lock, flags);
>>>>>>               uart_write_wakeup(port);
>>>>>> -             spin_lock(&port->lock);
>>>>>> +             spin_lock_irqsave(&port->lock, flags);
>>>>>
>>>>> This driver shouldn't be dropping the spin lock at for write wakeup.
>>>>> If this is causing lock-ups in a line discipline, the line discipline
>>>>> needs fixed.
>>>>>
>>>>
>>>> Thanks for pointing out.
>>>> Their is no lock up, just the inconstancy of the spin_lock.
>>>> Then I will resend this patch dropping the spin_unlock/spin_lock
>>>> around uart_write_wakeup.
>>>> Is that ok with you.
>>>
>>> Anand, before doing that, can you check Peter's second sentence? I
>>> mean the "If this is causing lock-ups in a line discipline, the line
>>> discipline needs fixed.".
>>> Don't drop the spin-locks "just because". I would be happy to see more
>>> detailed explanation in changelog.
>>>
>>> Best regards,
>>> Krzysztof
>>
>> Yes I understood the meaning of the sentence. Already the
>> s3c24xx_serial_tx_chars function.
>> holds the lock port->lock for safe IRQ execution.
>
> I am sorry but I don't get your explanation. I mentioned Peter's
> thoughts about lockups after adding locking over uart_write(). However
> you are referring to s3c24xx_serial_tx_chars() holding the spin lock...
> I am missing the point...
>
> Best regards,
> Krzysztof
>

I should be sorry I could not explain you in technical terms.
Interrupt routine already hold the port->lock

s3c24xx_serial_tx_chars
     \
     spin_lock_irqsave(&port->lock, flags);
     \...
    spin_unlock(&port->lock);
     uart_write_wakeup(port);
     spin_lock(&port->lock);
     \
     spin_unlock_irqrestore(&port->lock, flags);

In my next patch I have tried to remove the spin_unlock/spin_lock over
uart_write_wakeup(port);

Best Regards.
-Anand Moon

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] serial: samsung: fix the inconsistency in spinlock Anand Moon <linux.amoon@gmail.com> - 2016-02-18 18:50 +0100
  Re: [PATCH] serial: samsung: fix the inconsistency in spinlock Peter Hurley <peter@hurleysoftware.com> - 2016-02-18 18:50 +0100
    Re: [PATCH] serial: samsung: fix the inconsistency in spinlock Anand Moon <linux.amoon@gmail.com> - 2016-02-18 20:20 +0100
      Re: [PATCH] serial: samsung: fix the inconsistency in spinlock Peter Hurley <peter@hurleysoftware.com> - 2016-02-18 21:10 +0100
      Re: [PATCH] serial: samsung: fix the inconsistency in spinlock Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-02-19 07:20 +0100
        Re: [PATCH] serial: samsung: fix the inconsistency in spinlock Anand Moon <linux.amoon@gmail.com> - 2016-02-19 08:00 +0100
          Re: [PATCH] serial: samsung: fix the inconsistency in spinlock Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-02-19 08:50 +0100
            Re: [PATCH] serial: samsung: fix the inconsistency in spinlock Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-02-19 09:30 +0100
              Re: [PATCH] serial: samsung: fix the inconsistency in spinlock Anand Moon <linux.amoon@gmail.com> - 2016-02-19 09:40 +0100
                Re: [PATCH] serial: samsung: fix the inconsistency in spinlock Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-02-21 02:40 +0100
            Re: [PATCH] serial: samsung: fix the inconsistency in spinlock Anand Moon <linux.amoon@gmail.com> - 2016-02-19 09:30 +0100

csiph-web