netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Habets <habetsm.xilinx@gmail.com>
To: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Cc: netdev@vger.kernel.org, Ira Weiny <ira.weiny@intel.com>,
	"Fabio M . De Francesco" <fmdefrancesco@gmail.com>,
	Edward Cree <ecree.xilinx@gmail.com>
Subject: Re: [PATCH v2 net-next 2/6] sfc: Use kmap_local_page() instead of kmap_atomic()
Date: Thu, 24 Nov 2022 08:34:26 +0000	[thread overview]
Message-ID: <Y38skj5oq2IYUB2D@gmail.com> (raw)
In-Reply-To: <20221123205219.31748-3-anirudh.venkataramanan@intel.com>

On Wed, Nov 23, 2022 at 12:52:15PM -0800, Anirudh Venkataramanan wrote:
> kmap_atomic() is being deprecated in favor of kmap_local_page(). Replace
> kmap_atomic() and kunmap_atomic() with kmap_local_page() and kunmap_local()
> respectively.
> 
> Note that kmap_atomic() disables preemption and page-fault processing, but
> kmap_local_page() doesn't. When converting uses of kmap_atomic(), one has
> to check if the code being executed between the map/unmap implicitly
> depends on page-faults and/or preemption being disabled. If yes, then code
> to disable page-faults and/or preemption should also be added for
> functional correctness. That however doesn't appear to be the case here,
> so just kmap_local_page() is used.
> 
> Also note that the page being mapped is not allocated by the driver, and so
> the driver doesn't know if the page is in normal memory. This is the reason
> kmap_local_page() is used as opposed to page_address().
> 
> I don't have hardware, so this change has only been compile tested.
> 
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Cc: Edward Cree <ecree.xilinx@gmail.com>
> Cc: Martin Habets <habetsm.xilinx@gmail.com>
> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>

Acked-by: Martin Habets <habetsm.xilinx@gmail.com>

> ---
> v1 -> v2: Update commit message
> ---
>  drivers/net/ethernet/sfc/tx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
> index c5f88f7..4ed4082 100644
> --- a/drivers/net/ethernet/sfc/tx.c
> +++ b/drivers/net/ethernet/sfc/tx.c
> @@ -207,11 +207,11 @@ static void efx_skb_copy_bits_to_pio(struct efx_nic *efx, struct sk_buff *skb,
>  		skb_frag_t *f = &skb_shinfo(skb)->frags[i];
>  		u8 *vaddr;
>  
> -		vaddr = kmap_atomic(skb_frag_page(f));
> +		vaddr = kmap_local_page(skb_frag_page(f));
>  
>  		efx_memcpy_toio_aligned_cb(efx, piobuf, vaddr + skb_frag_off(f),
>  					   skb_frag_size(f), copy_buf);
> -		kunmap_atomic(vaddr);
> +		kunmap_local(vaddr);
>  	}
>  
>  	EFX_WARN_ON_ONCE_PARANOID(skb_shinfo(skb)->frag_list);
> -- 
> 2.37.2

  reply	other threads:[~2022-11-24  8:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 20:52 [PATCH v2 net-next 0/6] Remove uses of kmap_atomic() Anirudh Venkataramanan
2022-11-23 20:52 ` [PATCH v2 net-next 1/6] ch_ktls: Use memcpy_from_page() instead of k[un]map_atomic() Anirudh Venkataramanan
2022-11-24 10:56   ` Ayush Sawal
2022-11-28 20:22     ` Anirudh Venkataramanan
2022-11-25 15:34   ` Fabio M. De Francesco
2022-11-23 20:52 ` [PATCH v2 net-next 2/6] sfc: Use kmap_local_page() instead of kmap_atomic() Anirudh Venkataramanan
2022-11-24  8:34   ` Martin Habets [this message]
2022-11-25 15:37   ` Fabio M. De Francesco
2022-11-23 20:52 ` [PATCH v2 net-next 3/6] cassini: Use page_address() " Anirudh Venkataramanan
2022-11-25 15:38   ` Fabio M. De Francesco
2022-11-23 20:52 ` [PATCH v2 net-next 4/6] cassini: Use memcpy_from_page() instead of k[un]map_atomic() Anirudh Venkataramanan
2022-11-25 15:39   ` Fabio M. De Francesco
2022-11-23 20:52 ` [PATCH v2 net-next 5/6] sunvnet: Use kmap_local_page() instead of kmap_atomic() Anirudh Venkataramanan
2022-11-25 15:40   ` Fabio M. De Francesco
2022-11-23 20:52 ` [PATCH v2 net-next 6/6] net: thunderbolt: " Anirudh Venkataramanan
2022-11-24  9:34   ` Mika Westerberg
2022-11-25 15:41   ` Fabio M. De Francesco
2022-11-25 10:50 ` [PATCH v2 net-next 0/6] Remove uses " patchwork-bot+netdevbpf
2022-11-25 15:47 ` Fabio M. De Francesco

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=Y38skj5oq2IYUB2D@gmail.com \
    --to=habetsm.xilinx@gmail.com \
    --cc=anirudh.venkataramanan@intel.com \
    --cc=ecree.xilinx@gmail.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=ira.weiny@intel.com \
    --cc=netdev@vger.kernel.org \
    /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).