[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<CH0PR18MB43394685C04D448C0852393ECD46A@CH0PR18MB4339.namprd18.prod.outlook.com>
Date: Mon, 30 Jun 2025 05:33:28 +0000
From: Geethasowjanya Akula <gakula@...vell.com>
To: Alok Tiwari <alok.a.tiwari@...cle.com>,
Sunil Kovvuri Goutham
<sgoutham@...vell.com>,
Subbaraya Sundeep Bhatta <sbhatta@...vell.com>,
Hariprasad Kelam <hkelam@...vell.com>,
Bharat Bhushan
<bbhushan2@...vell.com>,
"andrew+netdev@...n.ch" <andrew+netdev@...n.ch>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com"
<edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"netdev@...r.kernel.org"
<netdev@...r.kernel.org>
Subject: RE: [EXTERNAL] [QUERY] net: octeontx2: query on mutex_unlock() usage
and WRITE_ONCE omission
>-----Original Message-----
>From: Alok Tiwari <alok.a.tiwari@...cle.com>
>Sent: Saturday, June 28, 2025 10:25 PM
>To: Sunil Kovvuri Goutham <sgoutham@...vell.com>; Geethasowjanya Akula
><gakula@...vell.com>; Subbaraya Sundeep Bhatta <sbhatta@...vell.com>;
>Hariprasad Kelam <hkelam@...vell.com>; Bharat Bhushan
><bbhushan2@...vell.com>; andrew+netdev@...n.ch;
>davem@...emloft.net; edumazet@...gle.com; kuba@...nel.org;
>pabeni@...hat.com; netdev@...r.kernel.org
>Cc: alok.a.tiwari@...cle.com
>Subject: [EXTERNAL] [QUERY] net: octeontx2: query on mutex_unlock() usage
>and WRITE_ONCE omission
>
>Noticed a couple of points in rep.c that might need attention:
>
>1.
>Use of mutex_unlock(&priv->mbox.lock) in rvu_rep_mcam_flow_init()
>
>mutex_unlock(&priv->mbox.lock);
>This function does not explicitly acquire mbox.lock, yet it calls mutex_unlock().
>Could you confirm whether this is a bug or if the lock is acquired implicitly in a
>helper function like otx2_sync_mbox_msg() or a possible leftover?
>
>2.
>Direct assignment of dev->mtu without WRITE_ONCE in
>rvu_rep_change_mtu()
>
>dev->mtu = new_mtu;
>Should this use WRITE_ONCE() to ensure safe access in concurrent scenarios?
Thanks for reporting, Alok. Both issues are valid—I’ll submit a patch to fix them.
Geetha.
>Thanks,
>Alok
>---
> drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>index 2cd3da3b6843..88dddf1fffb3 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>@@ -88,7 +88,7 @@ static int rvu_rep_mcam_flow_init(struct rep_dev *rep)
> sort(&rep->flow_cfg->flow_ent[0], allocated,
> sizeof(rep->flow_cfg->flow_ent[0]), mcam_entry_cmp,
>NULL);
>
>- mutex_unlock(&priv->mbox.lock);
>+ mutex_unlock(&priv->mbox.lock); // why mutex_unlock here
>
> rep->flow_cfg->max_flows = allocated;
>
>@@ -323,7 +323,7 @@ static int rvu_rep_change_mtu(struct net_device *dev,
>int new_mtu)
>
> netdev_info(dev, "Changing MTU from %d to %d\n",
> dev->mtu, new_mtu);
>- dev->mtu = new_mtu;
>+ dev->mtu = new_mtu; // < Is there a reason WRITE_ONCE isn't used
>here
>
> evt.evt_data.mtu = new_mtu;
> evt.pcifunc = rep->pcifunc;
>--
>2.47.1
Powered by blists - more mailing lists