All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever III <chuck.lever@oracle.com>
To: Trond Myklebust <trondmy@hammerspace.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: write_space and software kTLS
Date: Tue, 15 Mar 2022 14:01:52 +0000	[thread overview]
Message-ID: <624F8B1A-7233-4DE6-A383-A17D88D3BB2F@oracle.com> (raw)
In-Reply-To: <378c5635b97c237f869234e24030ac0018b684b3.camel@hammerspace.com>


> On Mar 14, 2022, at 8:06 PM, Trond Myklebust <trondmy@hammerspace.com> wrote:
> 
> On Mon, 2022-03-14 at 21:35 +0000, Chuck Lever III wrote:
>> Hey Trond-
>> 
>> I've made some progress getting RPC-with-TLS working in
>> the Linux NFS client, but I recently hit an interesting
>> snag and could use a little advice.
>> 
>> The software kTLS infrastructure uses do_tcp_sendpages()
>> under the covers, and that function is clearing
>> SOCKWQ_ASYNC_NOSPACE from under xs_nospace(). That
>> prevents xs_run_error_worker() from waking up xprt->sending,
>> stalling an RPC transport waiting for more socket write
>> space. I'm not sure how to address this, and I'm interested
>> in your opinion.
>> 
> 
> How is it achieving this? We only set SOCKWQ_ASYNC_NOSPACE after the
> call to xprt_sock_sendmsg().

A kworker is clearing NOSPACE between the time xs_tcp_send_request()
sets it and the time xs_write_space() runs.

  kworker/u128:2-33    [003]   155.723869: rpc_socket_nospace:   task:000006cb@00000003 total=262380 remaining=131308
  kworker/u128:2-33    [003]   155.723870: bprint:               xs_nospace: sk=0xffff88810a8f0a00 setting SOCKWQ_ASYNC_NOSPACE
  kworker/u128:2-33    [003]   155.723879: xprt_transmit:        task:000006cb@00000003 xid=0x8ab69e2e seqno=0 status=-11
  kworker/u128:2-33    [003]   155.723881: xprt_release_xprt:    task:000006cc@00000003 snd_task:ffffffff
     kworker/3:2-116   [003]   155.723885: bprint:               do_tcp_sendpages: sk=0xffff88810a8f0a00 clearing SOCKWQ_ASYNC_NOSPACE
  kworker/u128:2-33    [003]   155.723888: rpc_task_run_action:  task:000006cc@00000003 flags=ASYNC|MOVEABLE|NORTO|CRED_NOREF runstate=RUNNING|ACTIVE|NEED_XMIT|NEED_RECV status=-11 action=call_transmit_status
  kworker/u128:2-33    [003]   155.723889: rpc_task_run_action:  task:000006cc@00000003 flags=ASYNC|MOVEABLE|NORTO|CRED_NOREF runstate=RUNNING|ACTIVE|NEED_XMIT|NEED_RECV status=0 action=call_transmit
  kworker/u128:2-33    [003]   155.723890: rpc_task_sleep:       task:000006cc@00000003 flags=ASYNC|MOVEABLE|NORTO|CRED_NOREF runstate=RUNNING|ACTIVE|NEED_XMIT|NEED_RECV status=-11 timeout=0 queue=xprt_sending
     kworker/1:2-115   [001]   155.733398: bprint:               do_tcp_sendpages: sk=0xffff88810a8f0a00 clearing SOCKWQ_ASYNC_NOSPACE
     kworker/1:2-115   [001]   155.733418: bprint:               do_tcp_sendpages: sk=0xffff88810a8f0a00 clearing SOCKWQ_ASYNC_NOSPACE
         openvpn-914   [001]   155.750263: bprint:               xs_write_space: sk=0xffff88810a8f0a00 SOCKWQ_ASYNC_NOSPACE was clear


>> For example, why check that flag rather than just waking
>> up xprt->sending unconditionally?
> 
> The socket code calls ->write_space() in all sorts of situations, so we
> need to distinguish between the cases where we are actually waiting for
> buffer memory, and the situations where we are not. Otherwise, we'd be
> calling xs_run_error_worker() all the time.

On my (admittedly limited) workloads, sk_stream_is_writeable()
does a good job of avoiding spurious wake-ups. However, to be
absolutely certain of our wake-up accounting, using a flag that
is local to the rpc_xprt and not overloaded might be wise?


--
Chuck Lever




      reply	other threads:[~2022-03-15 14:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 21:35 write_space and software kTLS Chuck Lever III
2022-03-15  0:06 ` Trond Myklebust
2022-03-15 14:01   ` Chuck Lever III [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=624F8B1A-7233-4DE6-A383-A17D88D3BB2F@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@hammerspace.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 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.