All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Sergey Gorenko <sergeygo@nvidia.com>
Cc: Sagi Grimberg <sagi@grimberg.me>,
	linux-rdma@vger.kernel.org, Max Gurtovoy <mgurtovoy@nvidia.com>
Subject: Re: [PATCH] IB/iser: Prevent invalidating wrong MR
Date: Thu, 4 Jan 2024 16:58:38 -0400	[thread overview]
Message-ID: <20240104205838.GA318306@nvidia.com> (raw)
In-Reply-To: <20231219072311.40989-1-sergeygo@nvidia.com>

On Tue, Dec 19, 2023 at 09:23:11AM +0200, Sergey Gorenko wrote:
> The iser_reg_resources structure has two pointers to MR but only one
> mr_valid field. The implementation assumes that we use only *sig_mr when
> pi_enable is true. Otherwise, we use only *mr. However, it is only
> sometimes correct. Read commands without protection information occur
> even when pi_enble is true. For example, the following SCSI commands
> have a Data-In buffer but never have protection information: READ
> CAPACITY (16), INQUIRY, MODE SENSE(6), MAINTENANCE IN. So, we use
> *sig_mr for some SCSI commands and *mr for the other SCSI commands.
> 
> In most cases, it works fine because the remote invalidation is applied.
> However, there are two cases when the remote invalidation is not
> applicable.
>  1. Small write commands when all data is sent as an immediate.
>  2. The target does not support the remote invalidation feature.
> 
> The lazy invalidation is used if the remote invalidation is impossible.
> Since, at the lazy invalidation, we always invalidate the MR we want to
> use, the wrong MR may be invalidated.
> 
> To fix the issue, we need a field per MR that indicates the MR needs
> invalidation. Since the ib_mr structure already has such a field, let's
> use ib_mr.need_inval instead of iser_reg_resources.mr_valid.
> 
> Fixes: b76a439982f8 ("IB/iser: Use IB_WR_REG_MR_INTEGRITY for PI handover")
> Acked-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> Signed-off-by: Sergey Gorenko <sergeygo@nvidia.com>
> ---
>  drivers/infiniband/ulp/iser/iscsi_iser.h     | 2 --
>  drivers/infiniband/ulp/iser/iser_initiator.c | 5 ++++-
>  drivers/infiniband/ulp/iser/iser_memory.c    | 8 ++++----
>  drivers/infiniband/ulp/iser/iser_verbs.c     | 1 -
>  4 files changed, 8 insertions(+), 8 deletions(-)

Applied to for-next, thanks

Jason

      reply	other threads:[~2024-01-04 20:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19  7:23 [PATCH] IB/iser: Prevent invalidating wrong MR Sergey Gorenko
2024-01-04 20:58 ` Jason Gunthorpe [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=20240104205838.GA318306@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mgurtovoy@nvidia.com \
    --cc=sagi@grimberg.me \
    --cc=sergeygo@nvidia.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.