From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FD31606A335 for ; Thu, 3 Dec 2026 19:52:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=tWaEI20Y; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Be0CX6t1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=b5/W8lXmORw0XLx3MkMTZU2mQK8FgRnFm2HxqJqB/N8=; b=tWaEI20YY1bPWtU1pOw1tzrVTk vfboAw2+Z481gEzflOW8Eh70bLV83YXWxbkHXpDxTSrMAfCQcHRdHhx5gh/fDmeOtoOy5+xgLFHHU mlCRaQFx5iWVac+9wpa9/iXuYYP8t4Fv1SY6aMcP2utvloZB+cslGZ+VvLLe9JMXC+zikbs+fTz+w m7fTrhn+6v7Wlm+Pj3MeWqX09tkVS5fQOFsU74dT/srdhXtNHZ5sLPZuHlv4NGI3AT50nu4Q8PIun Izd7sPaRS4J/0DFQ4O7NK0Yw5UHq646Gg58szhSuBXEso6OuE/9G/fFuxK63O8fpFI0WLfcwcE3sE hZMWt4oQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZCdg-0000000Fq7x-0bOB; Thu, 03 Dec 2026 19:38:44 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZCdf-0000000Fq79-0PjE for linux-riscv@lists.infradead.org; Thu, 03 Dec 2026 19:38:43 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 087E845524; Thu, 3 Dec 2026 19:38:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C87F41F000C2; Thu, 3 Dec 2026 19:38:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796326721; bh=zv257IPbkYR1npbl2Me+/aomY/ltM+uewjNlpTgscQI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Be0CX6t1cLn6GcNXp1M/EmnBuRWDY1c6PnRnf5sx4zXb//r4ZEcHrrdWV5XqGF796 5XWIk6exxNth+Njy8gnirzgdrlKfg6n2LmNIksgtwRFQbpellQpHS4CnoMmGlBm0Se 3GGUsnzvaA8yPsPYGzqmnMYkkSRlX3PlAM6cbc/5RDMAA6iVwQ5g3iScYWLW9G0BhA f6YjL5yTpQoWDkTR/f3Yhc/q1ZQ4kC5/2u7VpsAMPDJmkIMNuEdxYgA2PNFLD6E8GS RhngwKQvUpStdgjpw1nhRDDWuqd8UWVFOGgKUHbi+bmNA/y61Elv2jCY8GL21LYvLS q3o+RaLeatjYg== Date: Thu, 3 Dec 2026 11:38:40 -0800 From: Drew Fustini To: sashiko-reviews@lists.linux.dev Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v13 1/5] riscv_cbqri: Add capacity controller core Message-ID: References: <20261203-dfustini-atl-sc-cbqri-dt-v13-0-eaa688b1624c@kernel.org> <20261203-dfustini-atl-sc-cbqri-dt-v13-1-eaa688b1624c@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-8.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Thu, Dec 03, 2026 at 10:14:14AM +0000, sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 1 potential > issue to consider: > - [Low] riscv_cbqri: incomplete AT-mirror verification in > cbqri_apply_cache_config() > -- > > commit a00d96c0d30cb11391c930e3a47a96f149912607 > Author: Drew Fustini > > riscv_cbqri: Add capacity controller core > > This commit adds the core driver for RISC-V CBQRI capacity controllers, > including capability probing and MMIO operations to program and read back > per-RCID capacity block masks. > > > diff --git a/drivers/resctrl/cbqri_devices.c b/drivers/resctrl/cbqri_devices.c > > new file mode 100644 > > index 0000000000000..d6c2e08a5546d > > --- /dev/null > > +++ b/drivers/resctrl/cbqri_devices.c > > [ ... ] > > > +int cbqri_apply_cache_config(struct cbqri_controller *ctrl, u32 closid, > > + const struct cbqri_cc_config *cfg) > > +{ > > [ ... ] > > > + /* Capacity config limit operation for the AT half implied by cfg->at */ > > + err = cbqri_cc_alloc_op(ctrl, CBQRI_CC_ALLOC_CTL_OP_CONFIG_LIMIT, > > + closid, cfg->at, cfg->cbm); > > + if (err < 0) > > + return err; > > + > > + /* > > + * CDP-off mirror: on AT-capable controllers, also program the > > + * other AT half with the same mask so the two halves stay in sync. > > + */ > > + if (need_at_mirror) { > > + u32 other = (cfg->at == CBQRI_CONTROL_REGISTERS_AT_CODE) ? > > + CBQRI_CONTROL_REGISTERS_AT_DATA : > > + CBQRI_CONTROL_REGISTERS_AT_CODE; > > + > > + err = cbqri_cc_alloc_op(ctrl, > > + CBQRI_CC_ALLOC_CTL_OP_CONFIG_LIMIT, > > + closid, other, cfg->cbm); > > + if (err < 0) { > > + int rerr; > > + > > + /* > > + * Best-effort revert of the cfg->at half so the two > > + * halves stay in sync. A schemata read sees only one > > + * half, so silent divergence would otherwise report > > + * the new value as if the write had succeeded. > > + */ > > + rerr = cbqri_cc_alloc_op(ctrl, > > + CBQRI_CC_ALLOC_CTL_OP_CONFIG_LIMIT, > > + closid, cfg->at, saved_cbm); > > + if (rerr < 0) > > + pr_err_ratelimited("AT-mirror revert failed (err=%d), AT halves diverged\n", > > + rerr); > > + return err; > > + } > > + } > > + > > + /* Read the limit back to verify the block mask landed */ > > + err = cbqri_cc_alloc_op(ctrl, CBQRI_CC_ALLOC_CTL_OP_READ_LIMIT, > > + closid, cfg->at, 0); > > + if (err < 0) > > + return err; > > + > > + /* > > + * Read the capacity block mask and narrow to u32 to match resctrl's CBM > > + * width. cbqri_probe_cc() rejects ncblks > 32 so the upper bits are > > + * reserved zero. > > + */ > > + reg = cbqri_readq(ctrl->base + CBQRI_CC_BLOCK_MASK_OFF); > > + if (lower_32_bits(reg) != cfg->cbm) { > > + pr_err_ratelimited("CBM verify mismatch (reg=%llx != cbm=%llx)\n", > > + reg, cfg->cbm); > > + err = -EIO; > > + } > > [Severity: Low] > Can the two AT halves still diverge when need_at_mirror is true? > > The post-write CBQRI_CC_ALLOC_CTL_OP_READ_LIMIT check only reads back > cfg->at, so a silent failure to apply cfg->cbm on the mirrored other > half goes undetected and cbqri_apply_cache_config() returns 0. > > In addition, because cfg->at is verified after other has already been > written, a readback error or mismatch on cfg->at returns -EIO without > reverting other to saved_cbm. > > Verifying cfg->at before programming other, and then verifying other > while reverting cfg->at to saved_cbm on either error or mismatch, would > keep both halves checked and consistent. This is not a problem. Both CONFIG_LIMIT operations check the status that the controller reports, and a failed mirror write already puts the first half back. The read back only catches a controller that reports success without applying the mask. Drew _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv