netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ziyang Xuan (William)" <william.xuanziyang@huawei.com>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: <chandrashekar.devegowda@intel.com>, <linuxwwan@intel.com>,
	<chiranjeevi.rapolu@linux.intel.com>, <haijun.liu@mediatek.com>,
	<m.chetan.kumar@linux.intel.com>,
	<ricardo.martinez@linux.intel.com>, <ryazanov.s.a@gmail.com>,
	<johannes@sipsolutions.net>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v2] net: wwan: t7xx: fix GFP_KERNEL usage in spin_lock context
Date: Wed, 18 May 2022 12:39:21 +0800	[thread overview]
Message-ID: <ff9866ff-7149-e9d2-80e8-777482ab6711@huawei.com> (raw)
In-Reply-To: <CAMZdPi-ibG9O9C2m3qVeEAbO6=TLA-8jZzX9Gbm2MQOwT_1vPg@mail.gmail.com>

> Hi Ziyang,
> 
> On Tue, 17 May 2022 at 08:30, Ziyang Xuan <william.xuanziyang@huawei.com> wrote:
>>
>> t7xx_cldma_clear_rxq() call t7xx_cldma_alloc_and_map_skb() in spin_lock
>> context, But __dev_alloc_skb() in t7xx_cldma_alloc_and_map_skb() uses
>> GFP_KERNEL, that will introduce scheduling factor in spin_lock context.
>>
>> Because t7xx_cldma_clear_rxq() is called after stopping CLDMA, so we can
>> remove the spin_lock from t7xx_cldma_clear_rxq().
>>
>> Fixes: 39d439047f1d ("net: wwan: t7xx: Add control DMA interface")
>> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
>> ---
> 
> You should normally indicate what changed in this v2.
> 
>>  drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> index 46066dcd2607..7493285a9606 100644
>> --- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> +++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> @@ -782,10 +782,12 @@ static int t7xx_cldma_clear_rxq(struct cldma_ctrl *md_ctrl, int qnum)
>>         struct cldma_queue *rxq = &md_ctrl->rxq[qnum];
>>         struct cldma_request *req;
>>         struct cldma_gpd *gpd;
>> -       unsigned long flags;
>>         int ret = 0;
>>
>> -       spin_lock_irqsave(&rxq->ring_lock, flags);
>> +       /* CLDMA has been stopped. There is not any CLDMA IRQ, holding
>> +        * ring_lock is not needed.
> 
> If it makes sense to explain why we don't need locking, the next
> sentence is not needed:

I want to remind the possible developer if he or she want to add spin_lock
here again in future, he or she should check whether there is a scheduling
factor or not here firstly.

> 
> 
>>  Thus we can use functions that may
>> +        * introduce scheduling.
>> +        */
>>         t7xx_cldma_q_reset(rxq);
>>         list_for_each_entry(req, &rxq->tr_ring->gpd_ring, entry) {
>>                 gpd = req->gpd;
>> @@ -808,7 +810,6 @@ static int t7xx_cldma_clear_rxq(struct cldma_ctrl *md_ctrl, int qnum)
>>
>>                 t7xx_cldma_gpd_set_data_ptr(req->gpd, req->mapped_buff);
>>         }
>> -       spin_unlock_irqrestore(&rxq->ring_lock, flags);
>>
>>         return ret;
>>  }
>> --
>> 2.25.1
>>
> .
> 

  reply	other threads:[~2022-05-18  4:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  6:48 [PATCH net-next v2] net: wwan: t7xx: fix GFP_KERNEL usage in spin_lock context Ziyang Xuan
2022-05-17  8:35 ` Sergey Ryazanov
2022-05-17  8:50 ` Loic Poulain
2022-05-18  4:39   ` Ziyang Xuan (William) [this message]
2022-05-18 18:09 ` Ilpo Järvinen
2022-05-19  4:20   ` Ziyang Xuan (William)

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=ff9866ff-7149-e9d2-80e8-777482ab6711@huawei.com \
    --to=william.xuanziyang@huawei.com \
    --cc=chandrashekar.devegowda@intel.com \
    --cc=chiranjeevi.rapolu@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=haijun.liu@mediatek.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linuxwwan@intel.com \
    --cc=loic.poulain@linaro.org \
    --cc=m.chetan.kumar@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ricardo.martinez@linux.intel.com \
    --cc=ryazanov.s.a@gmail.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).