* [Intel-wired-lan] [RESEND PATCH net-next 1/2] e1000: Remove unnecessary use of kmap_atomic()
@ 2022-09-19 18:09 Anirudh Venkataramanan
2022-09-19 18:09 ` [Intel-wired-lan] [RESEND PATCH net-next 2/2] e1000e: " Anirudh Venkataramanan
2022-09-29 22:31 ` [Intel-wired-lan] [RESEND PATCH net-next 1/2] e1000: " Ira Weiny
0 siblings, 2 replies; 6+ messages in thread
From: Anirudh Venkataramanan @ 2022-09-19 18:09 UTC (permalink / raw)
To: intel-wired-lan; +Cc: Fabio M . De Francesco, Ira Weiny
buffer_info->rxbuf.page accessed in e1000_clean_jumbo_rx_irq() is
allocated using GFP_ATOMIC. Pages allocated with GFP_ATOMIC can't come from
highmem and so there's no need to kmap() them. Just use page_address().
I don't have access to a 32-bit system so did some limited testing on
qemu (qemu-system-i386 -m 4096 -smp 4 -device e1000e) with a 32-bit
Debian 11.04 image.
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
drivers/net/ethernet/intel/e1000/e1000_main.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 23299fc..93e57b1 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -4229,8 +4229,6 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
*/
p = buffer_info->rxbuf.page;
if (length <= copybreak) {
- u8 *vaddr;
-
if (likely(!(netdev->features & NETIF_F_RXFCS)))
length -= 4;
skb = e1000_alloc_rx_skb(adapter,
@@ -4238,10 +4236,9 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
if (!skb)
break;
- vaddr = kmap_atomic(p);
- memcpy(skb_tail_pointer(skb), vaddr,
- length);
- kunmap_atomic(vaddr);
+ memcpy(skb_tail_pointer(skb),
+ page_address(p), length);
+
/* re-use the page, so don't erase
* buffer_info->rxbuf.page
*/
--
2.37.2
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Intel-wired-lan] [RESEND PATCH net-next 2/2] e1000e: Remove unnecessary use of kmap_atomic()
2022-09-19 18:09 [Intel-wired-lan] [RESEND PATCH net-next 1/2] e1000: Remove unnecessary use of kmap_atomic() Anirudh Venkataramanan
@ 2022-09-19 18:09 ` Anirudh Venkataramanan
2022-09-29 22:40 ` Ira Weiny
2022-09-29 22:31 ` [Intel-wired-lan] [RESEND PATCH net-next 1/2] e1000: " Ira Weiny
1 sibling, 1 reply; 6+ messages in thread
From: Anirudh Venkataramanan @ 2022-09-19 18:09 UTC (permalink / raw)
To: intel-wired-lan; +Cc: Fabio M . De Francesco, Ira Weiny
alloc_rx_buf() allocates ps_page->page and buffer_info->page using either
GFP_ATOMIC or GFP_KERNEL. Memory allocated with GFP_KERNEL/GFP_ATOMIC can't
come from highmem and so there's no need to kmap() them. Just use
page_address().
I don't have access to a 32-bit system so did some limited testing on qemu
(qemu-system-i386 -m 4096 -smp 4 -device e1000e) with a 32-bit Debian 11.04
image.
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 321f2a9..05a59e5 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -1393,21 +1393,14 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done,
*/
if (l1 && (l1 <= copybreak) &&
((length + l1) <= adapter->rx_ps_bsize0)) {
- u8 *vaddr;
-
ps_page = &buffer_info->ps_pages[0];
- /* there is no documentation about how to call
- * kmap_atomic, so we can't hold the mapping
- * very long
- */
dma_sync_single_for_cpu(&pdev->dev,
ps_page->dma,
PAGE_SIZE,
DMA_FROM_DEVICE);
- vaddr = kmap_atomic(ps_page->page);
- memcpy(skb_tail_pointer(skb), vaddr, l1);
- kunmap_atomic(vaddr);
+ memcpy(skb_tail_pointer(skb),
+ page_address(ps_page->page), l1);
dma_sync_single_for_device(&pdev->dev,
ps_page->dma,
PAGE_SIZE,
@@ -1607,11 +1600,9 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_ring *rx_ring, int *work_done,
*/
if (length <= copybreak &&
skb_tailroom(skb) >= length) {
- u8 *vaddr;
- vaddr = kmap_atomic(buffer_info->page);
- memcpy(skb_tail_pointer(skb), vaddr,
+ memcpy(skb_tail_pointer(skb),
+ page_address(buffer_info->page),
length);
- kunmap_atomic(vaddr);
/* re-use the page, so don't erase
* buffer_info->page
*/
--
2.37.2
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Intel-wired-lan] [RESEND PATCH net-next 1/2] e1000: Remove unnecessary use of kmap_atomic()
2022-09-19 18:09 [Intel-wired-lan] [RESEND PATCH net-next 1/2] e1000: Remove unnecessary use of kmap_atomic() Anirudh Venkataramanan
2022-09-19 18:09 ` [Intel-wired-lan] [RESEND PATCH net-next 2/2] e1000e: " Anirudh Venkataramanan
@ 2022-09-29 22:31 ` Ira Weiny
1 sibling, 0 replies; 6+ messages in thread
From: Ira Weiny @ 2022-09-29 22:31 UTC (permalink / raw)
To: Anirudh Venkataramanan; +Cc: Fabio M . De Francesco, intel-wired-lan
On Mon, Sep 19, 2022 at 11:09:48AM -0700, Venkataramanan, Anirudh wrote:
> buffer_info->rxbuf.page accessed in e1000_clean_jumbo_rx_irq() is
> allocated using GFP_ATOMIC. Pages allocated with GFP_ATOMIC can't come from
> highmem and so there's no need to kmap() them. Just use page_address().
>
> I don't have access to a 32-bit system so did some limited testing on
> qemu (qemu-system-i386 -m 4096 -smp 4 -device e1000e) with a 32-bit
> Debian 11.04 image.
>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
> Suggested-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
> ---
> drivers/net/ethernet/intel/e1000/e1000_main.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
> index 23299fc..93e57b1 100644
> --- a/drivers/net/ethernet/intel/e1000/e1000_main.c
> +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
> @@ -4229,8 +4229,6 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
> */
> p = buffer_info->rxbuf.page;
> if (length <= copybreak) {
> - u8 *vaddr;
> -
> if (likely(!(netdev->features & NETIF_F_RXFCS)))
> length -= 4;
> skb = e1000_alloc_rx_skb(adapter,
> @@ -4238,10 +4236,9 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
> if (!skb)
> break;
>
> - vaddr = kmap_atomic(p);
> - memcpy(skb_tail_pointer(skb), vaddr,
> - length);
> - kunmap_atomic(vaddr);
> + memcpy(skb_tail_pointer(skb),
> + page_address(p), length);
> +
> /* re-use the page, so don't erase
> * buffer_info->rxbuf.page
> */
> --
> 2.37.2
>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Intel-wired-lan] [RESEND PATCH net-next 2/2] e1000e: Remove unnecessary use of kmap_atomic()
2022-09-19 18:09 ` [Intel-wired-lan] [RESEND PATCH net-next 2/2] e1000e: " Anirudh Venkataramanan
@ 2022-09-29 22:40 ` Ira Weiny
2022-09-30 18:20 ` Anirudh Venkataramanan
0 siblings, 1 reply; 6+ messages in thread
From: Ira Weiny @ 2022-09-29 22:40 UTC (permalink / raw)
To: Anirudh Venkataramanan; +Cc: Fabio M . De Francesco, intel-wired-lan
On Mon, Sep 19, 2022 at 11:09:49AM -0700, Venkataramanan, Anirudh wrote:
> alloc_rx_buf() allocates ps_page->page and buffer_info->page using either
> GFP_ATOMIC or GFP_KERNEL. Memory allocated with GFP_KERNEL/GFP_ATOMIC can't
> come from highmem and so there's no need to kmap() them. Just use
> page_address().
>
> I don't have access to a 32-bit system so did some limited testing on qemu
> (qemu-system-i386 -m 4096 -smp 4 -device e1000e) with a 32-bit Debian 11.04
> image.
>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
> Suggested-by: Ira Weiny <ira.weiny@intel.com>
> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 17 ++++-------------
> 1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 321f2a9..05a59e5 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -1393,21 +1393,14 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done,
> */
The comment just above here says this:
1389 /* page alloc/put takes too long and effects small
1390 * packet throughput, so unsplit small packets and
1391 * save the alloc/put only valid in softirq (napi)
1392 * context to call kmap_*
1393 */
I'm unable to grok what that means exactly but I feel like the kmap part is no
longer appropriate?
Maybe just delete ... 'to call kmap_*'?
The code itself looks ok. With some clean up to that comment:
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Ira
> if (l1 && (l1 <= copybreak) &&
> ((length + l1) <= adapter->rx_ps_bsize0)) {
> - u8 *vaddr;
> -
> ps_page = &buffer_info->ps_pages[0];
>
> - /* there is no documentation about how to call
> - * kmap_atomic, so we can't hold the mapping
> - * very long
> - */
> dma_sync_single_for_cpu(&pdev->dev,
> ps_page->dma,
> PAGE_SIZE,
> DMA_FROM_DEVICE);
> - vaddr = kmap_atomic(ps_page->page);
> - memcpy(skb_tail_pointer(skb), vaddr, l1);
> - kunmap_atomic(vaddr);
> + memcpy(skb_tail_pointer(skb),
> + page_address(ps_page->page), l1);
> dma_sync_single_for_device(&pdev->dev,
> ps_page->dma,
> PAGE_SIZE,
> @@ -1607,11 +1600,9 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_ring *rx_ring, int *work_done,
> */
> if (length <= copybreak &&
> skb_tailroom(skb) >= length) {
> - u8 *vaddr;
> - vaddr = kmap_atomic(buffer_info->page);
> - memcpy(skb_tail_pointer(skb), vaddr,
> + memcpy(skb_tail_pointer(skb),
> + page_address(buffer_info->page),
> length);
> - kunmap_atomic(vaddr);
> /* re-use the page, so don't erase
> * buffer_info->page
> */
> --
> 2.37.2
>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Intel-wired-lan] [RESEND PATCH net-next 2/2] e1000e: Remove unnecessary use of kmap_atomic()
2022-09-29 22:40 ` Ira Weiny
@ 2022-09-30 18:20 ` Anirudh Venkataramanan
2022-09-30 21:57 ` Tony Nguyen
0 siblings, 1 reply; 6+ messages in thread
From: Anirudh Venkataramanan @ 2022-09-30 18:20 UTC (permalink / raw)
To: Ira Weiny; +Cc: Fabio M . De Francesco, intel-wired-lan
On 9/29/2022 3:40 PM, Ira Weiny wrote:
> On Mon, Sep 19, 2022 at 11:09:49AM -0700, Venkataramanan, Anirudh wrote:
>> alloc_rx_buf() allocates ps_page->page and buffer_info->page using either
>> GFP_ATOMIC or GFP_KERNEL. Memory allocated with GFP_KERNEL/GFP_ATOMIC can't
>> come from highmem and so there's no need to kmap() them. Just use
>> page_address().
>>
>> I don't have access to a 32-bit system so did some limited testing on qemu
>> (qemu-system-i386 -m 4096 -smp 4 -device e1000e) with a 32-bit Debian 11.04
>> image.
>>
>> Cc: Ira Weiny <ira.weiny@intel.com>
>> Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
>> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
>> Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
>> Suggested-by: Ira Weiny <ira.weiny@intel.com>
>> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
>> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
>> ---
>> drivers/net/ethernet/intel/e1000e/netdev.c | 17 ++++-------------
>> 1 file changed, 4 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
>> index 321f2a9..05a59e5 100644
>> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
>> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
>> @@ -1393,21 +1393,14 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done,
>> */
>
> The comment just above here says this:
>
> 1389 /* page alloc/put takes too long and effects small
> 1390 * packet throughput, so unsplit small packets and
> 1391 * save the alloc/put only valid in softirq (napi)
> 1392 * context to call kmap_*
> 1393 */
I did see this when I was making the code change but it evaporated from
my working memory. Thanks for catching it.
>
> I'm unable to grok what that means exactly but I feel like the kmap part is no
> longer appropriate?
>
> Maybe just delete ... 'to call kmap_*'?
Okay, so did some git archeology and found that the original comment
just said this:
/* page alloc/put takes too long and effects small packet
* throughput, so unsplit small packets and save the alloc/put*/
... which is what I think we need to revert to.
Tony, do you want me to send a v2? Or is making an inline edit to the
patch you've already applied to dev-tree less work for you?
I am okay either way. Just tell me which one makes life easier for you.
Thanks!
Ani
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Intel-wired-lan] [RESEND PATCH net-next 2/2] e1000e: Remove unnecessary use of kmap_atomic()
2022-09-30 18:20 ` Anirudh Venkataramanan
@ 2022-09-30 21:57 ` Tony Nguyen
0 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-09-30 21:57 UTC (permalink / raw)
To: Anirudh Venkataramanan, Ira Weiny; +Cc: Fabio M . De Francesco, intel-wired-lan
On 9/30/2022 11:20 AM, Anirudh Venkataramanan wrote:
> Tony, do you want me to send a v2? Or is making an inline edit to the
> patch you've already applied to dev-tree less work for you?
>
> I am okay either way. Just tell me which one makes life easier for you.
v2 would be great.
Thanks,
Tony
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-09-30 21:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 18:09 [Intel-wired-lan] [RESEND PATCH net-next 1/2] e1000: Remove unnecessary use of kmap_atomic() Anirudh Venkataramanan
2022-09-19 18:09 ` [Intel-wired-lan] [RESEND PATCH net-next 2/2] e1000e: " Anirudh Venkataramanan
2022-09-29 22:40 ` Ira Weiny
2022-09-30 18:20 ` Anirudh Venkataramanan
2022-09-30 21:57 ` Tony Nguyen
2022-09-29 22:31 ` [Intel-wired-lan] [RESEND PATCH net-next 1/2] e1000: " Ira Weiny
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.