From: Jeff Layton <jlayton@kernel.org>
To: Mark Rutland <mark.rutland@arm.com>, linux-kernel@vger.kernel.org
Cc: Trond Myklebust <trond.myklebust@primarydata.com>,
Anna Schumaker <anna.schumaker@netapp.com>,
"J . Bruce Fields" <bfields@fieldses.org>,
"David S . Miller" <davem@davemloft.net>,
linux-nfs@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH RESEND] SUNRPC: fix include for cmpxchg_relaxed()
Date: Thu, 03 May 2018 10:16:49 -0400 [thread overview]
Message-ID: <71ed4a99241a6478b91246f967b9e1bc3d68fa9f.camel@kernel.org> (raw)
In-Reply-To: <20180503135050.15778-1-mark.rutland@arm.com>
On Thu, 2018-05-03 at 14:50 +0100, Mark Rutland wrote:
> Currently net/sunrpc/xprtmultipath.c is the only file outside of arch/
> headers and asm-generic/ headers to include <asm/cmpxhcg.h>, apparently
> for the use of cmpxchg_relaxed().
>
> However, many architectures do not provide cmpxchg_relaxed() in their
> <asm/cmpxhcg.h>, and it is necessary to include <linux/atomic.h> to get
> this definition, as noted in Documentation/core-api/atomic_ops.rst:
>
> If someone wants to use xchg(), cmpxchg() and their variants,
> linux/atomic.h should be included rather than asm/cmpxchg.h, unless
> the code is in arch/* and can take care of itself.
>
> Evidently we're getting the right header this via some transitive
> include today, but this isn't something we can/should rely upon,
> especially with ongoing rework of the atomic headers for KASAN
> instrumentation.
>
> Let's fix the code to include <linux/atomic.h>, avoiding fragility.
>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Trond Myklebust <trond.myklebust@primarydata.com>
> Cc: Anna Schumaker <anna.schumaker@netapp.com>
> Cc: J. Bruce Fields <bfields@fieldses.org>
> Cc: Jeff Layton <jlayton@poochiereds.net>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: linux-nfs@vger.kernel.org
> Cc: netdev@vger.kernel.org
> ---
> net/sunrpc/xprtmultipath.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> I sent this about a year ago [1], but got no response. This still applies atop
> of v4.17-rc3.
>
> I'm currently trying to implement instrumented atomics for arm64, and it would
> be great to have this fixed.
>
> Mark.
>
> [1] https://lkml.kernel.org/r/1489574142-20856-1-git-send-email-mark.rutland@arm.com
>
> diff --git a/net/sunrpc/xprtmultipath.c b/net/sunrpc/xprtmultipath.c
> index e2d64c7138c3..d897f41be244 100644
> --- a/net/sunrpc/xprtmultipath.c
> +++ b/net/sunrpc/xprtmultipath.c
> @@ -13,7 +13,7 @@
> #include <linux/rcupdate.h>
> #include <linux/rculist.h>
> #include <linux/slab.h>
> -#include <asm/cmpxchg.h>
> +#include <linux/atomic.h>
> #include <linux/spinlock.h>
> #include <linux/sunrpc/xprt.h>
> #include <linux/sunrpc/addr.h>
Looks fine.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2018-05-03 14:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 13:50 [PATCH RESEND] SUNRPC: fix include for cmpxchg_relaxed() Mark Rutland
2018-05-03 14:16 ` Jeff Layton [this message]
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=71ed4a99241a6478b91246f967b9e1bc3d68fa9f.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=anna.schumaker@netapp.com \
--cc=bfields@fieldses.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=trond.myklebust@primarydata.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).