From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.69 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796043210; b=J4aCu0G7zG+TZU6FMvj7fx755QL8e7l+RpEidd/PQO8jtL87O4Z46/us6Ei35mkkmm5O LSWO6PaLA4MDSmfxabCOHa8r2gzrescx1eh6WfuR7W3ho8owKYuHiKDwGIe3wD+oMvPil A296a6+RPozPx8BlmV4Df/P3rsJGi6+qLd4dV4/fYlD18KtsAurs9tex9RPIPnEToIpB0 iyKKGLHmfFi0o01hv4fDVCv2jPcidmNxLsXdk08jOWJblQjtlgTXMl06NUVw3+qR/TOxl gU9efqWrvKvErnPtDjPB/n+PTBRaCcodJUOzDtI+thDD2oZVjvdMPr2DCeFUXFp0OMg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796043210; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=RVfaxphyrGW8yfayOuQuDVe8ZjKYFsfZGMt9fv2Ov8U=; b=2Jhq1RY3tOZ9hSTRhthuZZiYzq6lMWw7QGuM2xeb2TRsFabjmwATAG+46LrpXbTm7Gdk ciy/0QBdX4VU1k5boQOy9oSnPXEd5e4XpJ19x9QOsWUdbwFZrgPZtnHpszrkbIXJsfyBE l90+3r9uFi+YrE4vm3C/sGakk7A+5H5TcCATsqZtBU6osyHmyiOba5I9XnbgNqVPK/r0H CgTjikmezMt9roZNQQHHL7zRYaFBfgU106u2qRse6RmsGmK8vxmlz/yL1gDkAvAJTypgc +KDvNSPyCCR9Gyw0s6KZ5eQTAjH4pjMzG/+ypYQ/H/VpxxcJe0ZEkhimane1NJKG5wQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--jpiecuch.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=dI8nAhqG; arc=none smtp.remote-ip=209.85.221.69 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FBB6606A320 for ; Mon, 30 Nov 2026 12:53:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9FBB6606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jpiecuch.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=dI8nAhqG Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4c6ed3aad4cso405193f8f.1 for ; Mon, 30 Nov 2026 04:53:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796043208; x=1796648008; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=RVfaxphyrGW8yfayOuQuDVe8ZjKYFsfZGMt9fv2Ov8U=; b=dI8nAhqGbIMIlDQNMawXttaN9cRuGRPSlQeIZpBuX8n8hPEojAuoD7BAlSAPUnRS+C lWRFS4kmr0+nrHKWbKlKNCyXyeA/lqOqOSYsjfNJFCDtN/ZePU7S+1lF2mK6+qTet9wE oXMiQv6Ma3mkhpSlZ2mlTiR+wi290aBeizKEBohyv6XUQ3rpNW5u2CUA3mTKEpXNGfde G6Kv3cdV3ne1Nj1EAfoCivogAmEszmSHE7U3w/1ZMQsTRZ3nyVd5FnTKZe9DXkwwb0z3 wqQwfJ6+RZ/thJmAQBveZwcSDgLopGLaGB3+kDavmBVaaHWOgrYJFpzEuT67UMzjLFmU aQMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796043208; x=1796648008; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=RVfaxphyrGW8yfayOuQuDVe8ZjKYFsfZGMt9fv2Ov8U=; b=YOr9sIxoy43KZ1JK2DaCMscZ7LB92O+DzcO2QHtEDW3pyJjBM0L5TN5v2gWjPCgpnk +Rwz9L7gW88/9aasdd1UNbrkduqOHGLu5D/eOi3Y7Xg4aczCDPO6rLTHdog7qnKOrJAb X0EBNqIloP8sLq355k/D6J41GnY1ukzlufHZRuKK1FD1GiXWiA81dvWLByP3tXqymX0W bFoPTmgTqNt8ljqkkwMwE7fxrbIBRnMxAsLVbnzqLOdavrzHswW0DHkLhPW+lUenecjI eX0sim+3XF3jqknkMZOuKb8a7cSBN3ALtdVLm5gK/6EelcOfwfVeILfra2uoUnLMjCj3 gPvQ== X-Forwarded-Encrypted: i=1; AL+hErEGPl/W7Y0Nzvuv2eknYwBKxKnfho4WfIv7jOn3Bmv06J13qcBrBbpuDdVXw6va+9p3PnLb0zTW/K35Ez0=@vger.kernel.org X-Gm-Message-State: APuU4Z8XAtvIHVXwDHTf4+umE3AKeVJ+p5Kc7zqxK2TGK+LpzYD+5OaQ 3hSGwKHBMsirWM/uwWx4+rAL3D/V+vjd/XduSqLnNCIosZv1zEjIiacq3NWO2RwO9M+i8SnfdNW y/8tMV1jgGj73LQ== X-Received: from wrvd9.prod.google.com ([2002:a5d:5389:0:b0:4a7:85c3:7bf9]) (user=jpiecuch job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2f84:b0:4a6:4f35:31fa with SMTP id ffacd0b85a97d-4abad5ac888mr68882681f8f.3.1796043207519; Mon, 30 Nov 2026 04:53:27 -0800 (PST) Date: Mon, 30 Nov 2026 12:53:26 +0000 In-Reply-To: <8e4043f995e96c0d4642287bc5009000@kernel.org> 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 References: <20261125153353.1364467-1-jpiecuch@google.com> <8e4043f995e96c0d4642287bc5009000@kernel.org> X-Mailer: git-send-email 2.56.1.839.g22a8290db9-goog Message-ID: <20261130125254.1864040-1-jpiecuch@google.com> Subject: Re: [RFC PATCHSET sched_ext/for-7.4-fixes] sched_ext: sub: Don't run ops.sub_caps_updated() in an SCX op context From: Kuba Piecuch To: Tejun Heo Cc: David Vernet , Andrea Righi , Changwoo Min , sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Hi Tejun, On Fri, 27 Nov 2026 15:43, Tejun Heo wrote: > The synchronous delivery is intentional. Once it's deferred, it becomes > unclear what happens when there are competing updates. > > ops.sub_caps_updated() is there only so that a sub-sched can propagate > grants and revokes to its own children. It isn't the place for any other > operation. ops.sub_ecaps_updated() is the one that reports a change once > it's in effect on the cpu and it runs with the rq locked, so anything > that acts on the caps, e.g. setting cpuperf, belongs there. > > All the listed failure modes are self-inflicted, e.g. a sub-sched calling > scx_bpf_cidperf_set() from ops.sub_caps_updated() or a parent granting > from ops.dump*(), and none of them is critical. Isn't this more of a > documentation problem than anything else? That makes sense, thanks for clarifying the intent. The doc comment on @sub_caps_updated in kernel/sched/ext/internal.h currently says "Delivered asynchronously after the change is recorded", which is easy to read as running in a separate unlocked context, and doesn't mention that it may run synchronously in the parent's grant/revoke context (inheriting whatever lock the parent holds) in addition to running unlocked. I'll drop this RFC and send a doc patch clarifying @sub_caps_updated (may run synchronously in the caller's locking context as well as unlocked, intended only for tracking caps and propagating grants/revokes, with cap-acting operations like scx_bpf_cidperf_set() belonging in ops.sub_ecaps_updated()). Let me know if you'd also want scx_kfunc_context_filter() to reject rq-lock-sensitive kfuncs from ops.sub_caps_updated() at load time, or if updating the doc comment is enough. Thanks, Kuba