From nobody Tue Nov 26 04:14:25 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 EB77A1E7677; Mon, 21 Oct 2024 15:13:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729523590; cv=none; b=VcUQVDVG8se3ioYWe844CsxPhiAsbAj4chS6VX6Vv5vV8lJ7N5Ib8lujzFLpj2lx+EC2JNUoS4XgPR+PYp3slQ/w+F4rw5nyUN8cyW2mPDbNhUOsmuS9yQe7q/GfYMjVspUtxNWvvQilwAMYZiqwl5VUvMJSxzd8RPKUNuDxxk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729523590; c=relaxed/simple; bh=5P2NQ2LTGqAw9tTdB+yi629BK+jCITFq2F+INjGiWE0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oU1aqxQ4M30/dLamIV26sXaDIQRnk/oUxmTPzpfLQ43MOsM2OIabf8bNTcKEEUjXADb1I5gAo8KY4Q3+ZBxiEXl1CDvIJ2I61MfbUwtZTHQfsVqOLAXl3ArfzJMswcuM9mcN0+p/aYQTL0JO4TnEpdpsh+htSjxjrsG5oSec6BY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=aqz0JA1e; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Bt0EUuMo; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="aqz0JA1e"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Bt0EUuMo" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1729523587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4mJYXpgOv9Nb7Ka4YZwNzbNkv6qUKCXI6IA+AOiHpw0=; b=aqz0JA1e6EeyFYhZrVsWivhxlRtoaOJPvtOlZgPaez4aAgYGdKbf+VtkSIlB4x0yt630Qr 8KJuyBA5pIpIZa8ik9mXHddNUJFU68vUETZpzgUTPv+QaijhRp2+Bd5TnD2uVs+gBpo6Gr WqgkAWYXLwVxRTVvCTjo7n5MpytrngZyNnHhnPBZR+1PcsDagkpj3iNObLuhIya609Rs5h 3uHPkpHLZKUoJ/g2Yy2XAbn83lUFRXJ2G9yrLgHZoM2jPfhWox1Pjl+SdAeozWAyIr2MzL 18+ZCEpeBY6kcFuzGIgyQlpaG0ya5rjZc4PvkgUw6HB4aAaiToqFkd8WcwfiLA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1729523587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4mJYXpgOv9Nb7Ka4YZwNzbNkv6qUKCXI6IA+AOiHpw0=; b=Bt0EUuMo3fNCd6WivN40VtziHpHTDLxPNT8znL9fd6ifNCCpdgyFgUGoMWN4sscs6wdb7Q K5fX91JEUfMNaKDw== To: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Peter Zijlstra , tglx@linutronix.de, mingo@kernel.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, ankur.a.arora@oracle.com, efault@gmx.de, Masami Hiramatsu , Mathieu Desnoyers , Sebastian Andrzej Siewior Subject: [PATCH v2 1/3] tracing: Replace TRACE_FLAG_IRQS_NOSUPPORT with its config option. Date: Mon, 21 Oct 2024 17:08:40 +0200 Message-ID: <20241021151257.102296-2-bigeasy@linutronix.de> In-Reply-To: <20241021151257.102296-1-bigeasy@linutronix.de> References: <20241021151257.102296-1-bigeasy@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner The TRACE_FLAG_IRQS_NOSUPPORT flag is used by tracing_gen_ctx.*() to signal that CONFIG_TRACE_IRQFLAGS_SUPPORT is not enabled and tracing IRQ flags is not supported. This could be replaced by using the 0 as flags and then deducting that there is no IRQFLAGS_SUPPORT based on the config option. The downside is that without CONFIG_TRACE_IRQFLAGS_SUPPORT we can not distinguish between no-IRQ passed flags and callers which passed 0. On the upside we have room for one additional flags which could be used for LAZY_PREEMPTION. Remove TRACE_FLAG_IRQS_NOSUPPORT and set it flags are 0 and CONFIG_TRACE_IRQFLAGS_SUPPORT is not set. [bigeasy: Commit descrption.] Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior --- include/linux/trace_events.h | 7 +++---- kernel/trace/trace_output.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -184,8 +184,7 @@ unsigned int tracing_gen_ctx_irq_test(un =20 enum trace_flag_type { TRACE_FLAG_IRQS_OFF =3D 0x01, - TRACE_FLAG_IRQS_NOSUPPORT =3D 0x02, - TRACE_FLAG_NEED_RESCHED =3D 0x04, + TRACE_FLAG_NEED_RESCHED =3D 0x02, TRACE_FLAG_HARDIRQ =3D 0x08, TRACE_FLAG_SOFTIRQ =3D 0x10, TRACE_FLAG_PREEMPT_RESCHED =3D 0x20, @@ -211,11 +210,11 @@ static inline unsigned int tracing_gen_c =20 static inline unsigned int tracing_gen_ctx_flags(unsigned long irqflags) { - return tracing_gen_ctx_irq_test(TRACE_FLAG_IRQS_NOSUPPORT); + return tracing_gen_ctx_irq_test(0); } static inline unsigned int tracing_gen_ctx(void) { - return tracing_gen_ctx_irq_test(TRACE_FLAG_IRQS_NOSUPPORT); + return tracing_gen_ctx_irq_test(0); } #endif =20 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -460,7 +460,7 @@ int trace_print_lat_fmt(struct trace_seq (entry->flags & TRACE_FLAG_IRQS_OFF && bh_off) ? 'D' : (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' : bh_off ? 'b' : - (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ? 'X' : + !IS_ENABLED(CONFIG_TRACE_IRQFLAGS_SUPPORT) ? 'X' : '.'; =20 switch (entry->flags & (TRACE_FLAG_NEED_RESCHED | From nobody Tue Nov 26 04:14:25 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 AA7731FAC3B; Mon, 21 Oct 2024 15:13:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729523595; cv=none; b=pTY/KacfYdzctliPY0ZffwmDD6iR6q1lsB+wwAChABJZc3+EFlB5eYBjlES/rxhQnsdxiBwLrDc+fKjBZwWjgu4HQpPs19vecHtcHhQ6mtPIL8hEibo9FgXTl+d5mnx0oPXOvR8XueMZ08jcJTS0FQ5Mnuffo3ub3fJnYynmzFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729523595; c=relaxed/simple; bh=QjIvZlCtVBiBsmsnr8cISyDYLEv8628810IVww1WNSg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L4LspOB1TaSomrWA4IBdgN4kgl/dx7bqWPV1ZxZ6S8yHCDWv0cqzgzyN4/Z4CSW6ME4Ze+PoyJGFcHAbS+lMXSVbwNXByWu6Ek/q0QXrgqBXC9n3ci8097HF/adwxRDIvrMxTfhEj+nUuE9wIw5JgEK8uIYXwPUnp3kjAohTenc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0HF2jZDA; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=WeY5DLKy; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0HF2jZDA"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="WeY5DLKy" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1729523587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HaEaP85s+bDV/FR3UNIae3NhDHTKAM5R8mgLmDl9h4A=; b=0HF2jZDAXbmVVSgQ6C909u3k9wAUIjb5QwKmPFALR1hwemXqQft7BwtjujT4D1xRW460GW uwiJ5fGXhxuNtxopfV+jG//m2aUk6ugATphTWuvJ8Q69NVo0nFJ3BULKvcghCV7v8Dl5Jq Q9LlejV0LMuU7kuGyMxDs48z1UrkfVKkGnrtoH25+HWx7VuOlF++AMp/EuKINMQTqmgcbR dx43OP5ikRlFIc03+PBTulOLqUt6zssS7XGfpGW4rmRHK2VKN5yn64FJWjYQ7Fo2KvBwV9 7WO2D4F2jDtuUIouWHi4jRhw2Hefs+ThkR4ukmUT8zBvABStt2ICTXiOotTKdA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1729523587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HaEaP85s+bDV/FR3UNIae3NhDHTKAM5R8mgLmDl9h4A=; b=WeY5DLKyyb2I3Br33YRRtuMkTu3/UaKNldq7aX4F8R4F7RrE1hS+3GyQJaTrmHX8H0HGhP 58by9NFPNJIm1mCw== To: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Peter Zijlstra , tglx@linutronix.de, mingo@kernel.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, ankur.a.arora@oracle.com, efault@gmx.de, Masami Hiramatsu , Mathieu Desnoyers , Sebastian Andrzej Siewior Subject: [PATCH v2 2/3] tracing: Record task flag NEED_RESCHED_LAZY. Date: Mon, 21 Oct 2024 17:08:41 +0200 Message-ID: <20241021151257.102296-3-bigeasy@linutronix.de> In-Reply-To: <20241021151257.102296-1-bigeasy@linutronix.de> References: <20241021151257.102296-1-bigeasy@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner The scheduler added NEED_RESCHED_LAZY scheduling. Record this state as part of trace flags and expose it in the need_resched field. Record and expose NEED_RESCHED_LAZY. [bigeasy: Commit description, documentation bits.] Reviewed-by: Ankur Arora Reviewed-by: Steven Rostedt (Google) Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior --- Documentation/trace/ftrace.rst | 4 ++++ include/linux/trace_events.h | 1 + kernel/trace/trace.c | 2 ++ kernel/trace/trace_output.c | 14 +++++++++++++- 4 files changed, 20 insertions(+), 1 deletion(-) --- a/Documentation/trace/ftrace.rst +++ b/Documentation/trace/ftrace.rst @@ -1036,9 +1036,13 @@ explains which is which. be printed here. =20 need-resched: + - 'B' all, TIF_NEED_RESCHED, PREEMPT_NEED_RESCHED and TIF_RESCHED_LAZY is= set, - 'N' both TIF_NEED_RESCHED and PREEMPT_NEED_RESCHED is set, - 'n' only TIF_NEED_RESCHED is set, - 'p' only PREEMPT_NEED_RESCHED is set, + - 'L' borg PREEMPT_NEED_RESCHED and TIF_RESCHED_LAZY is set, + - 'b' borg TIF_NEED_RESCHED and TIF_RESCHED_LAZY is set, + - 'l' only TIF_RESCHED_LAZY is set - '.' otherwise. =20 hardirq/softirq: --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -185,6 +185,7 @@ unsigned int tracing_gen_ctx_irq_test(un enum trace_flag_type { TRACE_FLAG_IRQS_OFF =3D 0x01, TRACE_FLAG_NEED_RESCHED =3D 0x02, + TRACE_FLAG_NEED_RESCHED_LAZY =3D 0x04, TRACE_FLAG_HARDIRQ =3D 0x08, TRACE_FLAG_SOFTIRQ =3D 0x10, TRACE_FLAG_PREEMPT_RESCHED =3D 0x20, --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2544,6 +2544,8 @@ unsigned int tracing_gen_ctx_irq_test(un trace_flags |=3D TRACE_FLAG_NEED_RESCHED; if (test_preempt_need_resched()) trace_flags |=3D TRACE_FLAG_PREEMPT_RESCHED; + if (IS_ENABLED(CONFIG_ARCH_HAS_PREEMPT_LAZY) && tif_test_bit(TIF_NEED_RES= CHED_LAZY)) + trace_flags |=3D TRACE_FLAG_NEED_RESCHED_LAZY; return (trace_flags << 16) | (min_t(unsigned int, pc & 0xff, 0xf)) | (min_t(unsigned int, migration_disable_value(), 0xf)) << 4; } --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -463,17 +463,29 @@ int trace_print_lat_fmt(struct trace_seq !IS_ENABLED(CONFIG_TRACE_IRQFLAGS_SUPPORT) ? 'X' : '.'; =20 - switch (entry->flags & (TRACE_FLAG_NEED_RESCHED | + switch (entry->flags & (TRACE_FLAG_NEED_RESCHED | TRACE_FLAG_NEED_RESCHED= _LAZY | TRACE_FLAG_PREEMPT_RESCHED)) { + case TRACE_FLAG_NEED_RESCHED | TRACE_FLAG_NEED_RESCHED_LAZY | TRACE_FLAG_= PREEMPT_RESCHED: + need_resched =3D 'B'; + break; case TRACE_FLAG_NEED_RESCHED | TRACE_FLAG_PREEMPT_RESCHED: need_resched =3D 'N'; break; + case TRACE_FLAG_NEED_RESCHED_LAZY | TRACE_FLAG_PREEMPT_RESCHED: + need_resched =3D 'L'; + break; + case TRACE_FLAG_NEED_RESCHED | TRACE_FLAG_NEED_RESCHED_LAZY: + need_resched =3D 'b'; + break; case TRACE_FLAG_NEED_RESCHED: need_resched =3D 'n'; break; case TRACE_FLAG_PREEMPT_RESCHED: need_resched =3D 'p'; break; + case TRACE_FLAG_NEED_RESCHED_LAZY: + need_resched =3D 'l'; + break; default: need_resched =3D '.'; break; From nobody Tue Nov 26 04:14:25 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 EA63B1F8F01; Mon, 21 Oct 2024 15:13:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729523591; cv=none; b=aMZRHCBm2enSJdpQuYspHXyZ3d9u5ITILp6lj5ZeW/JZD7lTwhUYdMaaZbFRlMGcCCe9Nl8BNKgrP2h3udQuVygvc45PMIg+Th2eBtwb0HAZECVMHyJLHtLJa3VMB0LlMARoCDkTfgd6wtcZhhabUATHRJohTLR+nFKfWj2/eck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729523591; c=relaxed/simple; bh=BmrD8P4kXmBSUNzxpOCTHa+WLE1X2hgSlmmP/4vpiCI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KiIzF9yz9Vt+Vkja9DLoryCR3WUzBlPGUj53+HgK+ohJvzsv7iFe6q0zneXzreC2chW+xS0qlsNtyZG8JDKPOP6xbQEXR2FN98JVOEJRqbj4muQFINnsSepEyADoXbK6TFloRou8NFN0dk8scYFhkztWtqMadBa0QaO5EyvcVok= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Qo4c5rWq; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=m7Fec6Zk; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Qo4c5rWq"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="m7Fec6Zk" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1729523588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MGvx53aEC/g+kE5bhkxfRgADXQtsPpYeRVLsbQC037o=; b=Qo4c5rWqFncDfIbbuRC+Rp8DCxZPp4zNxCLSeKpYH5oM7Ypt0+6Htig1f5MI5lZgbFRJ69 jmx9PJGF5aVLUBLPeO6nSlhGH/N8eq9JOiIOZiJAAKYbp5TPY7EBj7Chm9lhWNtVPLGqPp cEFb4HwUFwNP5nvTJG9ev3iENNOXv6Pi3VbL9snAz7BkRWY8Uhzc9f8MbsiRm+iD7Txeqx hGaejPBD5Mhz9UXovZLdy/EefnHYxc9gS9CvP5dUrpp7ktrFHS2LKhJ9xY/++TnyPXWTY7 B0TYwV9MIcdjbRW1vzG9+Lx/QMd21JM/eiUEmJyI5UkiGBOKULLgSzA3Nxf6/g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1729523588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MGvx53aEC/g+kE5bhkxfRgADXQtsPpYeRVLsbQC037o=; b=m7Fec6ZkmVQBTktBv5fQBVY1iDAxg54fWHlXfckdwPEpA24GJPlUy//0eBSeJDfODgj6uV uKtWzlapiB9DIICQ== To: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Peter Zijlstra , tglx@linutronix.de, mingo@kernel.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, ankur.a.arora@oracle.com, efault@gmx.de, Masami Hiramatsu , Mathieu Desnoyers , Jisheng Zhang , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, Palmer Dabbelt , Sebastian Andrzej Siewior Subject: [PATCH v2 3/3] riscv: add PREEMPT_LAZY support Date: Mon, 21 Oct 2024 17:08:42 +0200 Message-ID: <20241021151257.102296-4-bigeasy@linutronix.de> In-Reply-To: <20241021151257.102296-1-bigeasy@linutronix.de> References: <20241021151257.102296-1-bigeasy@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jisheng Zhang riscv has switched to GENERIC_ENTRY, so adding PREEMPT_LAZY is as simple as adding TIF_NEED_RESCHED_LAZY related definitions and enabling ARCH_HAS_PREEMPT_LAZY. [bigeasy: Replace old PREEMPT_AUTO bits with new PREEMPT_LAZY ] Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Albert Ou Cc: linux-riscv@lists.infradead.org Acked-by: Palmer Dabbelt Signed-off-by: Jisheng Zhang Signed-off-by: Sebastian Andrzej Siewior --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/thread_info.h | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -39,6 +39,7 @@ config RISCV select ARCH_HAS_MMIOWB select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE select ARCH_HAS_PMEM_API + select ARCH_HAS_PREEMPT_LAZY select ARCH_HAS_PREPARE_SYNC_CORE_CMD select ARCH_HAS_PTE_DEVMAP if 64BIT && MMU select ARCH_HAS_PTE_SPECIAL --- a/arch/riscv/include/asm/thread_info.h +++ b/arch/riscv/include/asm/thread_info.h @@ -107,9 +107,10 @@ int arch_dup_task_struct(struct task_str * - pending work-to-be-done flags are in lowest half-word * - other flags in upper half-word(s) */ -#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ -#define TIF_SIGPENDING 2 /* signal pending */ -#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ +#define TIF_NEED_RESCHED 0 /* rescheduling necessary */ +#define TIF_NEED_RESCHED_LAZY 1 /* Lazy rescheduling needed */ +#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ +#define TIF_SIGPENDING 3 /* signal pending */ #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ #define TIF_NOTIFY_SIGNAL 9 /* signal notifications exist */ @@ -117,9 +118,10 @@ int arch_dup_task_struct(struct task_str #define TIF_32BIT 11 /* compat-mode 32bit process */ #define TIF_RISCV_V_DEFER_RESTORE 12 /* restore Vector before returing to = user */ =20 +#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) +#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) -#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) #define _TIF_UPROBE (1 << TIF_UPROBE) #define _TIF_RISCV_V_DEFER_RESTORE (1 << TIF_RISCV_V_DEFER_RESTORE)