[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5446F291.1030400@oracle.com>
Date: Tue, 21 Oct 2014 18:56:01 -0500
From: Dave Kleikamp <dave.kleikamp@...cle.com>
To: Julian Calaby <julian.calaby@...il.com>,
Sowmini Varadhan <sowmini.varadhan@...cle.com>
CC: "David S. Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
sparclinux <sparclinux@...r.kernel.org>
Subject: Re: [PATCHv4 3/4] sparc64: Avoid irqsave/restore on vio.lock if in_softirq()
On 10/21/2014 05:35 PM, Julian Calaby wrote:
> Hi Sowmini,
>
> On Wed, Oct 22, 2014 at 1:16 AM, Sowmini Varadhan
> <sowmini.varadhan@...cle.com> wrote:
>> For NAPIfied drivers , there is no need to
>> synchronize by doing irqsave/restore on vio.lock in the I/O
>> path.
>>
>> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@...cle.com>
>> ---
>> arch/sparc/kernel/viohs.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/sparc/kernel/viohs.c b/arch/sparc/kernel/viohs.c
>> index 7ef081a..d731586 100644
>> --- a/arch/sparc/kernel/viohs.c
>> +++ b/arch/sparc/kernel/viohs.c
>> @@ -747,10 +747,11 @@ EXPORT_SYMBOL(vio_ldc_free);
>>
>> void vio_port_up(struct vio_driver_state *vio)
>> {
>> - unsigned long flags;
>> + unsigned long flags = 0;
>
> Is gcc not smart enough to know that this variable isn't used before
> it's set? (I assume it isn't used elsewhere in this function)
It probably assumes in_softirq() might evaluate differently in the each
case.
>
>> int err, state;
>>
>> - spin_lock_irqsave(&vio->lock, flags);
>> + if (!in_softirq())
>> + spin_lock_irqsave(&vio->lock, flags);
>>
>> state = ldc_state(vio->lp);
>>
>> @@ -777,7 +778,8 @@ void vio_port_up(struct vio_driver_state *vio)
>> mod_timer(&vio->timer, expires);
>> }
>>
>> - spin_unlock_irqrestore(&vio->lock, flags);
>> + if (!in_softirq())
>> + spin_unlock_irqrestore(&vio->lock, flags);
>> }
>> EXPORT_SYMBOL(vio_port_up);
>
> Thanks,
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists