All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-arm-kernel@lists.infradead.org>, <netdev@vger.kernel.org>,
	<haijun.liu@mediatek.com>, <chandrashekar.devegowda@intel.com>,
	<ricardo.martinez@linux.intel.com>, <davem@davemloft.net>,
	<kuba@kernel.org>
Subject: Re: [PATCH -next] net: wwan: t7xx: use GFP_ATOMIC under spin lock in t7xx_cldma_gpd_set_next_ptr()
Date: Thu, 19 May 2022 09:52:30 +0800	[thread overview]
Message-ID: <53b384f6-5507-b767-f64a-574cfd511e13@huawei.com> (raw)
In-Reply-To: <CAMZdPi9uvh4E70-AXpGrdzkgh35mfWQbhL8Kxw_o9_DsfL2gbw@mail.gmail.com>

Hi,

On 2022/5/18 17:13, Loic Poulain wrote:
> Hi Yang,
>
> On Wed, 18 May 2022 at 10:57, Yang Yingliang <yangyingliang@huawei.com> wrote:
>> Sometimes t7xx_cldma_gpd_set_next_ptr() is called under spin lock,
>> so add a parameter in t7xx_cldma_gpd_set_next_ptr() to make if it
>> use GFP_ATOMIC flag.
>>
>> Fixes: 39d439047f1d ("net: wwan: t7xx: Add control DMA interface")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>>   drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 13 ++++++++-----
>>   1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> index 0c52801ed0de..1fa9bb763831 100644
>> --- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> +++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> @@ -91,9 +91,12 @@ static void t7xx_cldma_gpd_set_next_ptr(struct cldma_gpd *gpd, dma_addr_t next_p
>>   }
>>
>>   static int t7xx_cldma_alloc_and_map_skb(struct cldma_ctrl *md_ctrl, struct cldma_request *req,
>> -                                       size_t size)
>> +                                       size_t size, bool is_atomic)
> Would be simpler to directly pass the gfp_mask as a parameter.
Yes, I will send a v2 with this change later.

Thanks,
Yang
>
>
>>   {
>> -       req->skb = __dev_alloc_skb(size, GFP_KERNEL);
>> +       if (is_atomic)
>> +               req->skb = __dev_alloc_skb(size, GFP_ATOMIC);
>> +       else
>> +               req->skb = __dev_alloc_skb(size, GFP_KERNEL);
>>          if (!req->skb)
>>                  return -ENOMEM;
>>
>> @@ -174,7 +177,7 @@ static int t7xx_cldma_gpd_rx_from_q(struct cldma_queue *queue, int budget, bool
>>                  spin_unlock_irqrestore(&queue->ring_lock, flags);
>>                  req = queue->rx_refill;
>>
>> -               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, queue->tr_ring->pkt_size);
>> +               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, queue->tr_ring->pkt_size, false);
>>                  if (ret)
>>                          return ret;
>>
>> @@ -402,7 +405,7 @@ static struct cldma_request *t7xx_alloc_rx_request(struct cldma_ctrl *md_ctrl, s
>>          if (!req->gpd)
>>                  goto err_free_req;
>>
>> -       val = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, pkt_size);
>> +       val = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, pkt_size, false);
>>          if (val)
>>                  goto err_free_pool;
>>
>> @@ -801,7 +804,7 @@ static int t7xx_cldma_clear_rxq(struct cldma_ctrl *md_ctrl, int qnum)
>>                  if (req->skb)
>>                          continue;
>>
>> -               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, rxq->tr_ring->pkt_size);
>> +               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, rxq->tr_ring->pkt_size, true);
>>                  if (ret)
>>                          break;
>>
>> --
>> 2.25.1
>>
> .

WARNING: multiple messages have this Message-ID (diff)
From: Yang Yingliang <yangyingliang@huawei.com>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-arm-kernel@lists.infradead.org>, <netdev@vger.kernel.org>,
	<haijun.liu@mediatek.com>, <chandrashekar.devegowda@intel.com>,
	<ricardo.martinez@linux.intel.com>, <davem@davemloft.net>,
	<kuba@kernel.org>
