LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: michael <trimarchi@gandalf.sssup.it>
To: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Remy Bohmer <linux@bohmer.net>,
	fabio@gandalf.sssup.it, Andrew Victor <linux@maxim.org.za>,
	Chip Coldwell <coldwell@redhat.com>,
	Marc Pignat <marc.pignat@hevs.ch>,
	David Brownell <david-b@pacbell.net>,
	linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH -mm v4 6/9] atmel_serial: Split the interrupt handler
Date: Wed, 30 Jan 2008 16:26:27 +0100	[thread overview]
Message-ID: <47A09723.7020000@gandalf.sssup.it> (raw)
In-Reply-To: <20080130133659.55ebd828@dhcp-252-066.norway.atmel.com>

Hi,
> On Wed, 30 Jan 2008 11:29:59 +0100
> michael <trimarchi@gandalf.sssup.it> wrote:
>   
>>> Now, _that_ is strange. I can't see anything that needs protection
>>> across that call; in fact, I think we can lock a lot less than what we
>>> currently do.
>>>
>>>   
>>>       
>> I explain it bad:
>> - with spin_lock the system seems, there is no problem with Valuntary 
>> Preeption and
>> Preemptible Kernel
>> - with full preemption  it runs but the serial line can't be used for 
>> receiving at
>> high bit rate (using lrz)
>>     
>
> ...but if you drop the spinlock across the call to
> tty_flip_buffer_push, you get an Oops?
>
> Could you post the Oops?
>
>   
So this code

/*
* Drop the lock here since it might end up calling
* uart_start(), which takes the lock.
*/
spin_unlock(&port->lock);

tty_flip_buffer_push(port->info->tty);

spin_lock(&port->lock);

Works with:
CONFIG_PREEMPT_RT=y
CONFIG_PREEMPT=y
CONFIG_PREEMPT_SOFTIRQS=y
CONFIG_PREEMPT_HARDIRQS=y
CONFIG_PREEMPT_BKL=y

but crash with:
# CONFIG_PREEMPT_NONE is not set
CONFIG_PREEMPT_VOLUNTARY=y
# CONFIG_PREEMPT_DESKTOP is not set
# CONFIG_PREEMPT_RT is not set
CONFIG_PREEMPT_SOFTIRQS=y
# CONFIG_PREEMPT_HARDIRQS is not set
# CONFIG_PREEMPT_BKL is not set
CONFIG_CLASSIC_RCU=y

Seems to work in the last config if I comment the spin_lock & 
spin_unlock call.
/*
* Drop the lock here since it might end up calling
* uart_start(), which takes the lock.

spin_unlock(&port->lock); */

tty_flip_buffer_push(port->info->tty);

/* spin_lock(&port->lock); */

It is not readable because I can't compile it with debugging information 
(poor memory system)
>>>> Complete Preemption (Real-Time) ok but the serials is just unusable due
>>>> to too many overruns (just using lrz)
>>>>     
>>>>         
>>> Is it worse than before? IIRC Remy mentioned something about
>>> IRQF_NODELAY being the reason for moving all this code to softirq
>>> context in the first place; does the interrupt handler run in hardirq
>>> context?
>>>
>>>   
>>>       
>> In the complete preemption yes.
>>     
>
> Which question did you answer "yes" to? That it's worse than before or
> that the interrupt handler runs in hardirq context (i.e. IRQF_NODELAY)?
>
>   
The interrupt handler run in IRQF_NODELAY context.
>>> I think you're right. Can you change it and see if it helps?
>>>
>>>   
>>>       
>> I just change it because I have corruption on receiving buffer. All
>> my test are done with this fix
>>     
>
> Ok.
>
>   
>>> I guess I didn't test it thoroughly enough with DMA
>>> disabled...slub_debug ought to catch such things, but not until we
>>> receive enough data to actually overflow the buffer.
>>>
>>>   
>>>       
>> I just test it I don't have
>> buffer overflow.
>>     
>
> No, I'd expect your allocation fix to take care of that. Or did you by
> any chance test without the fix and with slub_debug enabled?
>
>   
I just meant that the buffer never fills up to its size.
>> I protect with a spinlock the access to the register when we sending
>> from the tasklet. It is correct?
>>     
>
> I have no idea. Could you post some more specifics about what you
> modified, for example a diff?
>
>   

