public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: "Saleem, Shiraz" <shiraz.saleem@intel.com>
Cc: Ruan Jinjie <ruanjinjie@huawei.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"Ismail, Mustafa" <mustafa.ismail@intel.com>,
	Jason Gunthorpe <jgg@ziepe.ca>
Subject: Re: [PATCH -next] RDMA/irdma: Silence the warnings in irdma_uk_rdma_write()
Date: Tue, 15 Aug 2023 08:18:09 +0300	[thread overview]
Message-ID: <20230815051809.GB22185@unreal> (raw)
In-Reply-To: <MWHPR11MB002969B2763A53C37368615BE917A@MWHPR11MB0029.namprd11.prod.outlook.com>

On Mon, Aug 14, 2023 at 08:55:44PM +0000, Saleem, Shiraz wrote:
> > Subject: Re: [PATCH -next] RDMA/irdma: Silence the warnings in
> > irdma_uk_rdma_write()
> > 
> > On Fri, Aug 11, 2023 at 02:22:15PM +0800, Ruan Jinjie wrote:
> > > Remove sparse warnings introduced by commit 272bba19d631 ("RDMA:
> > > Remove unnecessary ternary operators"):
> > >
> > > drivers/infiniband/hw/irdma/uk.c:285:24: sparse: sparse: incorrect type in
> > assignment (different base types) @@     expected bool [usertype] push_wqe:1
> > @@     got restricted __le32 [usertype] *push_db @@
> > > drivers/infiniband/hw/irdma/uk.c:285:24: sparse:     expected bool [usertype]
> > push_wqe:1
> > > drivers/infiniband/hw/irdma/uk.c:285:24: sparse:     got restricted __le32
> > [usertype] *push_db
> > > drivers/infiniband/hw/irdma/uk.c:386:24: sparse: sparse: incorrect type in
> > assignment (different base types) @@     expected bool [usertype] push_wqe:1
> > @@     got restricted __le32 [usertype] *push_db @@
> > > drivers/infiniband/hw/irdma/uk.c:386:24: sparse:     expected bool [usertype]
> > push_wqe:1
> > > drivers/infiniband/hw/irdma/uk.c:386:24: sparse:     got restricted __le32
> > [usertype] *push_db
> > > drivers/infiniband/hw/irdma/uk.c:471:24: sparse: sparse: incorrect type in
> > assignment (different base types) @@     expected bool [usertype] push_wqe:1
> > @@     got restricted __le32 [usertype] *push_db @@
> > > drivers/infiniband/hw/irdma/uk.c:471:24: sparse:     expected bool [usertype]
> > push_wqe:1
> > > drivers/infiniband/hw/irdma/uk.c:471:24: sparse:     got restricted __le32
> > [usertype] *push_db
> > > drivers/infiniband/hw/irdma/uk.c:723:24: sparse: sparse: incorrect type in
> > assignment (different base types) @@     expected bool [usertype] push_wqe:1
> > @@     got restricted __le32 [usertype] *push_db @@
> > > drivers/infiniband/hw/irdma/uk.c:723:24: sparse:     expected bool [usertype]
> > push_wqe:1
> > > drivers/infiniband/hw/irdma/uk.c:723:24: sparse:     got restricted __le32
> > [usertype] *push_db
> > > drivers/infiniband/hw/irdma/uk.c:797:24: sparse: sparse: incorrect type in
> > assignment (different base types) @@     expected bool [usertype] push_wqe:1
> > @@     got restricted __le32 [usertype] *push_db @@
> > > drivers/infiniband/hw/irdma/uk.c:797:24: sparse:     expected bool [usertype]
> > push_wqe:1
> > > drivers/infiniband/hw/irdma/uk.c:797:24: sparse:     got restricted __le32
> > [usertype] *push_db
> > > drivers/infiniband/hw/irdma/uk.c:875:24: sparse: sparse: incorrect type in
> > assignment (different base types) @@     expected bool [usertype] push_wqe:1
> > @@     got restricted __le32 [usertype] *push_db @@
> > > drivers/infiniband/hw/irdma/uk.c:875:24: sparse:     expected bool [usertype]
> > push_wqe:1
> > > drivers/infiniband/hw/irdma/uk.c:875:24: sparse:     got restricted __le32
> > [usertype] *push_db
> > >
> > > Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Closes:
> > > https://lore.kernel.org/oe-kbuild-all/202308110251.BV6BcwUR-lkp@intel.
> > > com/
> > > ---
> > >  drivers/infiniband/hw/irdma/uk.c | 12 ++++++------
> > >  1 file changed, 6 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/drivers/infiniband/hw/irdma/uk.c
> > > b/drivers/infiniband/hw/irdma/uk.c
> > > index a0739503140d..363c67c18924 100644
> > > --- a/drivers/infiniband/hw/irdma/uk.c
> > > +++ b/drivers/infiniband/hw/irdma/uk.c
> > > @@ -282,7 +282,7 @@ int irdma_uk_rdma_write(struct irdma_qp_uk *qp, struct
> > irdma_post_sq_info *info,
> > >  	bool read_fence = false;
> > >  	u16 quanta;
> > >
> > > -	info->push_wqe = qp->push_db;
> > > +	info->push_wqe = !!qp->push_db;
> > 
> > Shiraz, push_db is declared as pointer, but I don't see where it is allocated. Current
> > code works because push_db is always 1 entry.
> > 
> >   316 struct irdma_qp_uk {
> >   ...
> >   324         __le32 *push_db;
> > 
> > and
> > 
> >    156         set_32bit_val(qp->push_db, 0,
> >    157                       FIELD_PREP(IRDMA_WQEALLOC_WQE_DESC_INDEX,
> > wqe_idx >> 3) | qp->qp_id);
> > 
> > Such variable use is not great. can you please fix it?
> > Can Ruan use "qp->push_mode" check instead of "qp->push_db"?
> > 
> 
> Hi Leon - Thanks for bring this to my attention.
> 
> Seems we don't have all aspects of kernel push implementation and yes
> the push DB not mapped renders it void. And this code is also in kernel fast path :/
> 
> kernel push is not plan of record at this point and the patch (below) cleans it up. I can send this to the mailing list.
> 
> I am fine if we want to spot fix the sparse issue through Ruan's patch here.
> qp->push_mode and qp->push_db are not really equivalent.
> The latter is constant once db is mapped. The former is transient per qp, comes and goes.
> But its all mute anyway as it stands now.
>  
> Or we can just use my removal patch to fix the sparse issue as well.

If we have an option to remove, it is always preferable solution to me.
Please send your removal patch to the ML.

Thanks

      reply	other threads:[~2023-08-15  5:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11  6:22 [PATCH -next] RDMA/irdma: Silence the warnings in irdma_uk_rdma_write() Ruan Jinjie
2023-08-13  9:22 ` Leon Romanovsky
2023-08-14 20:55   ` Saleem, Shiraz
2023-08-15  5:18     ` Leon Romanovsky [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=20230815051809.GB22185@unreal \
    --to=leon@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mustafa.ismail@intel.com \
    --cc=ruanjinjie@huawei.com \
    --cc=shiraz.saleem@intel.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