Subject: Re: [PATCH -next] net: wwan: t7xx: use GFP_ATOMIC under spin lock in t7xx_cldma_gpd_set_next_ptr()
Date: Thu, 19 May 2022 09:52:30 +0800	[thread overview]
Message-ID: <53b384f6-5507-b767-f64a-574cfd511e13@huawei.com> (raw)
In-Reply-To: <CAMZdPi9uvh4E70-AXpGrdzkgh35mfWQbhL8Kxw_o9_DsfL2gbw@mail.gmail.com>

Hi,

On 2022/5/18 17:13, Loic Poulain wrote:
> Hi Yang,
>
> On Wed, 18 May 2022 at 10:57, Yang Yingliang <yangyingliang@huawei.com> wrote:
>> Sometimes t7xx_cldma_gpd_set_next_ptr() is called under spin lock,
>> so add a parameter in t7xx_cldma_gpd_set_next_ptr() to make if it
>> use GFP_ATOMIC flag.
>>
>> Fixes: 39d439047f1d ("net: wwan: t7xx: Add control DMA interface")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>>   drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 13 ++++++++-----
>>   1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> index 0c52801ed0de..1fa9bb763831 100644
>> --- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> +++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> @@ -91,9 +91,12 @@ static void t7xx_cldma_gpd_set_next_ptr(struct cldma_gpd *gpd, dma_addr_t next_p
>>   }
>>
>>   static int t7xx_cldma_alloc_and_map_skb(struct cldma_ctrl *md_ctrl, struct cldma_request *req,
>> -                                       size_t size)
>> +                                       size_t size, bool is_atomic)
> Would be simpler to directly pass the gfp_mask as a parameter.
Yes, I will send a v2 with this change later.

Thanks,
Yang
>
>
>>   {
>> -       req->skb = __dev_alloc_skb(size, GFP_KERNEL);
>> +       if (is_atomic)
>> +               req->skb = __dev_alloc_skb(size, GFP_ATOMIC);
>> +       else
>> +               req->skb = __dev_alloc_skb(size, GFP_KERNEL);
>>          if (!req->skb)
>>                  return -ENOMEM;
>>
>> @@ -174,7 +177,7 @@ static int t7xx_cldma_gpd_rx_from_q(struct cldma_queue *queue, int budget, bool
>>                  spin_unlock_irqrestore(&queue->ring_lock, flags);
>>                  req = queue->rx_refill;
>>
>> -               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, queue->tr_ring->pkt_size);
>> +               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, queue->tr_ring->pkt_size, false);
>>                  if (ret)
>>                          return ret;
>>
>> @@ -402,7 +405,7 @@ static struct cldma_request *t7xx_alloc_rx_request(struct cldma_ctrl *md_ctrl, s
>>          if (!req->gpd)
>>                  goto err_free_req;
>>
>> -       val = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, pkt_size);
>> +       val = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, pkt_size, false);
>>          if (val)
>>                  goto err_free_pool;
>>
>> @@ -801,7 +804,7 @@ static int t7xx_cldma_clear_rxq(struct cldma_ctrl *md_ctrl, int qnum)
>>                  if (req->skb)
>>                          continue;
>>
>> -               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, rxq->tr_ring->pkt_size);
>> +               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, rxq->tr_ring->pkt_size, true);
>>                  if (ret)
>>                          break;
>>
>> --
>> 2.25.1
>>
> .

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Yang Yingliang <yangyingliang@huawei.com>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-arm-kernel@lists.infradead.org>, <netdev@vger.kernel.org>,
	<haijun.liu@mediatek.com>, <chandrashekar.devegowda@intel.com>,
	<ricardo.martinez@linux.intel.com>, <davem@davemloft.net>,
	<kuba@kernel.org>
