netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Geethasowjanya Akula <gakula@marvell.com>
Cc: Sai Krishna Gajula <saikrishnag@marvell.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sunil Kovvuri Goutham <sgoutham@marvell.com>,
	"richardcochran@gmail.com" <richardcochran@gmail.com>
Subject: Re: [EXT] Re: [net PATCH 1/7] octeontx2-af: Secure APR table update with the lock
Date: Thu, 30 Mar 2023 10:16:22 +0300	[thread overview]
Message-ID: <20230330071622.GT831478@unreal> (raw)
In-Reply-To: <DM6PR18MB2602944D58392C6FB6576BB8CD8E9@DM6PR18MB2602.namprd18.prod.outlook.com>

On Thu, Mar 30, 2023 at 06:56:54AM +0000, Geethasowjanya Akula wrote:
> 
> >-----Original Message-----
> >From: Leon Romanovsky <leon@kernel.org> 
> >Sent: Thursday, March 30, 2023 11:26 AM
> >To: Sai Krishna Gajula <saikrishnag@marvell.com>
> >Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org; pabeni@redhat.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Sunil Kovvuri Goutham <sgoutham@marvell.com>; >richardcochran@gmail.com; Geethasowjanya Akula <gakula@marvell.com>
> >Subject: [EXT] Re: [net PATCH 1/7] octeontx2-af: Secure APR table update with the lock
> 
> >External Email
> 
> >----------------------------------------------------------------------
> >On Wed, Mar 29, 2023 at 10:36:13PM +0530, Sai Krishna wrote:
> >> From: Geetha sowjanya <gakula@marvell.com>
> >> 
> >> APR table contains the lmtst base address of PF/VFs.
> >> These entries are updated by the PF/VF during the device probe. Due to 
> >> race condition while updating the entries are getting corrupted. Hence 
> >> secure the APR table update with the lock.
> 
> >However, I don't see rsrc_lock in probe path.
> >otx2_probe()
> >-> cn10k_lmtst_init()
> > -> lmt_base/lmstst is updated with and without mbox.lock.
> 
> >Where did you take rsrc_lock in probe flow?
> 
> rsrc_lock is initialized in AF driver. PF/VF driver in cn10k_lmtst_init() send a mbox request to AF to update the lmtst table. 
> mbox handler in AF takes rsrc_lock to update lmtst table.

Can you please present the stack trace of such flow? What are the actual variables/struct rsrc_lock
is protecting?

Thanks

> 
> Thanks,
> Geetha.
> 
> >Thanks
> 
> >> 
> >> Fixes: 893ae97214c3 ("octeontx2-af: cn10k: Support configurable LMTST 
> >> regions")
> >> Signed-off-by: Geetha sowjanya <gakula@marvell.com>
> >> Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
> >> Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
> >> ---
> >>  drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c | 8 +++++---
> >>  1 file changed, 5 insertions(+), 3 deletions(-)
> >> 
> >> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c 
> >> b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
> >> index 4ad9ff025c96..8530250f6fba 100644
> >> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
> >> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
> >> @@ -142,16 +142,17 @@ int rvu_mbox_handler_lmtst_tbl_setup(struct rvu *rvu,
> >>  	 * region, if so, convert that IOVA to physical address and
> >>  	 * populate LMT table with that address
> >>  	 */
> >> +	mutex_lock(&rvu->rsrc_lock);
> >>  	if (req->use_local_lmt_region) {
> >>  		err = rvu_get_lmtaddr(rvu, req->hdr.pcifunc,
> >>  				      req->lmt_iova, &lmt_addr);
> >>  		if (err < 0)
> >> -			return err;
> >> +			goto error;
> >>  
> >>  		/* Update the lmt addr for this PFFUNC in the LMT table */
> >>  		err = rvu_update_lmtaddr(rvu, req->hdr.pcifunc, lmt_addr);
> >>  		if (err)
> >> -			return err;
> >> +			goto error;
> >>  	}
> >>  
> >>  	/* Reconfiguring lmtst map table in lmt region shared mode i.e. make 
> >> @@ -181,7 +182,7 @@ int rvu_mbox_handler_lmtst_tbl_setup(struct rvu *rvu,
> >>  		 */
> >>  		err = rvu_update_lmtaddr(rvu, req->hdr.pcifunc, val);
> >>  		if (err)
> >> -			return err;
> >> +			goto error;
> >>  	}
> >>  
> >>  	/* This mailbox can also be used to update word1 of 
> >> APR_LMT_MAP_ENTRY_S @@ -230,6 +231,7 @@ int rvu_mbox_handler_lmtst_tbl_setup(struct rvu *rvu,
> >>  	}
> >>  
> >>  error:
> >> +	mutex_unlock(&rvu->rsrc_lock);
> >>  	return err;
> >>  }
> >>  
> >> --
> >> 2.25.1
> >> 

  reply	other threads:[~2023-03-30  7:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 17:06 [net PATCH 0/7] octeontx2: Miscellaneous fixes Sai Krishna
2023-03-29 17:06 ` [net PATCH 1/7] octeontx2-af: Secure APR table update with the lock Sai Krishna
2023-03-30  5:55   ` Leon Romanovsky
2023-03-30  6:56     ` [EXT] " Geethasowjanya Akula
2023-03-30  7:16       ` Leon Romanovsky [this message]
2023-03-31  8:56         ` Geethasowjanya Akula
2023-04-03 13:08           ` Leon Romanovsky
2023-03-29 17:06 ` [net PATCH 2/7] octeontx2-af: Fix start and end bit for scan config Sai Krishna
2023-03-30  6:12   ` Leon Romanovsky
2023-03-29 17:06 ` [net PATCH 3/7] octeontx2-af: Add validation for lmac type Sai Krishna
2023-03-30  6:18   ` Leon Romanovsky
2023-03-30 10:08     ` [EXT] " Sai Krishna Gajula
2023-03-30 10:13     ` Sai Krishna Gajula
2023-03-29 17:06 ` [net PATCH 4/7] octeontx2-af: Update correct mask to filter IPv4 fragments Sai Krishna
2023-03-30  6:19   ` Leon Romanovsky
2023-03-29 17:06 ` [net PATCH 5/7] octeontx2-af: Fix issues with NPC field hash extract Sai Krishna
2023-03-30  6:20   ` Leon Romanovsky
2023-03-30 17:58     ` Sai Krishna Gajula
2023-03-29 17:06 ` [net PATCH 6/7] octeontx2-af: Skip PFs if not enabled Sai Krishna
2023-03-29 17:06 ` [net PATCH 7/7] octeontx2-pf: Disable packet I/O for graceful exit Sai Krishna
2023-03-30  6:23   ` Leon Romanovsky
2023-03-30 17:48 ` [net PATCH 0/7] octeontx2: Miscellaneous fixes Jakub Kicinski
2023-04-05  6:15   ` Sai Krishna Gajula

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=20230330071622.GT831478@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=saikrishnag@marvell.com \
    --cc=sgoutham@marvell.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).