Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38376934rwd; Wed, 12 Jul 2023 06:59:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlGEQWfCebq9z7ZNPg3LmJo2LU8PXW1fuBjXxrjUMvogc92wOWj+TDNvEyD14aHZDdoJvJKL X-Received: by 2002:a17:902:d345:b0:1b8:916a:4528 with SMTP id l5-20020a170902d34500b001b8916a4528mr14303865plk.61.1689170399442; Wed, 12 Jul 2023 06:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689170399; cv=none; d=google.com; s=arc-20160816; b=WCPSSXPGSLS/f4se0rSl49ANtH0AhFwUqRj3jUad8vyvv3jHdsLpEMOLIcxqauh/x5 zqP4PTmK82M8Iu5LM1CyWrfY7nUMsBE+Mj31jHRo9RBhFUnw96an17E9er0bj45aKk4+ nfcA30d1IWnILj2wneLZcUxyYeJx9n9FrO/9FXzQCM6I1BdTZshmkpZpw8YwWrxuMTa0 3uNMzpzDUWNTEzGZ86LBVIxIosUv++vINEpraG6vLvqqmQeYWH7ONSk2Om7mObH4l/Sy mjbJomJVQvJ+WKzT12vSkk0cfXd0yqt7rONiQKFtCIlSmdJUHMF4AzbuOqORk9Q1FaMX ZU4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=/+BMgRjOTldHQTLUN2Z6YfzMHpEjAjcj1ZG/dkzC7q0=; fh=kMd0nXNKwQY3d1x2aL3ywAG/KVvFx/Fir3qjeWT7iZA=; b=zc/LmbFA1xLaBhzLcUdJ7X3uklUm4ty6I/AwyRUsxsotcYHfMyYcvdaIApPUgkN1mp 04YtBorKa8Y3I30N83DL0cA6nMeTO3NcZVjhWaIaL6Jn1h7Y8xDz4ZU2pKZi03g0/eJf 5qrJiRm2DopPd9+86wI93B7i9NqvBtjFh3BtrXM6HwYI2As8jOQUkZ6C76AflVB8Z7b4 o8yBAF+6tLOX0DH1lvBHHex0JwG0wmF4nHvWz43KAnU2A8YCYy2DQjiuUnb5CXpZ6Lok hplEJcJB14ccpjsYOoANe2Um9GFcNnqg9xjI1HEsMtU6NE2dwOmRGO40upiOib91souf ZJiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MN15Df0b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a170903234800b001b569049666si3692660plh.617.2023.07.12.06.59.46; Wed, 12 Jul 2023 06:59:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MN15Df0b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230175AbjGLNh3 (ORCPT + 99 others); Wed, 12 Jul 2023 09:37:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjGLNh2 (ORCPT ); Wed, 12 Jul 2023 09:37:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A8FC19A6; Wed, 12 Jul 2023 06:37:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B919616E0; Wed, 12 Jul 2023 13:37:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE71CC433C8; Wed, 12 Jul 2023 13:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689169045; bh=saktDQrJAcRzBucPd3n2ys4LMtxAgDU0KwhhhQBghb0=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=MN15Df0bnq9YQ4diu5vzZ8Y/D0fHGWd02t+RGMGxS4xut8NkvGOfym177sV11l4D9 O8M30a2HMfFkE7P7+WpzaGlfslPgW9vlJbrqHLdkTH/j9vKBkbImKbFsRY21xjr6+b 3jPduJKs8U74gdLZzUABEGhIpXrvyC650smWQIwrGtii3q4DhVOojnayT3R7y24xb5 EuFOeGl/WJrkjmIbSMYMyvZ0kG9KLZ0ZXwbMT4BHA1XYyx76BaNN/A8UpJlpvXY0Xb z6UfCKqT7qKmTR53rBLPCvLlat+VvoMyeMeJh09319zeA0a70EDfTzzh3usNkoqYaU dMNp7Y0te+raA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 834A7CE0123; Wed, 12 Jul 2023 06:37:24 -0700 (PDT) Date: Wed, 12 Jul 2023 06:37:24 -0700 From: "Paul E. McKenney" To: "Jiri Slaby (SUSE)" Cc: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "David S. Miller" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Jason Wessel , Daniel Thompson , Douglas Anderson , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Subject: Re: [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8 Message-ID: Reply-To: paulmck@kernel.org References: <20230712081811.29004-1-jirislaby@kernel.org> <20230712081811.29004-3-jirislaby@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230712081811.29004-3-jirislaby@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 12, 2023 at 10:18:03AM +0200, Jiri Slaby (SUSE) wrote: > The passed parameter to sysrq handlers is a key (a character). So change > the type from 'int' to 'u8'. Let it specifically be 'u8' for two > reasons: > * unsigned: unsigned values come from the upper layers (devices) and the > tty layer assumes unsigned on most places, and > * 8-bit: as that what's supposed to be one day in all the layers built > on the top of tty. (Currently, we use mostly 'unsigned char' and > somewhere still only 'char'. (But that also translates to the former > thanks to -funsigned-char.)) > > Signed-off-by: Jiri Slaby (SUSE) > Cc: Richard Henderson > Cc: Ivan Kokshaysky > Cc: Matt Turner > Cc: Huacai Chen > Cc: WANG Xuerui > Cc: Thomas Bogendoerfer > Cc: Michael Ellerman > Cc: Nicholas Piggin > Cc: Christophe Leroy > Cc: "David S. Miller" > Cc: Maarten Lankhorst > Cc: Maxime Ripard > Cc: Thomas Zimmermann > Cc: David Airlie > Cc: Daniel Vetter > Cc: Jason Wessel > Cc: Daniel Thompson > Cc: Douglas Anderson > Cc: "Rafael J. Wysocki" > Cc: Len Brown > Cc: Pavel Machek > Cc: "Paul E. McKenney" > Cc: Frederic Weisbecker > Cc: Neeraj Upadhyay > Cc: Joel Fernandes > Cc: Josh Triplett > Cc: Boqun Feng > Cc: Steven Rostedt > Cc: Mathieu Desnoyers > Cc: Lai Jiangshan > Cc: Zqiang From an RCU perspective: Acked-by: Paul E. McKenney > --- > arch/alpha/kernel/setup.c | 2 +- > arch/loongarch/kernel/sysrq.c | 2 +- > arch/mips/kernel/sysrq.c | 2 +- > arch/powerpc/xmon/xmon.c | 2 +- > arch/sparc/kernel/process_64.c | 4 ++-- > drivers/gpu/drm/drm_fb_helper.c | 2 +- > drivers/tty/sysrq.c | 40 ++++++++++++++++----------------- > include/linux/sysrq.h | 2 +- > kernel/debug/debug_core.c | 2 +- > kernel/power/poweroff.c | 2 +- > kernel/rcu/tree_stall.h | 2 +- > 11 files changed, 31 insertions(+), 31 deletions(-) > > diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c > index b650ff1cb022..91fb3714ebc2 100644 > --- a/arch/alpha/kernel/setup.c > +++ b/arch/alpha/kernel/setup.c > @@ -422,7 +422,7 @@ register_cpus(void) > arch_initcall(register_cpus); > > #ifdef CONFIG_MAGIC_SYSRQ > -static void sysrq_reboot_handler(int unused) > +static void sysrq_reboot_handler(u8 unused) > { > machine_halt(); > } > diff --git a/arch/loongarch/kernel/sysrq.c b/arch/loongarch/kernel/sysrq.c > index 366baef72d29..e663c10fa39c 100644 > --- a/arch/loongarch/kernel/sysrq.c > +++ b/arch/loongarch/kernel/sysrq.c > @@ -43,7 +43,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy) > static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus); > #endif > > -static void sysrq_handle_tlbdump(int key) > +static void sysrq_handle_tlbdump(u8 key) > { > sysrq_tlbdump_single(NULL); > #ifdef CONFIG_SMP > diff --git a/arch/mips/kernel/sysrq.c b/arch/mips/kernel/sysrq.c > index 9c1a2019113b..2e98049fe783 100644 > --- a/arch/mips/kernel/sysrq.c > +++ b/arch/mips/kernel/sysrq.c > @@ -44,7 +44,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy) > static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus); > #endif > > -static void sysrq_handle_tlbdump(int key) > +static void sysrq_handle_tlbdump(u8 key) > { > sysrq_tlbdump_single(NULL); > #ifdef CONFIG_SMP > diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c > index ee17270d35d0..3b6f524c790e 100644 > --- a/arch/powerpc/xmon/xmon.c > +++ b/arch/powerpc/xmon/xmon.c > @@ -3991,7 +3991,7 @@ static void xmon_init(int enable) > } > > #ifdef CONFIG_MAGIC_SYSRQ > -static void sysrq_handle_xmon(int key) > +static void sysrq_handle_xmon(u8 key) > { > if (xmon_is_locked_down()) { > clear_all_bpt(); > diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c > index b51d8fb0ecdc..4dee88af403f 100644 > --- a/arch/sparc/kernel/process_64.c > +++ b/arch/sparc/kernel/process_64.c > @@ -295,7 +295,7 @@ void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self) > > #ifdef CONFIG_MAGIC_SYSRQ > > -static void sysrq_handle_globreg(int key) > +static void sysrq_handle_globreg(u8 key) > { > trigger_all_cpu_backtrace(); > } > @@ -370,7 +370,7 @@ static void pmu_snapshot_all_cpus(void) > spin_unlock_irqrestore(&global_cpu_snapshot_lock, flags); > } > > -static void sysrq_handle_globpmu(int key) > +static void sysrq_handle_globpmu(u8 key) > { > pmu_snapshot_all_cpus(); > } > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 61a5d450cc20..d612133e2cf7 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -301,7 +301,7 @@ static void drm_fb_helper_restore_work_fn(struct work_struct *ignored) > > static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn); > > -static void drm_fb_helper_sysrq(int dummy1) > +static void drm_fb_helper_sysrq(u8 dummy1) > { > schedule_work(&drm_fb_helper_restore_work); > } > diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c > index 13465e4cca9b..1271a82c0887 100644 > --- a/drivers/tty/sysrq.c > +++ b/drivers/tty/sysrq.c > @@ -98,7 +98,7 @@ static int __init sysrq_always_enabled_setup(char *str) > __setup("sysrq_always_enabled", sysrq_always_enabled_setup); > > > -static void sysrq_handle_loglevel(int key) > +static void sysrq_handle_loglevel(u8 key) > { > u8 loglevel = key - '0'; > > @@ -114,7 +114,7 @@ static const struct sysrq_key_op sysrq_loglevel_op = { > }; > > #ifdef CONFIG_VT > -static void sysrq_handle_SAK(int key) > +static void sysrq_handle_SAK(u8 key) > { > struct work_struct *SAK_work = &vc_cons[fg_console].SAK_work; > > @@ -131,7 +131,7 @@ static const struct sysrq_key_op sysrq_SAK_op = { > #endif > > #ifdef CONFIG_VT > -static void sysrq_handle_unraw(int key) > +static void sysrq_handle_unraw(u8 key) > { > vt_reset_unicode(fg_console); > } > @@ -146,7 +146,7 @@ static const struct sysrq_key_op sysrq_unraw_op = { > #define sysrq_unraw_op (*(const struct sysrq_key_op *)NULL) > #endif /* CONFIG_VT */ > > -static void sysrq_handle_crash(int key) > +static void sysrq_handle_crash(u8 key) > { > /* release the RCU read lock before crashing */ > rcu_read_unlock(); > @@ -160,7 +160,7 @@ static const struct sysrq_key_op sysrq_crash_op = { > .enable_mask = SYSRQ_ENABLE_DUMP, > }; > > -static void sysrq_handle_reboot(int key) > +static void sysrq_handle_reboot(u8 key) > { > lockdep_off(); > local_irq_enable(); > @@ -175,7 +175,7 @@ static const struct sysrq_key_op sysrq_reboot_op = { > > const struct sysrq_key_op *__sysrq_reboot_op = &sysrq_reboot_op; > > -static void sysrq_handle_sync(int key) > +static void sysrq_handle_sync(u8 key) > { > emergency_sync(); > } > @@ -186,7 +186,7 @@ static const struct sysrq_key_op sysrq_sync_op = { > .enable_mask = SYSRQ_ENABLE_SYNC, > }; > > -static void sysrq_handle_show_timers(int key) > +static void sysrq_handle_show_timers(u8 key) > { > sysrq_timer_list_show(); > } > @@ -197,7 +197,7 @@ static const struct sysrq_key_op sysrq_show_timers_op = { > .action_msg = "Show clockevent devices & pending hrtimers (no others)", > }; > > -static void sysrq_handle_mountro(int key) > +static void sysrq_handle_mountro(u8 key) > { > emergency_remount(); > } > @@ -209,7 +209,7 @@ static const struct sysrq_key_op sysrq_mountro_op = { > }; > > #ifdef CONFIG_LOCKDEP > -static void sysrq_handle_showlocks(int key) > +static void sysrq_handle_showlocks(u8 key) > { > debug_show_all_locks(); > } > @@ -249,7 +249,7 @@ static void sysrq_showregs_othercpus(struct work_struct *dummy) > > static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus); > > -static void sysrq_handle_showallcpus(int key) > +static void sysrq_handle_showallcpus(u8 key) > { > /* > * Fall back to the workqueue based printing if the > @@ -282,7 +282,7 @@ static const struct sysrq_key_op sysrq_showallcpus_op = { > #define sysrq_showallcpus_op (*(const struct sysrq_key_op *)NULL) > #endif > > -static void sysrq_handle_showregs(int key) > +static void sysrq_handle_showregs(u8 key) > { > struct pt_regs *regs = NULL; > > @@ -299,7 +299,7 @@ static const struct sysrq_key_op sysrq_showregs_op = { > .enable_mask = SYSRQ_ENABLE_DUMP, > }; > > -static void sysrq_handle_showstate(int key) > +static void sysrq_handle_showstate(u8 key) > { > show_state(); > show_all_workqueues(); > @@ -311,7 +311,7 @@ static const struct sysrq_key_op sysrq_showstate_op = { > .enable_mask = SYSRQ_ENABLE_DUMP, > }; > > -static void sysrq_handle_showstate_blocked(int key) > +static void sysrq_handle_showstate_blocked(u8 key) > { > show_state_filter(TASK_UNINTERRUPTIBLE); > } > @@ -325,7 +325,7 @@ static const struct sysrq_key_op sysrq_showstate_blocked_op = { > #ifdef CONFIG_TRACING > #include > > -static void sysrq_ftrace_dump(int key) > +static void sysrq_ftrace_dump(u8 key) > { > ftrace_dump(DUMP_ALL); > } > @@ -339,7 +339,7 @@ static const struct sysrq_key_op sysrq_ftrace_dump_op = { > #define sysrq_ftrace_dump_op (*(const struct sysrq_key_op *)NULL) > #endif > > -static void sysrq_handle_showmem(int key) > +static void sysrq_handle_showmem(u8 key) > { > show_mem(); > } > @@ -369,7 +369,7 @@ static void send_sig_all(int sig) > read_unlock(&tasklist_lock); > } > > -static void sysrq_handle_term(int key) > +static void sysrq_handle_term(u8 key) > { > send_sig_all(SIGTERM); > console_loglevel = CONSOLE_LOGLEVEL_DEBUG; > @@ -400,7 +400,7 @@ static void moom_callback(struct work_struct *ignored) > > static DECLARE_WORK(moom_work, moom_callback); > > -static void sysrq_handle_moom(int key) > +static void sysrq_handle_moom(u8 key) > { > schedule_work(&moom_work); > } > @@ -412,7 +412,7 @@ static const struct sysrq_key_op sysrq_moom_op = { > }; > > #ifdef CONFIG_BLOCK > -static void sysrq_handle_thaw(int key) > +static void sysrq_handle_thaw(u8 key) > { > emergency_thaw_all(); > } > @@ -426,7 +426,7 @@ static const struct sysrq_key_op sysrq_thaw_op = { > #define sysrq_thaw_op (*(const struct sysrq_key_op *)NULL) > #endif > > -static void sysrq_handle_kill(int key) > +static void sysrq_handle_kill(u8 key) > { > send_sig_all(SIGKILL); > console_loglevel = CONSOLE_LOGLEVEL_DEBUG; > @@ -438,7 +438,7 @@ static const struct sysrq_key_op sysrq_kill_op = { > .enable_mask = SYSRQ_ENABLE_SIGNAL, > }; > > -static void sysrq_handle_unrt(int key) > +static void sysrq_handle_unrt(u8 key) > { > normalize_rt_tasks(); > } > diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h > index 3a582ec7a2f1..bb8d07814b0e 100644 > --- a/include/linux/sysrq.h > +++ b/include/linux/sysrq.h > @@ -30,7 +30,7 @@ > #define SYSRQ_ENABLE_RTNICE 0x0100 > > struct sysrq_key_op { > - void (* const handler)(int); > + void (* const handler)(u8); > const char * const help_msg; > const char * const action_msg; > const int enable_mask; > diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c > index d5e9ccde3ab8..621037a0aa87 100644 > --- a/kernel/debug/debug_core.c > +++ b/kernel/debug/debug_core.c > @@ -968,7 +968,7 @@ static int __init opt_kgdb_con(char *str) > early_param("kgdbcon", opt_kgdb_con); > > #ifdef CONFIG_MAGIC_SYSRQ > -static void sysrq_handle_dbg(int key) > +static void sysrq_handle_dbg(u8 key) > { > if (!dbg_io_ops) { > pr_crit("ERROR: No KGDB I/O module available\n"); > diff --git a/kernel/power/poweroff.c b/kernel/power/poweroff.c > index 562aa0e450ed..1f306f158696 100644 > --- a/kernel/power/poweroff.c > +++ b/kernel/power/poweroff.c > @@ -23,7 +23,7 @@ static void do_poweroff(struct work_struct *dummy) > > static DECLARE_WORK(poweroff_work, do_poweroff); > > -static void handle_poweroff(int key) > +static void handle_poweroff(u8 key) > { > /* run sysrq poweroff on boot cpu */ > schedule_work_on(cpumask_first(cpu_online_mask), &poweroff_work); > diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h > index b10b8349bb2a..6f06dc12904a 100644 > --- a/kernel/rcu/tree_stall.h > +++ b/kernel/rcu/tree_stall.h > @@ -1035,7 +1035,7 @@ static bool sysrq_rcu; > module_param(sysrq_rcu, bool, 0444); > > /* Dump grace-period-request information due to commandeered sysrq. */ > -static void sysrq_show_rcu(int key) > +static void sysrq_show_rcu(u8 key) > { > show_rcu_gp_kthreads(); > } > -- > 2.41.0 >