linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>, simo@redhat.com
Subject: Re: [PATCH RFC 04/10] SUNRPC: Add common byte-swapped RPC header constants
Date: Mon, 4 Feb 2019 09:16:54 -0500	[thread overview]
Message-ID: <0EB44600-7CF7-45C3-A1AB-75B76EFA1546@oracle.com> (raw)
In-Reply-To: <20190204075336.GA28337@infradead.org>



> On Feb 4, 2019, at 2:53 AM, Christoph Hellwig <hch@infradead.org> wrote:
> 
> On Sat, Feb 02, 2019 at 05:49:35PM -0500, Chuck Lever wrote:
>>>> Byte-swapping causes a CPU pipeline bubble on some processors. When
>>>> a decoder is comparing an on-the-wire value for equality, byte-
>>>> swapping can be avoided by comparing it directly to a pre-byte-
>>>> swapped constant value.
>>> 
>>> Which ones?
>> 
>> I assume you mean on which processors have I observed CPU cycle
>> spikes around bswap instructions.
> 
> Yes.
> 
>> I've seen this behavior only
>> on Intel processors of various families.
> 
> Interesting. In general we should not do separate byte swap instructions
> on x86, as MOVBE can be used to do a load or store with an included
> byteswap, and I thought the whole point for that was that they could
> be handled in the same cycle.
> 
> In fact https://www.agner.org/optimize/instruction_tables.pdf
> says that movbe is generally a single cycle instruction.
> 
>> Would you prefer a different justification for this clean-up?
> 
> I don't really care about the cleanup, it is just that the explanation
> goes against conventional wisdom, which is why I was a little surpised.
> 
> And that is not just the cycles, but also as Trond pointed out
> that the Linux byte swapping macro on constants should usually be
> optimized away at compile time anyway.

They are. The problem is that we are byte-swapping the incoming wire
data and then comparing to CPU-endian constants in some hot paths.
It's better to leave the incoming data alone and compare to a pre-
byte-swapped constant. This patch adds some of these constants that
were missing, in preparation for fixing the hot paths.

That is apparently not clear from the patch description, so I will
endeavor to improve it.


--
Chuck Lever




  reply	other threads:[~2019-02-04 14:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01 19:57 [PATCH RFC 00/10] SUNRPC GSS overhaul Chuck Lever
2019-02-01 19:57 ` [PATCH RFC 01/10] SUNRPC: Remove some dprintk() call sites from auth functions Chuck Lever
2019-02-04 19:04   ` J. Bruce Fields
2019-02-04 19:07     ` Chuck Lever
2019-02-01 19:57 ` [PATCH RFC 02/10] SUNRPC: Remove rpc_xprt::tsh_size Chuck Lever
2019-02-01 19:57 ` [PATCH RFC 03/10] SUNRPC: Add build option to disable support for insecure enctypes Chuck Lever
2019-02-01 19:57 ` [PATCH RFC 04/10] SUNRPC: Add common byte-swapped RPC header constants Chuck Lever
2019-02-02  2:30   ` Tom Talpey
2019-02-02 22:46     ` Chuck Lever
2019-02-03 15:00       ` Trond Myklebust
2019-02-03 16:49         ` Chuck Lever
2019-02-03 18:58           ` Trond Myklebust
2019-02-02 17:02   ` Christoph Hellwig
2019-02-02 22:49     ` Chuck Lever
2019-02-04  7:53       ` Christoph Hellwig
2019-02-04 14:16         ` Chuck Lever [this message]
2019-02-04 14:32           ` Christoph Hellwig
2019-02-04 14:56             ` Chuck Lever
2019-02-04 19:37               ` J. Bruce Fields
2019-02-05  1:57                 ` Tom Talpey
2019-02-01 19:57 ` [PATCH RFC 05/10] SUNRPC: Use struct xdr_stream when constructing RPC Call header Chuck Lever
2019-02-01 19:57 ` [PATCH RFC 06/10] SUNRPC: Clean up rpc_verify_header() Chuck Lever
2019-02-01 19:58 ` [PATCH RFC 07/10] SUNRPC: Use struct xdr_stream when decoding RPC Reply header Chuck Lever
2019-02-01 19:58 ` [PATCH RFC 08/10] SUNRPC: Introduce trace points in rpc_auth_gss.ko Chuck Lever
2019-02-01 19:58 ` [PATCH RFC 09/10] SUNRPC: Remove xdr_buf_trim() Chuck Lever
2019-02-04 19:46   ` J. Bruce Fields
2019-02-04 19:49     ` Chuck Lever
2019-02-04 20:00       ` Bruce Fields
2019-02-04 20:07         ` Chuck Lever
2019-02-04 20:11           ` Bruce Fields
2019-02-01 19:58 ` [PATCH RFC 10/10] SUNRPC: Add SPDX IDs to some net/sunrpc/auth_gss/ files Chuck Lever

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=0EB44600-7CF7-45C3-A1AB-75B76EFA1546@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=hch@infradead.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=simo@redhat.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).