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


Groups > linux.kernel > #1605756 > unrolled thread

[PATCH RT] tty: serial: st-asc: Make the locking RT aware

Started by<lionel.debieve@st.com>
First post2017-03-21 17:10 +0100
Last post2017-03-22 17:20 +0100
Articles 7 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH RT] tty: serial: st-asc: Make the locking RT aware <lionel.debieve@st.com> - 2017-03-21 17:10 +0100
    Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Steven Rostedt <rostedt@goodmis.org> - 2017-03-21 19:50 +0100
      Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Thomas Gleixner <tglx@linutronix.de> - 2017-03-21 20:00 +0100
        Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Steven Rostedt <rostedt@goodmis.org> - 2017-03-21 21:20 +0100
          Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Lionel DEBIEVE <lionel.debieve@st.com> - 2017-03-22 09:50 +0100
            RE: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Lionel DEBIEVE <lionel.debieve@st.com> - 2017-03-22 17:20 +0100
            Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Steven Rostedt <rostedt@goodmis.org> - 2017-03-22 17:20 +0100

#1605756 — [PATCH RT] tty: serial: st-asc: Make the locking RT aware

From<lionel.debieve@st.com>
Date2017-03-21 17:10 +0100
Subject[PATCH RT] tty: serial: st-asc: Make the locking RT aware
Message-ID<tnuw9-5FD-11@gated-at.bofh.it>
From: Lionel Debieve <lionel.debieve@st.com>

The lock is a sleeping lock and local_irq_save() is not the
standard implementation now. Working for both -RT and non
RT.

Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
---
 drivers/tty/serial/st-asc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index 379e5bd..1815423 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -803,13 +803,12 @@ static void asc_console_write(struct console *co, const char *s, unsigned count)
 	int locked = 1;
 	u32 intenable;
 
-	local_irq_save(flags);
 	if (port->sysrq)
 		locked = 0; /* asc_interrupt has already claimed the lock */
 	else if (oops_in_progress)
-		locked = spin_trylock(&port->lock);
+		locked = spin_trylock_irqsave(&port->lock, flags);
 	else
-		spin_lock(&port->lock);
+		spin_lock_irqsave(&port->lock, flags);
 
 	/*
 	 * Disable interrupts so we don't get the IRQ line bouncing
@@ -827,8 +826,7 @@ static void asc_console_write(struct console *co, const char *s, unsigned count)
 	asc_out(port, ASC_INTEN, intenable);
 
 	if (locked)
-		spin_unlock(&port->lock);
-	local_irq_restore(flags);
+		spin_unlock_irqrestore(&port->lock, flags);
 }
 
 static int asc_console_setup(struct console *co, char *options)
-- 
2.7.4

[toc] | [next] | [standalone]


#1605901

FromSteven Rostedt <rostedt@goodmis.org>
Date2017-03-21 19:50 +0100
Message-ID<tnx10-7bE-5@gated-at.bofh.it>
In reply to#1605756
On Tue, 21 Mar 2017 17:05:40 +0100
<lionel.debieve@st.com> wrote:

> From: Lionel Debieve <lionel.debieve@st.com>
> 
> The lock is a sleeping lock and local_irq_save() is not the
> standard implementation now. Working for both -RT and non
> RT.

If this is for both RT and non RT then the patch subject should just be
[PATCH] and not [PATCH RT] as the latter tells upstream folks not to
bother.

> 
> Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
> ---
>  drivers/tty/serial/st-asc.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
> index 379e5bd..1815423 100644
> --- a/drivers/tty/serial/st-asc.c
> +++ b/drivers/tty/serial/st-asc.c
> @@ -803,13 +803,12 @@ static void asc_console_write(struct console
> *co, const char *s, unsigned count) int locked = 1;
>  	u32 intenable;
>  
> -	local_irq_save(flags);
>  	if (port->sysrq)
>  		locked = 0; /* asc_interrupt has already claimed the
> lock */ else if (oops_in_progress)
> -		locked = spin_trylock(&port->lock);
> +		locked = spin_trylock_irqsave(&port->lock, flags);
>  	else
> -		spin_lock(&port->lock);
> +		spin_lock_irqsave(&port->lock, flags);
>  
>  	/*
>  	 * Disable interrupts so we don't get the IRQ line bouncing

I'm nervous about the above comment, which in full is:

	/*
	 * Disable interrupts so we don't get the IRQ line bouncing
	 * up and down while interrupts are disabled.
	 */

I'm not sure if disabling interrupts helps on an SMP system. This patch
does change what happens when port->sysrq is set. But I'm not sure we
care.

-- Steve



> @@ -827,8 +826,7 @@ static void asc_console_write(struct console *co,
> const char *s, unsigned count) asc_out(port, ASC_INTEN, intenable);
>  
>  	if (locked)
> -		spin_unlock(&port->lock);
> -	local_irq_restore(flags);
> +		spin_unlock_irqrestore(&port->lock, flags);
>  }
>  
>  static int asc_console_setup(struct console *co, char *options)

[toc] | [prev] | [next] | [standalone]


