From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Julian Calaby <julian.calaby@gmail.com>,
Sowmini Varadhan <sowmini.varadhan@oracle.com>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
sparclinux <sparclinux@vger.kernel.org>
Subject: Re: [PATCHv4 3/4] sparc64: Avoid irqsave/restore on vio.lock if in_softirq()
Date: Tue, 21 Oct 2014 23:56:01 +0000 [thread overview]
Message-ID: <5446F291.1030400@oracle.com> (raw)
In-Reply-To: <CAGRGNgXvKJBhOE1z3=_gZkE=X94HnoAvTN6Zv5G1h8JuFfS8Ng@mail.gmail.com>
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@oracle.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@oracle.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,
>
WARNING: multiple messages have this Message-ID (diff)
From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Julian Calaby <julian.calaby@gmail.com>,
Sowmini Varadhan <sowmini.varadhan@oracle.com>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
sparclinux <sparclinux@vger.kernel.org>
Subject: Re: [PATCHv4 3/4] sparc64: Avoid irqsave/restore on vio.lock if in_softirq()
Date: Tue, 21 Oct 2014 18:56:01 -0500 [thread overview]
Message-ID: <5446F291.1030400@oracle.com> (raw)
In-Reply-To: <CAGRGNgXvKJBhOE1z3=_gZkE=X94HnoAvTN6Zv5G1h8JuFfS8Ng@mail.gmail.com>
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@oracle.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@oracle.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,
>
next prev parent reply other threads:[~2014-10-21 23:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 14:16 [PATCHv4 3/4] sparc64: Avoid irqsave/restore on vio.lock if in_softirq() Sowmini Varadhan
2014-10-21 14:16 ` Sowmini Varadhan
2014-10-21 22:35 ` Julian Calaby
2014-10-21 22:35 ` Julian Calaby
2014-10-21 22:39 ` Sowmini Varadhan
2014-10-21 22:39 ` Sowmini Varadhan
2014-10-21 22:42 ` Julian Calaby
2014-10-21 22:42 ` Julian Calaby
2014-10-21 23:56 ` Dave Kleikamp [this message]
2014-10-21 23:56 ` Dave Kleikamp
2014-10-22 0:16 ` Sowmini Varadhan
2014-10-22 0:16 ` Sowmini Varadhan
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=5446F291.1030400@oracle.com \
--to=dave.kleikamp@oracle.com \
--cc=davem@davemloft.net \
--cc=julian.calaby@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sowmini.varadhan@oracle.com \
--cc=sparclinux@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.