From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (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 202A73101B0; Mon, 8 Jun 2026 02:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780885560; cv=none; b=JQvQxNMczJIDiSKiIBZx0NbeV5Ht9smONbcbGoCfyWDN1sblESuruCCK+lrm3BNtTdljjwXVnaZguI8d+vOoWE/i8uXcvemW2X78sJ8ekunYDFIBmMV0CrLF58ePL/dOPJ+WhsN7Eb29KDlCy/b/n9ZMlum3MyDXK6X+czndoIE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780885560; c=relaxed/simple; bh=CuTWCIdiAko6A183eJ74MFkBY9CGpWXqmZfpXZYLliA=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZRliz3LoDTAQxbtNBPutzD31VkoA3cXaC/9WIlBIfNvPfvlQpyGZrjfwF3jAip0FUpu+8gs8bfRduIFsByW2PrRNEjPTgoBSGj0VijdWlGfsPZp06lPQDsQAsxOez6i0lqEg4wwkWz2IZNon6GqFzLPexIwTU/PBmv1Wi6+E398= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=Foh99MXI; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="Foh99MXI" Received: from pps.filterd (m0431384.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6580EA9g888654; Sun, 7 Jun 2026 19:25:49 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=k O3QjaHlZaokipw4hbds1pfie5IKRfTmHoiHou2W33s=; b=Foh99MXIS7uRnvw/c 8yf3MK66SjxUtvGygTqzxr5kqpMPwK7ZP/esUnPqSTMuUxy2HGfD1moS9yrbvQP5 cg1Ornj/l6AcviT6FBGJuSV4mC9stUByIUom22U8Y2xKiWXVHTtH2E6ylegwaXtd nIebPaqlDWuHwgsAQkyWQHC11+JmE4OlFmd19TalhV1pDT5CPjsUq/qlVSbQrQwI /ByuDIPqe4EcOEJBx1rb7C86pvD3LyNjYn1ZSMmXbAoxuBboyXeZMAM7RBybL2wV FsgfT/4udCMYpBlGCElcNpS3pLatjVjlxxS1BXg0kqJp9RG9u40BWxXvh61rpoXT KBinA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 4en7t8ssg7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 07 Jun 2026 19:25:49 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Sun, 7 Jun 2026 19:25:48 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Sun, 7 Jun 2026 19:25:48 -0700 Received: from rkannoth-OptiPlex-7090 (unknown [10.28.36.165]) by maili.marvell.com (Postfix) with ESMTP id 581CB5B6932; Sun, 7 Jun 2026 19:25:45 -0700 (PDT) Date: Mon, 8 Jun 2026 07:55:44 +0530 From: Ratheesh Kannoth To: , CC: , , , , , , , , Subject: Re: [PATCH v19 net-next 1/9] octeontx2-af: Enforce single RVU AF probe Message-ID: References: <20260605063245.3553861-1-rkannoth@marvell.com> <20260605063245.3553861-2-rkannoth@marvell.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260605063245.3553861-2-rkannoth@marvell.com> X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjA4MDAxOSBTYWx0ZWRfX9txzzjwjOzd/ kWcEELaaxGyShJDqmAa8Tf3gCeJP7evrVFYQmS065zVf05sTx8bhQPNBWf4XOLk8p6hbwXJILVW q/Ioa1+PvelyIje7GMhwV0DUGvzz79Gbr9OfIBMAbnG8TT925EJpMlIlpArY11HSAPLJ/txTwFf hQ2DjkbQmi/I1+AcWHTMs/R+T0ySIfQUz0vasT0WV+BInvxr48Z/bi25zr4r/oMbKgCzit6vZuq dlZtWxsJNRoHHznFkFGlDGvN3kqpMng6YlrggvSrOFovravL94G6Qef6ojk693zJSQYkZ5eh//C chpf89SE8E4+ex0dWgoFTx+PWjMHtDe3pgC4/NGOD5j94XkoIhp1BPa/9IgewMWoAqJT4QDQev+ D1XLsmxHrXbzxj8tW+XGub53QfeSeIRq+T4u2rS57p+jZ8XIZf1cP530ttQKQUSu6/FG9nV3ArX 4WgD0QCFXsUEh0DSrfA== X-Authority-Analysis: v=2.4 cv=evLvCIpX c=1 sm=1 tr=0 ts=6a26282d cx=c_pps a=rEv8fa4AjpPjGxpoe8rlIQ==:117 a=rEv8fa4AjpPjGxpoe8rlIQ==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=l0iWHRpgs5sLHlkKQ1IR:22 a=TtqV-g6YmW1Jfm2GSLaY:22 a=M5GUcnROAAAA:8 a=JIJO8x5AFiNFHzJHdLsA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=O8hF6Hzn-FEA:10 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-ORIG-GUID: Sassp9UuvGdJdsNkfmT14hFHt5iHamEM X-Proofpoint-GUID: Sassp9UuvGdJdsNkfmT14hFHt5iHamEM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-08_01,2026-06-05_02,2025-10-01_01 On 2026-06-05 at 12:02:37, Ratheesh Kannoth (rkannoth@marvell.com) wrote: > There is only one admin-function PCI device per system. > Reject any additional AF probe with -EBUSY so the driver model matches > hardware and automated reviewers can rely on a single bound instance. > > Signed-off-by: Ratheesh Kannoth >> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c >> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c >> @@ -3542,12 +3542,19 @@ static void rvu_update_module_params(struct rvu *rvu) >> kpu_profile ? kpu_profile : default_pfl_name, KPU_NAME_LEN); >> } >> >> +static atomic_t device_bound = ATOMIC_INIT(0); >> + >> static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id) >> { >> struct device *dev = &pdev->dev; >> struct rvu *rvu; >> int err; >> >> + if (atomic_cmpxchg(&device_bound, 0, 1) != 0) { >> + dev_warn(dev, "Only one af device is supported.\n"); >> + return -EBUSY; >> + } >> + >Once this atomic_cmpxchg() succeeds, where is device_bound ever reset >back to 0? >The flag is set on entry but the function does not clear it on any of >the err_* failure labels, and rvu_remove() also does not touch it. >Two scenarios appear to leave the driver permanently unusable until >module unload: >1) Any transient probe failure after the cmpxchg (devm_kzalloc returning > NULL, pci_enable_device(), dma_set_mask_and_coherent(), pcim_iomap(), > rvu_setup_hw_resources(), rvu_mbox_init(), rvu_register_interrupts(), > rvu_register_dl(), rvu_enable_sriov(), etc.) returns via an err_* > label with device_bound still set to 1. Wouldn't every subsequent > probe attempt — including deferred-probe retries on the same device > — then fail with -EBUSY even though nothing is bound? >2) A successful probe followed by sysfs unbind, PCI hot-remove, or a > driver rebind goes through rvu_remove(), which tears down the rvu > instance but does not clear device_bound. Doesn't this break > rebinding the same device (echo > /sys/bus/pci/drivers/rvu_af/bind) > and PCI error-recovery flows for the lifetime of the module load? >The commit message describes the intent as rejecting "any additional AF >probe" so there is "a single bound instance", which reads as one bound >at a time. Should device_bound be cleared (atomic_set(&device_bound, 0)) >on every err_* path in rvu_probe() and at the end of rvu_remove() to >match that intent? You are completely correct. The current implementation lacks transactional rollback for device_bound in the downstream rvu_probe() error paths, as well as the corresponding reset in rvu_remove(). The inclusion of atomic_cmpxchg() here is a proactive sanity check to enforce the hardware paradigm, as firmware instantiates only a single Admin Function (AF) PCI device. However, full error-handling path hardening and proper resource cleanup for the AF driver are currently incomplete across the broader initialization sequence. To prevent scope creep in this series, we plan to address the comprehensive error-path rollback—including proper atomic_set(&device_bound, 0) invocations on probe failure and driver detachment—in a dedicated, subsequent hardening patchset targeted for net-next.