#1605913

FromThomas Gleixner <tglx@linutronix.de>
Date2017-03-21 20:00 +0100
Message-ID<tnxaG-7fa-3@gated-at.bofh.it>
In reply to#1605901
On Tue, 21 Mar 2017, Steven Rostedt wrote:
> >  	/*
> >  	 * Disable interrupts so we don't get the IRQ line bouncing
> 
> I'm nervous about the above comment, which in full is:
> 
> 	/*
> 	 * Disable interrupts so we don't get the IRQ line bouncing
> 	 * up and down while interrupts are disabled.
> 	 */
> 
> I'm not sure if disabling interrupts helps on an SMP system. This patch
> does change what happens when port->sysrq is set. But I'm not sure we
> care.

It disables interrupts at the device level which obviously helps whether on
SMP or not.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1605975

FromSteven Rostedt <rostedt@goodmis.org>
Date2017-03-21 21:20 +0100
Message-ID<tnyq6-8is-37@gated-at.bofh.it>
In reply to#1605913
On Tue, 21 Mar 2017 19:51:47 +0100 (CET)
Thomas Gleixner <tglx@linutronix.de> wrote:

> On Tue, 21 Mar 2017, Steven Rostedt wrote:
> > >  	/*
> > >  	 * Disable interrupts so we don't get the IRQ line
> > > bouncing  
> > 
> > I'm nervous about the above comment, which in full is:
> > 
> > 	/*
> > 	 * Disable interrupts so we don't get the IRQ line bouncing
> > 	 * up and down while interrupts are disabled.
> > 	 */
> > 
> > I'm not sure if disabling interrupts helps on an SMP system. This
> > patch does change what happens when port->sysrq is set. But I'm not
> > sure we care.  
> 
> It disables interrupts at the device level which obviously helps
> whether on SMP or not.
>

OK, so this has nothing to do with the local_irq_save() that is being
removed, which would be fine then.


-- Steve

[toc] | [prev] | [next] | [standalone]


#1606281

FromLionel DEBIEVE <lionel.debieve@st.com>
Date2017-03-22 09:50 +0100
Message-ID<tnK7T-81a-7@gated-at.bofh.it>
In reply to#1605975
Just to agree with Thomas.

Do you want me to resend the patch without RT tag?

BR,
Lionel


On 03/21/2017 09:15 PM, Steven Rostedt wrote:
> On Tue, 21 Mar 2017 19:51:47 +0100 (CET)
> Thomas Gleixner <tglx@linutronix.de> wrote:
>
>> On Tue, 21 Mar 2017, Steven Rostedt wrote:
>>>>   	/*
>>>>   	 * Disable interrupts so we don't get the IRQ line
>>>> bouncing
>>> I'm nervous about the above comment, which in full is:
>>>
>>> 	/*
>>> 	 * Disable interrupts so we don't get the IRQ line bouncing
>>> 	 * up and down while interrupts are disabled.
>>> 	 */
>>>
>>> I'm not sure if disabling interrupts helps on an SMP system. This
>>> patch does change what happens when port->sysrq is set. But I'm not
>>> sure we care.
>> It disables interrupts at the device level which obviously helps
>> whether on SMP or not.
>>
> OK, so this has nothing to do with the local_irq_save() that is being
> removed, which would be fine then.
>
>
> -- Steve
>

[toc] | [prev] | [next] | [standalone]


#1606716

FromLionel DEBIEVE <lionel.debieve@st.com>
Date2017-03-22 17:20 +0100
Message-ID<tnR9o-5eZ-15@gated-at.bofh.it>
In reply to#1606281
OK, resend without.
BR
Lionel

-----Original Message-----
From: Steven Rostedt [mailto:rostedt@goodmis.org] 
Sent: mercredi 22 mars 2017 17:11
To: Lionel DEBIEVE <lionel.debieve@st.com>
Cc: Thomas Gleixner <tglx@linutronix.de>; linux-rt-users@vger.kernel.org; linux-kernel@vger.kernel.org; bigeasy@linutronix.de; Patrice CHOTARD <patrice.chotard@st.com>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Jiri Slaby <jslaby@suse.com>
Subject: Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware

On Wed, 22 Mar 2017 08:43:50 +0000
Lionel DEBIEVE <lionel.debieve@st.com> wrote:

> Just to agree with Thomas.
> 
> Do you want me to resend the patch without RT tag?
>

Yes please. And hopefully it will be picked up in mainline.

-- Steve

[toc] | [prev] | [next] | [standalone]


#1606718

FromSteven Rostedt <rostedt@goodmis.org>
Date2017-03-22 17:20 +0100
Message-ID<tnR9o-5eZ-17@gated-at.bofh.it>
In reply to#1606281
On Wed, 22 Mar 2017 08:43:50 +0000
Lionel DEBIEVE <lionel.debieve@st.com> wrote:

> Just to agree with Thomas.
> 
> Do you want me to resend the patch without RT tag?
>

Yes please. And hopefully it will be picked up in mainline.

-- Steve

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web