public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: "Jenishkumar Patel [C]" <jpatel2@marvell.com>
Cc: "marcin.s.wojtas@gmail.com" <marcin.s.wojtas@gmail.com>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"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>,
	Antoine Tenart <atenart@kernel.org>
Subject: Re: [EXT] Re: [net v4 PATCH 1/1] net: mvpp2: clear BM pool before initialization
Date: Tue, 23 Jan 2024 10:15:07 +0100	[thread overview]
Message-ID: <20240123101507.6ae730bd@device-28.home> (raw)
In-Reply-To: <PH0PR18MB4543B5E92792ECD5D3683861EC752@PH0PR18MB4543.namprd18.prod.outlook.com>

Hi,

On Mon, 22 Jan 2024 06:02:07 +0000
"Jenishkumar Patel [C]" <jpatel2@marvell.com> wrote:

> > > +/* Cleanup pool before actual initialization in the OS */ static void 
> > > +mvpp2_bm_pool_cleanup(struct mvpp2 *priv, int pool_id) {
> > > +	unsigned int thread = mvpp2_cpu_to_thread(priv, get_cpu());
> > > +	u32 val;
> > > +	int i;
> > > +
> > > +	/* Drain the BM from all possible residues left by firmware */
> > > +	for (i = 0; i < MVPP2_BM_POOL_SIZE_MAX; i++)
> > > +		mvpp2_thread_read(priv, thread, MVPP2_BM_PHY_ALLOC_REG(pool_id));  
> > 
> > ... I think you didn't answer Antoine's comment on that loop from the V2, regarding what this does exactly. From the other sites this is used, it seems to perform an allocation from the pool, can you clarify how safe it is to do so here, if for example the BM was never configured by the firmware beforehand and is therefore already in a Stopped state ?
> 
> Reading the register provides a pointer to buffer that is already allocated during BM initialization. When multiple reading is done on the register, it will drain all the pointers that are stored by previous firmware. Also reading this register does not perform any allocation as it is only performing register read operation, thus when the BM is not configured earlier then it will not lead to any stop state.
> 
> > And are we not risking any leak if there was something in the pool that we don't release ?
> 
> The data on the pointer given by register read is written after the read operation is preformed, which means the pointer does not contain any data, thus there is no leak.

Thanks for your answers, I think that's clear to me then.

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime


  reply	other threads:[~2024-01-23  9:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19  3:59 [net v4 PATCH 1/1] net: mvpp2: clear BM pool before initialization Jenishkumar Maheshbhai Patel
2024-01-19 14:04 ` Maxime Chevallier
2024-01-22  6:02   ` [EXT] " Jenishkumar Patel [C]
2024-01-23  9:15     ` Maxime Chevallier [this message]
2024-01-24 20:40 ` patchwork-bot+netdevbpf

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=20240123101507.6ae730bd@device-28.home \
    --to=maxime.chevallier@bootlin.com \
    --cc=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jpatel2@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=marcin.s.wojtas@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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