From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Steve Rutherford <srutherford@google.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
<intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
David Decotigny <decot@google.com>,
"Anjali Singhai" <anjali.singhai@intel.com>,
Sridhar Samudrala <sridhar.samudrala@intel.com>,
Brian Vazquez <brianvv@google.com>, Li Li <boolli@google.com>,
<emil.s.tantilov@intel.com>
Subject: Re: [RFC PATCHv2 1/1] idpf: Fix header clobber in IDPF with SWIOTLB enabled
Date: Mon, 23 Mar 2026 14:31:01 +0100 [thread overview]
Message-ID: <42850fe3-b153-4b98-a58e-c5c78eb05f08@intel.com> (raw)
In-Reply-To: <20260312163025.3765321-1-aleksander.lobakin@intel.com>
From: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: Thu, 12 Mar 2026 17:30:24 +0100
> Hey,
>
> From: Steve Rutherford via Intel-wired-lan <intel-wired-lan@osuosl.org>
> Date: Fri, 6 Mar 2026 11:35:27 -0800
>
>> On Fri, Mar 6, 2026 at 6:52=E2=80=AFAM Alexander Lobakin
>> <aleksander.lobakin@intel.com> wrote:
>>>
>>> From: Steve Rutherford <srutherford@google.com>
>>> Date: Wed, 4 Mar 2026 14:01:46 -0800
>>>
>>>> I believe syncing twice isn't inherently wrong - it's more that you
>>>> can't synthesize the header via the workaround and then sync, since it
>>>> will pull the uninitialized header buffer from the SWIOTLB. Outside of
>>>> SWIOTLB, dma syncs are more or less no-ops, while (with SWIOTLB) they
>>>> are copies from/to the bounce buffers.
>>>
>>> Ah I see.
>>>
>>> What if I add sync_for_device after copying the header? This should
>>> synchronize the bounce buffer with the copied data I guess? A bit of
>>> overhead, but this W/A triggers mostly on stuff like ARP/ICMP, "hotpath"
>>> L4 protos are fortunately not affected.
>>
>> That should work fine as well. I'm not certain I have strong
>> preferences on the right answer here, other than "does it work and,
>> ideally, is it less confusing?" The patch I posted is a bit
>> unintuitive. I think what you are describing might make the workaround
>> self-contained.
>
> Could you please test this patch with SWIOTLB? If it doesn't fix
> the issue, you can try changing `page_pool_get_dma_dir(hdr_pp)`
> to `DMA_TO_DEVICE` and/or `DMA_BIDIRECTIONAL`.
> Currently, I don't have any machines with SWIOTLB unfortunately =\
> Let me know if any of these works. I'll submit it properly when we
> have a solution.
Any updates? I need your Tested-by in order to send this.
>
> (the patch applies cleanly to the latest net-next and should apply
> to a couple older kernel releases as well)
>
>>
>> thanks,
>> Steve
>> [And sorry for my gmail-driven top posting crimes D: ]
>
> Thanks,
> Olek
> ---
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index 45ee5b80479a..42111d56d66f 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> @@ -3475,7 +3475,8 @@ static u32 idpf_rx_hsplit_wa(const struct libeth_fqe *hdr,
> struct libeth_fqe *buf, u32 data_len)
> {
> u32 copy = data_len <= L1_CACHE_BYTES ? data_len : ETH_HLEN;
> - struct page *hdr_page, *buf_page;
> + const struct page_pool *hdr_pp;
> + dma_addr_t hdr_addr;
> const void *src;
> void *dst;
>
> @@ -3483,16 +3484,20 @@ static u32 idpf_rx_hsplit_wa(const struct libeth_fqe *hdr,
> !libeth_rx_sync_for_cpu(buf, copy))
> return 0;
>
> - hdr_page = __netmem_to_page(hdr->netmem);
> - buf_page = __netmem_to_page(buf->netmem);
> - dst = page_address(hdr_page) + hdr->offset +
> - pp_page_to_nmdesc(hdr_page)->pp->p.offset;
> - src = page_address(buf_page) + buf->offset +
> - pp_page_to_nmdesc(buf_page)->pp->p.offset;
> + hdr_pp = __netmem_get_pp(hdr->netmem);
> + dst = __netmem_address(hdr->netmem) + hdr->offset + hdr_pp->p.offset;
> + src = __netmem_address(buf->netmem) + buf->offset +
> + __netmem_get_pp(buf->netmem)->p.offset;
>
> memcpy(dst, src, LARGEST_ALIGN(copy));
> buf->offset += copy;
>
> + /* Make sure SWIOTLB is synced */
> + hdr_addr = page_pool_get_dma_addr_netmem(hdr->netmem);
> + dma_sync_single_range_for_device(hdr_pp->p.dev, hdr_addr,
> + hdr->offset + hdr_pp->p.offset,
> + copy, page_pool_get_dma_dir(hdr_pp));
> +
> return copy;
> }
Thanks,
Olek
next prev parent reply other threads:[~2026-03-23 13:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 20:34 [RFC PATCHv2 0/1] idpf: IDPF + SWIOTLB Bug Steve Rutherford
2026-02-27 20:34 ` [RFC PATCHv2 1/1] idpf: Fix header clobber in IDPF with SWIOTLB enabled Steve Rutherford
2026-03-02 7:17 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-03 15:31 ` Alexander Lobakin
2026-03-03 19:44 ` Steve Rutherford
2026-03-04 15:11 ` Alexander Lobakin
2026-03-04 22:01 ` Steve Rutherford
2026-03-06 14:50 ` Alexander Lobakin
2026-03-06 19:35 ` Steve Rutherford
2026-03-12 16:30 ` Alexander Lobakin
2026-03-23 13:31 ` Alexander Lobakin [this message]
2026-03-25 0:44 ` Steve Rutherford
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=42850fe3-b153-4b98-a58e-c5c78eb05f08@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=anjali.singhai@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=boolli@google.com \
--cc=brianvv@google.com \
--cc=davem@davemloft.net \
--cc=decot@google.com \
--cc=edumazet@google.com \
--cc=emil.s.tantilov@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=przemyslaw.kitszel@intel.com \
--cc=sridhar.samudrala@intel.com \
--cc=srutherford@google.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