Subject: Re: [PATCH -next] net: wwan: t7xx: use GFP_ATOMIC under spin lock in t7xx_cldma_gpd_set_next_ptr()
Date: Thu, 19 May 2022 09:52:30 +0800	[thread overview]
Message-ID: <53b384f6-5507-b767-f64a-574cfd511e13@huawei.com> (raw)
In-Reply-To: <CAMZdPi9uvh4E70-AXpGrdzkgh35mfWQbhL8Kxw_o9_DsfL2gbw@mail.gmail.com>

Hi,

On 2022/5/18 17:13, Loic Poulain wrote:
> Hi Yang,
>
> On Wed, 18 May 2022 at 10:57, Yang Yingliang <yangyingliang@huawei.com> wrote:
>> Sometimes t7xx_cldma_gpd_set_next_ptr() is called under spin lock,
>> so add a parameter in t7xx_cldma_gpd_set_next_ptr() to make if it
>> use GFP_ATOMIC flag.
>>
>> Fixes: 39d439047f1d ("net: wwan: t7xx: Add control DMA interface")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>>   drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 13 ++++++++-----
>>   1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> index 0c52801ed0de..1fa9bb763831 100644
>> --- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> +++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
>> @@ -91,9 +91,12 @@ static void t7xx_cldma_gpd_set_next_ptr(struct cldma_gpd *gpd, dma_addr_t next_p
>>   }
>>
>>   static int t7xx_cldma_alloc_and_map_skb(struct cldma_ctrl *md_ctrl, struct cldma_request *req,
>> -                                       size_t size)
>> +                                       size_t size, bool is_atomic)
> Would be simpler to directly pass the gfp_mask as a parameter.
Yes, I will send a v2 with this change later.

Thanks,
Yang
>
>
>>   {
>> -       req->skb = __dev_alloc_skb(size, GFP_KERNEL);
>> +       if (is_atomic)
>> +               req->skb = __dev_alloc_skb(size, GFP_ATOMIC);
>> +       else
>> +               req->skb = __dev_alloc_skb(size, GFP_KERNEL);
>>          if (!req->skb)
>>                  return -ENOMEM;
>>
>> @@ -174,7 +177,7 @@ static int t7xx_cldma_gpd_rx_from_q(struct cldma_queue *queue, int budget, bool
>>                  spin_unlock_irqrestore(&queue->ring_lock, flags);
>>                  req = queue->rx_refill;
>>
>> -               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, queue->tr_ring->pkt_size);
>> +               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, queue->tr_ring->pkt_size, false);
>>                  if (ret)
>>                          return ret;
>>
>> @@ -402,7 +405,7 @@ static struct cldma_request *t7xx_alloc_rx_request(struct cldma_ctrl *md_ctrl, s
>>          if (!req->gpd)
>>                  goto err_free_req;
>>
>> -       val = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, pkt_size);
>> +       val = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, pkt_size, false);
>>          if (val)
>>                  goto err_free_pool;
>>
>> @@ -801,7 +804,7 @@ static int t7xx_cldma_clear_rxq(struct cldma_ctrl *md_ctrl, int qnum)
>>                  if (req->skb)
>>                          continue;
>>
>> -               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, rxq->tr_ring->pkt_size);
>> +               ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, rxq->tr_ring->pkt_size, true);
>>                  if (ret)
>>                          break;
>>
>> --
>> 2.25.1
>>
> .

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-05-19  1:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  9:07 [PATCH -next] net: wwan: t7xx: use GFP_ATOMIC under spin lock in t7xx_cldma_gpd_set_next_ptr() Yang Yingliang
2022-05-18  9:07 ` Yang Yingliang
2022-05-18  9:07 ` Yang Yingliang
2022-05-18  9:13 ` Loic Poulain
2022-05-18  9:13   ` Loic Poulain
2022-05-18  9:13   ` Loic Poulain
2022-05-19  1:52   ` Yang Yingliang [this message]
2022-05-19  1:52     ` Yang Yingliang
2022-05-19  1:52     ` Yang Yingliang

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=53b384f6-5507-b767-f64a-574cfd511e13@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=chandrashekar.devegowda@intel.com \
    --cc=davem@davemloft.net \
    --cc=haijun.liu@mediatek.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=loic.poulain@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=ricardo.martinez@linux.intel.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 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.