From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (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 9FFD8C147 for ; Sun, 26 Jan 2025 10:16:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737886598; cv=none; b=H0RMboSQMYVxVqLSZyCkyZ6rm0VbhsnEHAqPf2hqLeF4Ub9oBei7x20DMovYeNrmpbYdSL2GRsLR34b6VYYeFSqiWlv7pjc7r9F+a1ScMhuHeRExqZ+OPQXoz9JIn3yFx3z+oHAimngaujUYqDIix5dTtxoTWYBkud2Rc1l3pWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737886598; c=relaxed/simple; bh=6r7piym0xzKY7ncXfVQK5xpduWySx2aHxJU4ek13Bpg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=b9xsuUADDL7pNltsOXoywtqvzCT8+LtWZwofpiG4t583dldotDCiypX06xqudoMrgC01wWP/SX8NQAP6VEuuXbszVDgTSrYIVm2B+6PMkrptlpVXO2q6RFOxA1kURrcewC0+aANqzVnfURnHB/Ni4t23EAL81O8v/28b5JE2FJo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=hIuc6+mp; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="hIuc6+mp" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=eqf3G3fTF0PKK3+orUS+hiRa8slR/i4PVrL8EMH4h2k=; b=hIuc6+mp2kHIXXwO0EdLJfSGlO o1XIP+gfFYZPF53oz9dYrIsxMqYX7Xw8yutLAXS//Hv6nXR5YP61qavvRmSxk7EljV/5q4hAQXeri 2d8/HTFI3JS9Q8UDKoB3RUoVOc7xFDnpJ3KIIMfk1AeyfTN5Tc96V+wCLPrp931PtDuWdA1NcNhz6 7CyM2uWQ16ZQkslp0Iz+QWTN1VUnnYG+IQr3ASxQT6KDZZanBZIESbSc7AndaKhuiXQg2JKcWgm5H +Ee8kCaOP98nkTc+IR9lo59TZO/DIAKBDSO4Ef7xsyYyEnV2kOzyvbnlmPJBI0Jf3QRfv4sUcSfPC 7SgYRYIw==; Received: from [58.29.143.236] (helo=localhost) by fanzine2.igalia.com with utf8esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1tbzgi-002lin-7I; Sun, 26 Jan 2025 11:16:20 +0100 From: Changwoo Min To: tj@kernel.org, void@manifault.com, arighi@nvidia.com Cc: kernel-dev@igalia.com, linux-kernel@vger.kernel.org, Changwoo Min Subject: [PATCH v2 00/11] sched_ext: Implement core event counters Date: Sun, 26 Jan 2025 19:16:03 +0900 Message-ID: <20250126101614.232388-1-changwoo@igalia.com> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The sched_ext core often has to override the BPF scheduler decisions, and some events could be interesting but not easily visible. This patchset aims to address such a problem in the following manner: - Introduce an infrastructure to collect such events in a scalable and extensible way and to expose the collected events to the BPF scheduler in a compatible way. - Define seven events to be collected. - Modify an scx scheduler to demonstrate the usage of the new BPF APIs. ChangeLog: v1 -> v2 - Rename scx_event_stat and scx_bpf_event_stat() to scx_event_stats and scx_bpf_event_stats(). - Rename event names following the convention of $COMPONENT_$EVENT. - Rename event_stats to event_stats_cpu. - Drop the enum scx_event_kind and related macros. - Revise scx_add_event() to use this_cpu_add(). - Add __scx_add_event() to use __this_cpu_add(). - Move the event counter resetting code to the loading of a BPF scheduler. - The bypass-related event is further categorized into three events: BYPASS_ACTIVATE, BYPASS_DISPATCH, and BYPASS_DURATION. - Revise SELECT_CPU_FALLBACK to capture the case of the chosen CPU is not allowed. - Move is_cpu_allowed() from core.c to sched.h to use in the SELECT_CPU_FALLBACK code. Changwoo Min (11): sched_ext: Implement event counter infrastructure sched: Move is_cpu_allowed() to the header sched_ext: Add an event, SELECT_CPU_FALLBACK sched_ext: Add an event, DISPATCH_LOCAL_DSQ_OFFLINE sched_ext: Add an event, DISPATCH_KEEP_LAST sched_ext: Add an event, ENQ_SKIP_EXITING sched_ext: Add an event, BYPASS_ACTIVATE sched_ext: Add an event, BYPASS_DISPATCH sched_ext: Add an event, BYPASS_DURATION sched_ext: Add scx_bpf_event_stats() and scx_read_event() for BPF schedulers sched_ext: Print core event count in scx_central scheduler kernel/sched/core.c | 30 ---- kernel/sched/ext.c | 177 ++++++++++++++++++++++- kernel/sched/sched.h | 30 ++++ tools/sched_ext/include/scx/common.bpf.h | 4 + tools/sched_ext/scx_central.bpf.c | 21 +++ 5 files changed, 231 insertions(+), 31 deletions(-) -- 2.48.1