...
/* The interrupt handler does not take the lock */
spin_lock_irqsave(&port->lock, flags);
atmel_tx_chars(port);
spin_unlock_irqrestore(&port->lock, flags);

spin_lock(&port->lock);
...

The atmel_tx_chars using the serial device registers like the interrupt 
routine
and so I think that it is possible to have interference during send 
operation.

> Most of the tasklet is already protected by the spinlock, so you must
> be careful to avoid any lock recursion.
>
> Haavard
>
>   
Regards Michael

  reply	other threads:[~2008-01-30 15:26 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080129224316.GA23155@gandalf.sssup.it>
2008-01-29 23:12 ` michael
2008-01-30  9:41   ` Haavard Skinnemoen
2008-01-30 10:21     ` Remy Bohmer
2008-01-30 10:34       ` Haavard Skinnemoen
2008-01-30 11:05         ` Remy Bohmer
2008-01-30 12:43           ` Haavard Skinnemoen
2008-01-30 15:25           ` michael
2008-01-30 10:29     ` michael
2008-01-30 12:36       ` Haavard Skinnemoen
2008-01-30 15:26         ` michael [this message]
2008-01-30 15:46           ` Haavard Skinnemoen
2008-01-31  1:53             ` michael
2008-01-31 15:07               ` Haavard Skinnemoen
2008-01-31 19:36                 ` Remy Bohmer
2008-02-04 12:39                   ` Haavard Skinnemoen
2008-02-04 19:44                     ` Remy Bohmer
2008-02-06 12:19                       ` michael
2008-02-06 19:41                         ` Remy Bohmer
2008-02-13 11:07                           ` michael
2008-02-13 20:13                             ` Remy Bohmer
2008-02-14  7:30                               ` michael
2008-02-04 19:01                 ` michael
2008-02-04 20:25                   ` Haavard Skinnemoen
2008-02-05 12:29                     ` michael
2008-02-06 12:30                       ` Haavard Skinnemoen
2008-02-06 13:41                         ` michael
2008-02-06 15:22                           ` Haavard Skinnemoen
2008-01-24 12:41 [PATCH -mm v4 0/9] atmel_serial cleanups and improvements Haavard Skinnemoen
2008-01-24 12:41 ` [PATCH -mm v4 1/9] MAINTAINERS: Add myself as maintainer of the atmel_serial driver Haavard Skinnemoen
2008-01-24 12:41   ` [PATCH -mm v4 2/9] atmel_serial: Clean up the code Haavard Skinnemoen
2008-01-24 12:41     ` [PATCH -mm v4 3/9] atmel_serial: Use cpu_relax() when busy-waiting Haavard Skinnemoen
2008-01-24 12:41       ` [PATCH -mm v4 4/9] atmel_serial: Use existing console options only if BRG is running Haavard Skinnemoen
2008-01-24 12:41         ` [PATCH -mm v4 5/9] atmel_serial: Fix bugs in probe() error path and remove() Haavard Skinnemoen
2008-01-24 12:41           ` [PATCH -mm v4 6/9] atmel_serial: Split the interrupt handler Haavard Skinnemoen

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=47A09723.7020000@gandalf.sssup.it \
    --to=trimarchi@gandalf.sssup.it \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=coldwell@redhat.com \
    --cc=david-b@pacbell.net \
    --cc=fabio@gandalf.sssup.it \
    --cc=hskinnemoen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@bohmer.net \
    --cc=linux@maxim.org.za \
    --cc=marc.pignat@hevs.ch \
    --subject='Re: [PATCH -mm v4 6/9] atmel_serial: Split the interrupt handler' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).