From: Weidong Wang <wangweidong1@huawei.com>
To: David Miller <davem@davemloft.net>
Cc: <sony.chacko@qlogic.com>, <Dept-HSGLinuxNICDev@qlogic.com>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<rui.xiang@huawei.com>
Subject: Re: [PATCH net-next] BNX2: fix a Null Pointer for stats_blk
Date: Thu, 24 Sep 2015 10:00:45 +0800 [thread overview]
Message-ID: <5603594D.70408@huawei.com> (raw)
In-Reply-To: <20150923.153117.2291008783799112683.davem@davemloft.net>
On 2015/9/24 6:31, David Miller wrote:
> From: Weidong Wang <wangweidong1@huawei.com>
> Date: Tue, 22 Sep 2015 20:42:40 +0800
>
>> @@ -880,6 +882,7 @@ bnx2_alloc_mem(struct bnx2 *bp)
>> }
>> }
>>
>> + spin_lock(&bp->stats64_lock);
>> bp->stats_blk = status_blk + status_blk_size;
>>
>> bp->stats_blk_mapping = bp->status_blk_mapping + status_blk_size;
>> @@ -894,20 +897,23 @@ bnx2_alloc_mem(struct bnx2 *bp)
>> &bp->ctx_blk_mapping[i],
>> GFP_KERNEL);
>> if (bp->ctx_blk[i] == NULL)
>> - goto alloc_mem_err;
>> + goto free_stats64_lock;
>> }
>> }
>>
>> err = bnx2_alloc_rx_mem(bp);
>> if (err)
>> - goto alloc_mem_err;
>> + goto free_stats64_lock;
>
> You're holding a spinlock while doing GFP_KERNEL allocations.
>
hm, yep, I should move it after the allocations. Like this:
@@ -880,7 +882,9 @@ bnx2_alloc_mem(struct bnx2 *bp)
}
}
+ spin_lock(&bp->stats64_lock);
bp->stats_blk = status_blk + status_blk_size;
+ spin_unlock(&bp->stats64_lock);
the allocations won't use the stats_blk, so I shouldn't hold the
lock while doing allocations.
> Second of all, taking a spinlock in get_stats64() defeats the whole
> intention of making statistics acquisition as fast and as SMP scalable
> as possible.
>
It does affect the intention. Although, the problem exists then makes the
system panic within some case.
Do you have any idea about it?
Best Regards,
Weidong
> .
>
next prev parent reply other threads:[~2015-09-24 2:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-22 12:42 [PATCH net-next] BNX2: fix a Null Pointer for stats_blk Weidong Wang
2015-09-23 22:31 ` David Miller
2015-09-24 2:00 ` Weidong Wang [this message]
2015-09-24 5:34 ` David Miller
2015-09-24 6:53 ` Weidong Wang
2015-09-28 7:01 ` [PATCH net-next v2] " Weidong Wang
2015-09-29 3:15 ` Weidong Wang
2015-09-29 3:18 ` [PATCH net-next v2 RESEND] " Weidong Wang
2015-09-30 4:10 ` David Miller
2015-10-08 10:03 ` [PATCH net-next v3] " Weidong Wang
2015-10-11 12:07 ` David Miller
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=5603594D.70408@huawei.com \
--to=wangweidong1@huawei.com \
--cc=Dept-HSGLinuxNICDev@qlogic.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rui.xiang@huawei.com \
--cc=sony.chacko@qlogic.com \
/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 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).