All of lore.kernel.org
 help / color / mirror / Atom feed
From: Long Li <longli@microsoft.com>
To: tom <tom@talpey.com>, linkinjeon <linkinjeon@kernel.org>
Cc: David Howells <dhowells@redhat.com>,
	Hyunchul Lee <hyc.lee@gmail.com>,
	Steve French <smfrench@gmail.com>,
	CIFS <linux-cifs@vger.kernel.org>
Subject: RE: RDMA (smbdirect) testing
Date: Mon, 23 May 2022 19:17:11 +0000	[thread overview]
Message-ID: <PH7PR21MB326344B83D7B4300683D2CEACED49@PH7PR21MB3263.namprd21.prod.outlook.com> (raw)
In-Reply-To: <307f1f2c-900b-8158-78a8-a3dd7564f2f8@talpey.com>

> Subject: Re: RDMA (smbdirect) testing
> 
> On 5/23/2022 11:05 AM, Namjae Jeon wrote:
> > 2022-05-23 22:45 GMT+09:00, Tom Talpey <tom@talpey.com>:
> >> On 5/22/2022 7:06 PM, Namjae Jeon wrote:
> >>> 2022-05-21 20:54 GMT+09:00, Tom Talpey <tom@talpey.com>:
> >>>> ...
> >>>> Why does the code require
> >>>> 16 sge's, regardless of other size limits? Normally, if the lower
> >>>> layer supports fewer, the upper layer will simply reduce its operation sizes.
> >>> This should be answered by Long Li. It seems that he set the
> >>> optimized value for the NICs he used to implement RDMA in cifs.
> >>
> >> "Optimized" is a funny choice of words. If the provider doesn't
> >> support the value, it's not much of an optimization to insist on 16.
> >> :)
> > Ah, It's obvious that cifs haven't been tested with soft-iWARP. And
> > the same with ksmbd...
> >>
> >> Personally, I'd try building a kernel with smbdirect.h changed to
> >> have SMBDIRECT_MAX_SGE set to 6, and see what happens. You might have
> >> to reduce the r/w sizes in mount, depending on any other issues this
> >> may reveal.
> > Agreed, and ksmbd should also be changed as well as cifs for test. We
> > are preparing the patches to improve this in ksmbd, rather than
> > changing/building this hardcoding every time.
> 
> So, the patch is just for this test, right? Because I don't think any kernel-based
> storage upper layer should ever need more than 2 or 3.
> How many memory regions are you doing per operation? I would expect one for
> the SMB3 headers, and another, if needed, for data.
> These would all be lmr-type and would not require actual new memreg's.
> 
> And for bulk data, I would hope you're using fast-register, which takes a
> different path and doesn't use the same sge's.
> 
> Getting this right, and keeping things efficient both in SGE bookkeeping as well
> as memory registration efficiency, is the rocket science behind RDMA
> performance and correctness. Slapping "16" or "6" or whatever isn't the long-
> term fix.

I found max_sge is extremely large on Mellanox hardware, but smaller on other iWARP hardware.

Hardcoding it to 16 is certainly not a good choice. I think we should set it to the smaller value of 1) a predefined value (e.g. 8), and the 2) the max_sge the hardware reports.

If the CIFS upper layer ever sends data with larger number of SGEs, the send will fail.

Long

> 
> Tom.
> 
> > diff --git a/fs/cifs/smbdirect.h b/fs/cifs/smbdirect.h index
> > a87fca82a796..7003722ab004 100644
> > --- a/fs/cifs/smbdirect.h
> > +++ b/fs/cifs/smbdirect.h
> > @@ -226,7 +226,7 @@ struct smbd_buffer_descriptor_v1 {
> >   } __packed;
> >
> >   /* Default maximum number of SGEs in a RDMA send/recv */
> > -#define SMBDIRECT_MAX_SGE      16
> > +#define SMBDIRECT_MAX_SGE      6
> >   /* The context for a SMBD request */
> >   struct smbd_request {
> >          struct smbd_connection *info; diff --git
> > a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c index
> > e646d79554b8..70662b3bd590 100644
> > --- a/fs/ksmbd/transport_rdma.c
> > +++ b/fs/ksmbd/transport_rdma.c
> > @@ -42,7 +42,7 @@
> >   /* SMB_DIRECT negotiation timeout in seconds */
> >   #define SMB_DIRECT_NEGOTIATE_TIMEOUT           120
> >
> > -#define SMB_DIRECT_MAX_SEND_SGES               8
> > +#define SMB_DIRECT_MAX_SEND_SGES               6
> >   #define SMB_DIRECT_MAX_RECV_SGES               1
> >
> >   /*
> >
> > Thanks!
> >>
> >> Tom.
> >>
> >

  reply	other threads:[~2022-05-23 19:32 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19 20:41 RDMA (smbdirect) testing Steve French
2022-05-19 23:06 ` Namjae Jeon
2022-05-20  6:01   ` Hyunchul Lee
2022-05-20 18:03     ` Tom Talpey
2022-05-20 18:12     ` David Howells
2022-05-21 11:54       ` Tom Talpey
2022-05-22 23:06         ` Namjae Jeon
2022-05-23 13:45           ` Tom Talpey
2022-05-23 15:05             ` Namjae Jeon
2022-05-23 16:05               ` Tom Talpey
2022-05-23 19:17                 ` Long Li [this message]
2022-05-24  1:01                   ` Namjae Jeon
2022-05-24 21:08                     ` Long Li
2022-06-02 23:32                       ` Namjae Jeon
2022-06-03  0:07                         ` Long Li
2022-06-07 17:26                           ` Tom Talpey
2022-06-07 22:25                             ` Namjae Jeon
2022-05-24  0:59                 ` Namjae Jeon
2022-05-24  9:16               ` David Howells
2022-05-24 17:49                 ` Steve French
2022-05-24 18:12                   ` Tom Talpey
2022-05-25  9:29             ` David Howells
2022-05-25  9:41             ` David Howells
2022-05-25 10:00               ` Stefan Metzmacher
2022-05-25 10:20               ` David Howells
2022-05-26 14:56                 ` Stefan Metzmacher
2022-05-26 15:52                   ` Tom Talpey
2022-05-27  8:27                     ` Stefan Metzmacher
2022-05-27 11:46                     ` David Howells
2022-05-27 13:45                       ` Stefan Metzmacher
2022-05-27 22:22                       ` David Howells
2022-08-02 15:10             ` David Howells
2022-08-03  0:55               ` Namjae Jeon
2022-08-03  2:36                 ` Namjae Jeon
2022-08-03  6:16                 ` David Howells
     [not found]         ` <747882.1653311226@warthog.procyon.org.uk>
2022-05-23 13:37           ` Tom Talpey
2022-05-23 14:03         ` Stefan Metzmacher
2022-05-25  9:35         ` David Howells
2022-05-20  6:20 ` David Howells
2022-05-20  8:37   ` Namjae Jeon
2022-05-24 20:12 ` David Howells
2022-05-27 10:33 ` UAF in smbd_reconnect() when using softIWarp David Howells

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=PH7PR21MB326344B83D7B4300683D2CEACED49@PH7PR21MB3263.namprd21.prod.outlook.com \
    --to=longli@microsoft.com \
    --cc=dhowells@redhat.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=smfrench@gmail.com \
    --cc=tom@talpey.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.