From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796052399; b=TGCK74FsxOk/idwJK7REuGRYxrh0XUFfOQPgLApBgZv2/kYnSBHxhJDnM4ue/dBDDqly WlAQ4zCOU2y24/cDTZ4fHawaENBvMfLfHvHaxDlQSBLDukyj/2XAxvI5fjPUDa4PP27vy tyHNd17OLOq94BG3lJt3Eq6rYEyfYzb2QPbsM6SiXDpCiHyIJ0dLQlVeE4Zpolxlxt15A TtvYKY54TxBOouBAuR8Y1uBj4hgNDsDCadxeEDWNRL/tyFkM814ZZOhOtEFDg+SjLzLlx RwzqjyfepvU21dt7/l4byW+a9VkLaS3syc3MJyjX2gdN8dmPvCvnvdxX4id9/82t57A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796052399; h=Received:DKIM-Signature:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=IRcAeF2R7+st7H0yk8eC+m61CodBZD1xs2fWgazWdOk=; b=lfP8pbcbYfLFmBL/RsFkBdq1S44U+9IIGZ9OMK81R8VquKy8afeHQR8HVBAn/3+9Mlj0 R2bzl9tfuBhLP83dRt9LYxCsspWMeFsW9KL+ayJ/oSOstj/myi8XO+9qBqLFq0B3+jUYl Kem99j1B8FrTdN4UzBleIDIyFZVi5jZj8xtWaUZuJ2+W+54dCD4b+4/PF6LNzSFKG8buL NsI3/gzf+fbu5gx0co078JRihAGhNWeCQ3HrRjLjG12uHWnzhBKC9nV+3jSdLXlIvl/58 PWwhv8R1cvHCaA+jHD9Euogs/Hdpf878Yg/h9QKKPJTbmqyhx0JsXUCFEzwGP4JsMeQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="A/3Rt3rE"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E57A606A320; Mon, 30 Nov 2026 15:26:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=A/3Rt3rE Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98E621F000C1; Mon, 30 Nov 2026 15:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796052398; bh=IRcAeF2R7+st7H0yk8eC+m61CodBZD1xs2fWgazWdOk=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=A/3Rt3rE6MpUsmJsLbsl7bb3TcW78oZYnRYHvjd945ZWFg6izYPCKLRDPwOKPS3Rx 8HSgyaSMLYKQTPpaiuGenOsKOCcHgSLpdvPgxXvsUVRyhAhoL7BQfZuer7Oi+5GD+Y 5RuKgQ2BQem1NgIXnfuLM+LpumIbO+Nbgts914GJz256PoIfr79MdDTdAN6ykf3RHW WUzMyISKRGWpG+wYrQVcx73K0K/UvEWVN6dr/1S4zpW6Fnsk2CZL4g5OrqkRYtxQfw CGBnbjEEpTapmyOmJnTGg2tPjymyBo88tnoY9Xrsj22KkVoDOEJzmhsQ71mm1EvGlt 2dizEIUDNJ7xA== Date: Mon, 30 Nov 2026 05:26:37 -1000 Message-ID: <3ff50fc71138b619629bf83af9618cbe@kernel.org> From: Tejun Heo To: Kuba Piecuch Cc: David Vernet , Andrea Righi , Changwoo Min , sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH sched_ext/for-7.4-fixes] sched_ext: Clarify ops.sub_caps_updated() context and intended use In-Reply-To: <20261130125422.3895514-1-jpiecuch@google.com> References: <20261130125422.3895514-1-jpiecuch@google.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, Kuba. On Mon, Nov 30, 2026 at 12:55:09PM +0000, Kuba Piecuch wrote: > + * Delivered synchronously from the parent's scx_bpf_sub_grant() / > + * scx_bpf_sub_revoke() after the shard lock is released, or unlocked > + * from scx_sub_seed_caps() when seeding caps granted during > + * ops.sub_attach(). It therefore inherits whatever locking context > + * the parent holds (e.g. an rq lock, or unlocked from an unlocked > + * caller) and may run before the change takes effect on any given cpu. AFAICS, this doesn't hold when a delivery for the shard is already in flight. caps_updated_record() then only folds the change into the buffer and the kfunc returns without delivering it. The caller which is already delivering reports the change from its own context, possibly after the kfunc that made the change has returned. This can only happen when updates to the same shard race each other. Maybe we can figure out something better in the future but, for now, can you document the condition? The same goes for the struct scx_caps_updated comment and the two kfunc comments. Also, scx_bpf_sub_revoke() walks the whole subtree, so the caller can be any ancestor, not only the parent. > + * Any resulting ops.sub_caps_updated() callbacks are delivered synchronously > + * after the shard locks are released (inheriting the caller's locking context), > + * except when called from ops.sub_attach(), where scx_sub_seed_caps() delivers > + * them unlocked once the child's ops are ready. Leaving the delivery to scx_sub_seed_caps() isn't specific to ops.sub_attach(). It happens for any grant or revoke made before the child's ops are ready. Thanks. -- tejun