Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp349476rdb; Tue, 23 Jan 2024 01:15:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IENy7rd2ioXreAcbGcCIoafalwCcrKAz0V4JddIhj/ckukRCys4LJ3DzlRI1lWKg0rAJe2o X-Received: by 2002:ad4:4ee9:0:b0:686:1e2:747f with SMTP id dv9-20020ad44ee9000000b0068601e2747fmr603415qvb.2.1706001331522; Tue, 23 Jan 2024 01:15:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706001331; cv=pass; d=google.com; s=arc-20160816; b=hMk4littp6vyF2IdZt7iB+v7RoRGFGRoM8aB0v0RtP9eR9uu3WSPk1EIHc7FEseXjh /9u4l3qR7/CvYJknfLGIUchlxAPiEzbB9vahRm9lhBtaMSpuGQa+R1Xh768qkCxpCrhm PBCCFpWVGqusxGr9xUZDOJTYGug/RAb09OIXrCYWFBHsUR5+3XA5jkBRrmi6vCSi73Hb sbxzRcktSBMzrhUphtRYLQZVvFwpWdatSWSZ2qZ/7YbHYPA8iK5YMNd5BWQaz/D0TO3+ nyv/VCs+sJt+Cw7znxFQOgb/gXnk3KMV7cxZbD7pP7xjvFBc7DPtkMOwzAKOayi2vyUo uDHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=J+BnTNr7Ae3D9xLmTYxlT4lRtHyTsNW6UydqPcRonqs=; fh=YpZd7Gu72q02g/+cySW/s/aJCCyDsfAMrAf0rXk4mGw=; b=xqYbOh/gnFFm/7DenCjO3nUR0/gb97iryqX9+puBd/hWxA/8n5uIjaX68JyAQWAkXD VX+o7AcGbluvSMJQ1/0OpRHFmpXwaadzDfi/l+NrLkDZW5VFFeULWH26miXlr3h+CADg LL/vlS4q2hNpOsa4i7dgAtN/oYVtZi11OP+mcjbXAD6DrDSL9mGNe5+NDz+UBwG0D2wc CQcOja1Ustmk/BHOOMvlnkI4wi6jvs3XaoLYgA6xIyzfUtWCFPjPz9lQEUwjfKmYNuZJ CBTQ8TVrFGAbmr/ldBzG9CJ1jOeCMH90qqUWO6ZGgqwNwQZ9AEhQwa0LYEtp+Q7yEvEl UL5w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ojH8FY9k; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-34971-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r5-20020a0cb285000000b0068171ee32basi7701678qve.213.2024.01.23.01.15.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 01:15:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34971-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ojH8FY9k; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-34971-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 434C91C22115 for ; Tue, 23 Jan 2024 09:15:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E01E358232; Tue, 23 Jan 2024 09:15:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ojH8FY9k" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0071858114; Tue, 23 Jan 2024 09:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706001319; cv=none; b=teJDWCKgf8ycMGXNtvkxVIp4DvSRE5dWUeGrQT+abc+UjtyTe1xlU6e5bb1N8JyhXi59H+RnWH0dkV5qYBxphpiTAnXQKvYiiCK7+vlgsGn0839pvR6EBw/m410M+64sBO86sDl8SHt/A3N//Q47oHQjjtghTRtrFdOkhFyTxsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706001319; c=relaxed/simple; bh=Mu4jvDM/Gpa3jYnWKBrbmxafetUa+cgrJwz8QwpT7fA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FT1KIpMXDsNypZqprSQ1hQwimA8CHctvDVTLz25f3CictB5r1z/bdHMiw2b98VdBtbhbO0lyE15wZuBZW5P3llf9V0unn3j/wsuYjrOpSJJNBA3qpqRMMOpA9PJHZx9/DFwaPBPtOlS0kXwvhTV57I0UdtIsy9xCy2MAgPlTa9k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ojH8FY9k; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id CDE9C1BF205; Tue, 23 Jan 2024 09:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706001309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J+BnTNr7Ae3D9xLmTYxlT4lRtHyTsNW6UydqPcRonqs=; b=ojH8FY9kBTCiD+oqrC7vRrSbmndmiEFW96aDb/yp9vB/b3sxUnSFgQgOlUmDKatTcdc36O ZJiqcJFzRmX1CK0jlQ+k0KTEf/JvcdiL4abM4wJD57w/AYt/8iLQVB1r8DS+W5PvpKkGYx uP1sxalpwp9uCUDWUPKQNLuB/g4r8PyCBm6XVGcnb9+ybJP2fPQ2Thz5s/vtB47g2ctzOB r9I625VzLtxiOk6paGRAsVZDHQDFmM0CqC1JTaI1vrO41A/6CXomvPf0iQVt9iUIVW3hpI 5SNpZL6HsXsOhquLC53AGIk32vG5VozUsAZjs4GlrqkZsEPTH99wjRi6Zt9L8Q== Date: Tue, 23 Jan 2024 10:15:07 +0100 From: Maxime Chevallier To: "Jenishkumar Patel [C]" Cc: "marcin.s.wojtas@gmail.com" , "linux@armlinux.org.uk" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Antoine Tenart Subject: Re: [EXT] Re: [net v4 PATCH 1/1] net: mvpp2: clear BM pool before initialization Message-ID: <20240123101507.6ae730bd@device-28.home> In-Reply-To: References: <20240119035914.2595665-1-jpatel2@marvell.com> <20240119150451.476d6ba2@device-28.home> Organization: Bootlin X-Mailer: Claws Mail 4.2.0 (GTK 3.24.39; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-Sasl: maxime.chevallier@bootlin.com Hi, On Mon, 22 Jan 2024 06:02:07 +0000 "Jenishkumar Patel [C]" 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