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 6E61B606A32C for ; Thu, 3 Dec 2026 22:08:03 +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=281JA1tM; 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=CW/ywfIG 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=DV1K6hJTTecAiQk/ZAKOQiY9/zUcI2pC5OiAf16njz0=; b=281JA1tMr3DYqzxg93s7imkfWn P23OmJPB1kcfFSNiE6TtySppYAzWYiAva2IOC/cBHGqMPPzlrK/5LeiYvI60Zs+nN50PXvfJD8fHA ny6ZZXC772hB82oJSsVTEetIum4/OdY+Kbk7gAXVUj9t4Mgcu9URcrZooxE7NeA/Y2qwcxr2TWrK0 4trFemrksVrj17/hMOB9oDUQjzGFdLlt5+bjTTdyY4s+ut2TtfKabWwQ4ZTYOx+zJh2YVgJn4BhBu huHs6zhfaag5PFSkuRdBGqAEBxLyY/C9aSEtFNZBb1NLZyaCKcV0U58JTGwIVrDaDsXIn/cB7tvqA qtNQNuJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZEy6-0000000G5sY-2jQx; Thu, 03 Dec 2026 22:07:58 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZEy4-0000000G5sP-43Os for linux-riscv@lists.infradead.org; Thu, 03 Dec 2026 22:07:57 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 36B2F60E3F; Thu, 3 Dec 2026 22:07:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4B481F000C2; Thu, 3 Dec 2026 22:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796335675; bh=mkBdGcWw3sJrI/F+x+RGtxJVqfXbnrG8zb83QMSQBu0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=CW/ywfIGPtnek7rPq/a+KV4SZsFFR6PmDe0pEmGAOyz7tErC7UvMVYIJ9xCgmtg5L 6aIAcf+ykXWkorlflvmyxPvF+2MwcCTU4U7R+Pth8n+WA5MVXF3Th2FBHPRgu0yBxX ayetPJDWVtqn+RJCdI85fmXuN8cvH/3qFJ/zCgnfZvYn5awAIISjeFCZhoeQDEoJPU Eq1+2VU5eM9M4/Vc7LlHFeBHTPdAmthRPaC3Ao4nIZ94s2Ymh45xccWqhHi9rs9KAn 6jTCE9caV3+mzw5adDeSQxLhfs3fgKrygJ9sxDYdK6m7DQf2y7uOxcVpa0rgbQws8X lxWaD+lSPa6dQ== Date: Thu, 3 Dec 2026 14:07:54 -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 5/5] riscv_cbqri: Add CBQRI capacity allocation platform driver Message-ID: References: <20261203-dfustini-atl-sc-cbqri-dt-v13-0-eaa688b1624c@kernel.org> <20261203-dfustini-atl-sc-cbqri-dt-v13-5-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:18:44AM +0000, sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 2 potential > issues to consider: > - [Medium] riscv_cbqri: async probe in cbqri_capacity_driver can race > late_initcall > - [Medium] riscv_cbqri: cbqri_capacity_of_cache() misses offline > clusters at boot > -- > > commit f9a576951d9d7e095fba9697627996ee2c9c8612 > Author: Drew Fustini > > riscv_cbqri: Add CBQRI capacity allocation platform driver > > This commit adds a platform driver for RISC-V CBQRI capacity controllers > described in device tree. It maps the controller's register block, resolves > its cache level and id from cacheinfo via the riscv,cbqri-cache phandle, and > registers it with the CBQRI core. > > > diff --git a/drivers/resctrl/cbqri_capacity.c b/drivers/resctrl/cbqri_capacity.c > > new file mode 100644 > > index 0000000000000..9e3920b97d6c3 > > --- /dev/null > > +++ b/drivers/resctrl/cbqri_capacity.c > > @@ -0,0 +1,148 @@ > > [ ... ] > > > + cpus_read_lock(); > > + for_each_online_cpu(cpu) { > > + struct cacheinfo *ci = get_cpu_cacheinfo_level(cpu, *cache_level); > > + > > + if (ci && ci->fw_token == cache_np) { > > + *cache_id = ci->id; > > + found = true; > > + break; > > + } > > + } > > + cpus_read_unlock(); > > + > > + if (!found) > > + return dev_err_probe(dev, -ENODEV, > > + "%pOF: no online hart reports an L%u cache with a cache id for this node\n", > > + cache_np, *cache_level); > > [Severity: Medium] > Can this permanently miss capacity controllers for caches whose harts are > offline at boot? > > If a multi-cluster system boots with secondary clusters offline (such as > with maxcpus=1), for_each_online_cpu() skips them and probe fails with > -ENODEV. > > When those harts are later brought online via CPU hotplug, > cbqri_attach_cpu_to_all_ctrls() finds no registered controller for their > cache id and leaves them permanently outside resctrl control. > > Since cache_of_set_id() in drivers/base/cacheinfo.c derives DT cache IDs > directly from CPU device-tree nodes, sharing an OF cache-id helper would > avoid depending on online harts at probe time. This is a known limit of the initial support. A cache that has no online hart when the driver probes does not get a resctrl domain > > +static struct platform_driver cbqri_capacity_driver = { > > + .probe = cbqri_capacity_probe, > > + .driver = { > > + .name = "cbqri-capacity", > > + .of_match_table = cbqri_capacity_of_match, > > + /* > > + * The controller is registered permanently into the > > + * CBQRI core for the life of the system. Block unbind > > + * so userspace cannot leave a dangling controller. > > + */ > > + .suppress_bind_attrs = true, > > + }, > > +}; > > + > > +/* > > + * Register at device_initcall so probe runs before the resctrl glue's > > + * late_initcall, which copies the cbqri_controllers list. > > + */ > > +builtin_platform_driver(cbqri_capacity_driver); > > [Severity: Medium] > Can asynchronous probing cause cbqri_capacity_probe() to race with > cbqri_arch_late_init()? > > Because .probe_type is left unset (PROBE_DEFAULT_STRATEGY), booting with > driver_async_probe=* makes __driver_attach() schedule cbqri_capacity_probe() > asynchronously and return immediately. do_initcalls() then advances to > late_initcall without waiting for async probes: > > init thread async kworker > do_initcalls() (device_initcall) > __driver_attach() > async_schedule_dev(...) > __driver_attach_async_helper() > cbqri_capacity_probe() > do_initcalls() (late_initcall) > cbqri_arch_late_init() > cbqri_resctrl_pick_caches() <-- misses unregistered controller > riscv_cbqri_register_cc() > > Any controller that finishes probing after cbqri_resctrl_pick_caches() is > permanently ignored by resctrl, causing resctrl setup to either fail with > -ENODEV or come up missing cache domains while leaving the late controller > and its MMIO mapping unused. > > Setting .probe_type = PROBE_FORCE_SYNCHRONOUS on cbqri_capacity_driver.driver > would prevent this race. I don' think cmdline with driver_async_probe= is very likely, but I will set probe_type to PROBE_FORCE_SYNCHRONOUS in the next revision. Drew _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv