From nobody Wed Apr 8 06:10:14 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 DB81F334C0C for ; Wed, 29 Oct 2025 11:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736378; cv=none; b=fXDTNtShrVg7/GlgsZZouGYIQBkuDLDUO3slyrE0uq0Oq9/10dP0R5HBAaplY0ndHJJ9bG829+RUS2MxUzJ/ZwRSBn6vPYOuBU28P+zCRsvWxorZJX2LBkYJe6cv/zVbnqfvxYkZsaifq5wTLohXV8pTM3VnxQEWqncrki7B0gM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736378; c=relaxed/simple; bh=CiKEL/wCcq8DeD8AleLPUan6BOR3bpukhekSM08MLL0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=flD5dDrxo0zfP99sEM6kHg4/FooQy1XFo9AoB936tyw76s4wUrc87rhwfHbbgX5/OYPP8LWhlXqmYNG7zV0z2v6gJUpPyNXvLIOXjb4aTOUtpvGpiP1y/bK02tVaNvKBawFtIkvhcaYg/iJpd3ilmp3zzsARFak467Xux5017FY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SgS1t0d2; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SgS1t0d2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761736377; x=1793272377; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CiKEL/wCcq8DeD8AleLPUan6BOR3bpukhekSM08MLL0=; b=SgS1t0d2NPucefSqPBmyJd+B/uVePejGBy09hthI12yT3cI+UW/RV4dy P+WA3iEch0vzBTL7jAn9HZwZYjBYLuCUr3UjSCJi2pdZLLO4gxDZyrzu7 9McYF8IMR+tp3KSetXNQP1kuN5QRHmH7D/wtP2xMrFu3GpsONpsnQQiTM NKO/mgX2BxqEoxBF8LqnZwkLbFYLbfxcOZPMS5wVTs72uyFPWEO/u96Au ziPxzfe1qTM5SlEA+ZfL7QmZA73p47EvhHg8Gw5fzAW+UwUKHxf4do/SG Lfxio7ty3R34TNR79hEvn5lHw012/c+h58mNRBDn8/Z50eNLm6J72yw5d g==; X-CSE-ConnectionGUID: XTDSF0nSQCSPztGQP0Zubg== X-CSE-MsgGUID: /Le7D6WUT2K3QydIG4q2Og== X-IronPort-AV: E=McAfee;i="6800,10657,11596"; a="74971497" X-IronPort-AV: E=Sophos;i="6.19,263,1754982000"; d="scan'208";a="74971497" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2025 04:12:43 -0700 X-CSE-ConnectionGUID: PuzGh4FeTsKEehnlDaHBFw== X-CSE-MsgGUID: AUdA28kdQrSU7u8NxPoR7A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,263,1754982000"; d="scan'208";a="185324851" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa007.fm.intel.com with ESMTP; 29 Oct 2025 04:12:40 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id DD0D496; Wed, 29 Oct 2025 12:12:39 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton , Petr Mladek Subject: [PATCH v2 1/6] panic: sys_info: Capture si_bits_global before iterating over it Date: Wed, 29 Oct 2025 12:07:36 +0100 Message-ID: <20251029111202.3217870-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> References: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> 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" The for-loop might re-read the content of the memory the si_bits_global points to on each iteration. Instead, just capture it for the sake of consistency and use that instead. Signed-off-by: Andy Shevchenko Reviewed-by: Feng Tang --- lib/sys_info.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/sys_info.c b/lib/sys_info.c index 496f9151c9b6..d542a024406a 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -58,11 +58,11 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_= table, int write, char names[sizeof(sys_info_avail)]; struct ctl_table table; unsigned long *si_bits_global; + unsigned long si_bits; =20 si_bits_global =3D ro_table->data; =20 if (write) { - unsigned long si_bits; int ret; =20 table =3D *ro_table; @@ -81,9 +81,12 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_t= able, int write, char *delim =3D ""; int i, len =3D 0; =20 + /* The access to the global value is not synchronized. */ + si_bits =3D READ_ONCE(*si_bits_global); + names[0] =3D '\0'; for (i =3D 0; i < ARRAY_SIZE(si_names); i++) { - if (*si_bits_global & si_names[i].bit) { + if (si_bits & si_names[i].bit) { len +=3D scnprintf(names + len, sizeof(names) - len, "%s%s", delim, si_names[i].name); delim =3D ","; --=20 2.50.1 From nobody Wed Apr 8 06:10:14 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 8DE442E040E for ; Wed, 29 Oct 2025 11:12:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736364; cv=none; b=QDm2kgkxcauTlslTqtXQ7V6r6Y9lAmLIDZ2Hkks99JBFSREPAcJYaHMvPkZAsvWF9ZmVgB+VAIBunFv5xgl50WfUTwwzqtqufPbTPlW9rITS5Ru1j3DEx4Ujlu/b41JYn820baG63K59RdBpQVzEf0Lz5smpWJhI88qyGpPSC0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736364; c=relaxed/simple; bh=uQkYVjDvlVcr5YXNo0uHdMAjbvEtqiEjOVaLBOSYEAA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QbHv8WddVX6I9e+u2EuxeVMjzzjURS4wFom+olrVIoHuR45xpwMZizgBW7LT0fX+La32JBRakSqgAWZOayW4JFdGOWEnKXa6I/HzpYUpFnSi01TZ/0eb1BJW36epXhzw9byl56aSyroGHbl2rsSbOnQGA6alZ6Sh0XXOFHcTNgM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ha/lOF8l; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ha/lOF8l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761736363; x=1793272363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uQkYVjDvlVcr5YXNo0uHdMAjbvEtqiEjOVaLBOSYEAA=; b=Ha/lOF8lzG1jsIkcHWhHW9TWNq3i7aM49aNQsqD76+ggvNiNR+HOyWFz Ej7ljyb48Ken0I/29451p6yVp1lwl9q4v9Qz3E5XEC1sdfxSwXJlN/6/y GjZNOydpQahRmnU7Orx4hhk6ZmnIVYCJ0/Z2tIhyQM+KxZIDzDyP/5jJf Kfx4Bx7j/jxjkjk7bsmdkppXkCzvEJavotPCldDJOprVYkwiErowF5hvB UrQY1elaA87rRlsBl7Hp8Eda10yzqFe1gwsyJrGSWt1g3KxAMcl5m9ErI NPBRNy/6oPag3Npoos5sOD2emlDdFbBgIrEYVRnXLqA06hf6949C//hSV Q==; X-CSE-ConnectionGUID: Gjo2mMbhSICJ78r+cRRmLA== X-CSE-MsgGUID: 7du/5QKGR32teefbW6y9TA== X-IronPort-AV: E=McAfee;i="6800,10657,11596"; a="63949446" X-IronPort-AV: E=Sophos;i="6.19,263,1754982000"; d="scan'208";a="63949446" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2025 04:12:42 -0700 X-CSE-ConnectionGUID: XYrDMqnlTqus2SqonZ4QRw== X-CSE-MsgGUID: korAJy0QRd+qT2c7gkl5Zg== X-ExtLoop1: 1 Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa003.fm.intel.com with ESMTP; 29 Oct 2025 04:12:40 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id E135297; Wed, 29 Oct 2025 12:12:39 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton , Petr Mladek Subject: [PATCH v2 2/6] panic: sys_info: Align constant definition names with parameters Date: Wed, 29 Oct 2025 12:07:37 +0100 Message-ID: <20251029111202.3217870-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> References: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> 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" Align constant definition names with parameters to make it easier to map. It's also better to maintain and extend the names while keeping their uniqueness. Signed-off-by: Andy Shevchenko Reviewed-by: Feng Tang --- include/linux/sys_info.h | 2 +- kernel/panic.c | 2 +- lib/sys_info.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/sys_info.h b/include/linux/sys_info.h index 89d77dc4f2ed..a5bc3ea3d44b 100644 --- a/include/linux/sys_info.h +++ b/include/linux/sys_info.h @@ -14,7 +14,7 @@ #define SYS_INFO_LOCKS 0x00000008 #define SYS_INFO_FTRACE 0x00000010 #define SYS_INFO_PANIC_CONSOLE_REPLAY 0x00000020 -#define SYS_INFO_ALL_CPU_BT 0x00000040 +#define SYS_INFO_ALL_BT 0x00000040 #define SYS_INFO_BLOCKED_TASKS 0x00000080 =20 void sys_info(unsigned long si_mask); diff --git a/kernel/panic.c b/kernel/panic.c index 341c66948dcb..0d52210a9e2b 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -401,7 +401,7 @@ static void panic_trigger_all_cpu_backtrace(void) */ static void panic_other_cpus_shutdown(bool crash_kexec) { - if (panic_print & SYS_INFO_ALL_CPU_BT) + if (panic_print & SYS_INFO_ALL_BT) panic_trigger_all_cpu_backtrace(); =20 /* diff --git a/lib/sys_info.c b/lib/sys_info.c index d542a024406a..6b0188b30227 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -23,7 +23,7 @@ static const struct sys_info_name si_names[] =3D { { SYS_INFO_TIMERS, "timers" }, { SYS_INFO_LOCKS, "locks" }, { SYS_INFO_FTRACE, "ftrace" }, - { SYS_INFO_ALL_CPU_BT, "all_bt" }, + { SYS_INFO_ALL_BT, "all_bt" }, { SYS_INFO_BLOCKED_TASKS, "blocked_tasks" }, }; =20 @@ -118,7 +118,7 @@ void sys_info(unsigned long si_mask) if (si_mask & SYS_INFO_FTRACE) ftrace_dump(DUMP_ALL); =20 - if (si_mask & SYS_INFO_ALL_CPU_BT) + if (si_mask & SYS_INFO_ALL_BT) trigger_all_cpu_backtrace(); =20 if (si_mask & SYS_INFO_BLOCKED_TASKS) --=20 2.50.1 From nobody Wed Apr 8 06:10:14 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 B919C238C15 for ; Wed, 29 Oct 2025 11:12:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736365; cv=none; b=kO+6BGUgAoxInrxsEUz3E2mY+nX9Rg+q668anTQyBfyAndoIA4OEFAeCh16bL2jf6Vnc8Ko88ZVX4hi++1jT6PbQ7Zhu23b2ODmXSfTWPTERhIMVvmBno+683pjKXScO5K5XETvNawHd46JAshF88oVViJ+CVylJTfM8OjeqTu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736365; c=relaxed/simple; bh=79EZrYHav2KM8e+2sNwtRiJvFGLeza7Clf+zUyt951g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j9xMiR3fnsexlFm6lMYuncnlwwRC9DOgbnv03XTV/8QhhWNq8XrOAYbVPJzZwNBJGhbg7boWYA3s9PpWAjSshuKLZX1d2YnftUfVN6NOcUoYUHWuoRMmycF2dNLJJwIKKtbXDbkfUQzEbc5cU6Sk8smJAGCHSA/pXDGCxFQ1TK0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EpML6vyC; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EpML6vyC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761736363; x=1793272363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=79EZrYHav2KM8e+2sNwtRiJvFGLeza7Clf+zUyt951g=; b=EpML6vyC6KcoO8JHMxoULMVd8MRIDMtz4IXg/yoJH40K8uyrpcgg//u0 ubiiO00SmbAkI3ksWwNti9VqX5mVKs4he/Ag+E4cRlcN4EuRdzX08+3w5 YyBvpif4Rk1YolTGOcoZ9ewjF3ChsnPptduZnBs7wuKpiA+xRE7oG0bj8 QUWvVtM0+igjhWPwneanpfYfCqjNnQvq4PweQVJT1043wwS2RX895lOdF h4nGZNP1fjCGpcmqHWduwgFKZH9XfdwrCqCi857nrLf45F09AljgVegmW MY7dmd7cqZUTrNFyhY2lg5J9K60k5qhcmDOZWFusQvIKSrFxnwPs4f8dH g==; X-CSE-ConnectionGUID: EIEVNfOvQ7+AEYhhMVM+pA== X-CSE-MsgGUID: uA4xQzBERtq3GWfZGiY72g== X-IronPort-AV: E=McAfee;i="6800,10657,11531"; a="63757584" X-IronPort-AV: E=Sophos;i="6.17,312,1747724400"; d="scan'208";a="63757584" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2025 04:12:42 -0700 X-CSE-ConnectionGUID: tKzygAexS5yWP12M9x6CUw== X-CSE-MsgGUID: Xh2d5YL5RCq+SUSCx9ZB+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,263,1754982000"; d="scan'208";a="184816534" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa006.jf.intel.com with ESMTP; 29 Oct 2025 04:12:40 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id E522D98; Wed, 29 Oct 2025 12:12:39 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton , Petr Mladek Subject: [PATCH v2 3/6] panic: sys_info: Replace struct sys_info_name with plain array of strings Date: Wed, 29 Oct 2025 12:07:38 +0100 Message-ID: <20251029111202.3217870-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> References: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> 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" There is no need to keep a custom structure just for the need of a plain array of strings. Replace struct sys_info_name with plain array of strings. With that done, simplify the code, in particular, naturally use for_each_set_bit() when iterating over si_bits_global bitmap. Signed-off-by: Andy Shevchenko --- lib/sys_info.c | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/lib/sys_info.c b/lib/sys_info.c index 6b0188b30227..5aecf4b6025f 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -1,30 +1,29 @@ // SPDX-License-Identifier: GPL-2.0-only -#include +#include #include +#include #include #include -#include #include +#include +#include +#include =20 #include =20 -struct sys_info_name { - unsigned long bit; - const char *name; -}; - /* * When 'si_names' gets updated, please make sure the 'sys_info_avail' * below is updated accordingly. */ -static const struct sys_info_name si_names[] =3D { - { SYS_INFO_TASKS, "tasks" }, - { SYS_INFO_MEM, "mem" }, - { SYS_INFO_TIMERS, "timers" }, - { SYS_INFO_LOCKS, "locks" }, - { SYS_INFO_FTRACE, "ftrace" }, - { SYS_INFO_ALL_BT, "all_bt" }, - { SYS_INFO_BLOCKED_TASKS, "blocked_tasks" }, +static const char * const si_names[] =3D { + [ilog2(SYS_INFO_TASKS)] =3D "tasks", + [ilog2(SYS_INFO_MEM)] =3D "mem", + [ilog2(SYS_INFO_TIMERS)] =3D "timers", + [ilog2(SYS_INFO_LOCKS)] =3D "locks", + [ilog2(SYS_INFO_FTRACE)] =3D "ftrace", + [ilog2(SYS_INFO_PANIC_CONSOLE_REPLAY)] =3D "", + [ilog2(SYS_INFO_ALL_BT)] =3D "all_bt", + [ilog2(SYS_INFO_BLOCKED_TASKS)] =3D "blocked_tasks", }; =20 /* Expecting string like "xxx_sys_info=3Dtasks,mem,timers,locks,ftrace,...= " */ @@ -36,12 +35,9 @@ unsigned long sys_info_parse_param(char *str) =20 s =3D str; while ((name =3D strsep(&s, ",")) && *name) { - for (i =3D 0; i < ARRAY_SIZE(si_names); i++) { - if (!strcmp(name, si_names[i].name)) { - si_bits |=3D si_names[i].bit; - break; - } - } + i =3D match_string(si_names, ARRAY_SIZE(si_names), name); + if (i >=3D 0) + __set_bit(i, &si_bits); } =20 return si_bits; @@ -85,12 +81,10 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_= table, int write, si_bits =3D READ_ONCE(*si_bits_global); =20 names[0] =3D '\0'; - for (i =3D 0; i < ARRAY_SIZE(si_names); i++) { - if (si_bits & si_names[i].bit) { - len +=3D scnprintf(names + len, sizeof(names) - len, - "%s%s", delim, si_names[i].name); - delim =3D ","; - } + for_each_set_bit(i, &si_bits, ARRAY_SIZE(si_names)) { + len +=3D scnprintf(names + len, sizeof(names) - len, + "%s%s", delim, si_names[i]); + delim =3D ","; } =20 table =3D *ro_table; --=20 2.50.1 From nobody Wed Apr 8 06:10:14 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 DE84730BBBF for ; Wed, 29 Oct 2025 11:12:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736364; cv=none; b=t5LvozzHE64wIcZmYXBNMQnOd/yJwF4C7KlNjuCDF/0a8FPtrV8Xt7vSYRV+kEPCDE+V8lj7kvYyLWlK8ePp3HqcxgJo4cwlGJVWz2ClH49djfO37dMh0g/xR+IU86803hu7mRtVVAeRaXNdjh9wLUR8iInww2+B3D84Gb9tsFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736364; c=relaxed/simple; bh=q0veARx378rGN5WON51OKxYONBEe2s6rA5tw/JasIt8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nnH+RqaDXacEwlVg5xCsHAltB7YQwpzCxNrBB2q1YcwF2rkFRGgOLAIZKL02aMHyn2ZkMNIXcM1pqIoWHMHc0q1v4t+jMT/NSPGDVsz0p+slNPRsU+1zWz+kXTuxe4EN6KidSGuz4s7K8g+/khx9fO1YoQs/zMrBCC8HuuhdfA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ewCEd5nL; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ewCEd5nL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761736362; x=1793272362; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q0veARx378rGN5WON51OKxYONBEe2s6rA5tw/JasIt8=; b=ewCEd5nLxythStFTs58ewNAQIFJW6umZKetwDGowYGKn//pW9BzJ/iDu BBiFICo3Fq/N4A7oN/J6p7Ku65Hp4IKrcTlV7v1SRWb8rJ7k3uYTQJBzS zY5KUAWFntQDIP4CPimQCtL4Yicfu19J/iTVCNOUzBubZfOqQPcOex6Qh b3VRNtSiV8mCDyNkPn5VDmRo0HydIb4D/X+BdiO71TEUJmZ2lZ6uxVP1Q i9IjMlMxiWsPRhsEESA6v0UoOmnBVq0hePls/JxNaAZp7O0l49RjU3i2I fMFLQZ9izIDgEPIB7x3DeDt6r79FpKd4wgN864wcaKKxWWiYhzs9b9Ux8 g==; X-CSE-ConnectionGUID: gQNwjKjmQlWgYwZohFGlow== X-CSE-MsgGUID: j1LRkY1NSCyK7oc67NSEOA== X-IronPort-AV: E=McAfee;i="6800,10657,11596"; a="75198538" X-IronPort-AV: E=Sophos;i="6.19,263,1754982000"; d="scan'208";a="75198538" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2025 04:12:42 -0700 X-CSE-ConnectionGUID: mwqmJZN9Q9S7wmvx+WBu9A== X-CSE-MsgGUID: UFVVf9TdSW2edw5NEa+JsA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,263,1754982000"; d="scan'208";a="216286110" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa002.jf.intel.com with ESMTP; 29 Oct 2025 04:12:41 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id E946499; Wed, 29 Oct 2025 12:12:39 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton , Petr Mladek Subject: [PATCH v2 4/6] panic: sys_info: Rewrite a fix for a compilation error (`make W=1`) Date: Wed, 29 Oct 2025 12:07:39 +0100 Message-ID: <20251029111202.3217870-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> References: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> 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" Compiler was not happy about dead variable in use: lib/sys_info.c:52:19: error: variable 'sys_info_avail' is not needed and wi= ll not be emitted [-Werror,-Wunneeded-internal-declaration] 52 | static const char sys_info_avail[] =3D "tasks,mem,timers,locks,ftra= ce,all_bt,blocked_tasks"; | ^~~~~~~~~~~~~~ This was fixed by adding __maybe_unused attribute that just hides the issue and didn't actually fix the root cause. Rewrite the fix by moving the local variable from stack to a heap. As a side effect this drops unneeded "synchronisation" of duplicative info and also makes code ready for the further refactoring. Signed-off-by: Andy Shevchenko --- lib/sys_info.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/sys_info.c b/lib/sys_info.c index 5aecf4b6025f..027b2c432d07 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only +#include #include +#include #include #include #include @@ -11,10 +13,6 @@ =20 #include =20 -/* - * When 'si_names' gets updated, please make sure the 'sys_info_avail' - * below is updated accordingly. - */ static const char * const si_names[] =3D { [ilog2(SYS_INFO_TASKS)] =3D "tasks", [ilog2(SYS_INFO_MEM)] =3D "mem", @@ -45,25 +43,32 @@ unsigned long sys_info_parse_param(char *str) =20 #ifdef CONFIG_SYSCTL =20 -static const char sys_info_avail[] __maybe_unused =3D "tasks,mem,timers,lo= cks,ftrace,all_bt,blocked_tasks"; - int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write, void *buffer, size_t *lenp, loff_t *ppos) { - char names[sizeof(sys_info_avail)]; struct ctl_table table; unsigned long *si_bits_global; unsigned long si_bits; + unsigned int i; + size_t maxlen; =20 si_bits_global =3D ro_table->data; =20 + maxlen =3D 0; + for (i =3D 0; i < ARRAY_SIZE(si_names); i++) + maxlen +=3D strlen(si_names[i]) + 1; + + char *names __free(kfree) =3D kzalloc(maxlen, GFP_KERNEL); + if (!names) + return -ENOMEM; + if (write) { int ret; =20 table =3D *ro_table; table.data =3D names; - table.maxlen =3D sizeof(names); + table.maxlen =3D maxlen; ret =3D proc_dostring(&table, write, buffer, lenp, ppos); if (ret) return ret; @@ -74,22 +79,21 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_= table, int write, return 0; } else { /* for 'read' operation */ + unsigned int len =3D 0; char *delim =3D ""; - int i, len =3D 0; =20 /* The access to the global value is not synchronized. */ si_bits =3D READ_ONCE(*si_bits_global); =20 - names[0] =3D '\0'; for_each_set_bit(i, &si_bits, ARRAY_SIZE(si_names)) { - len +=3D scnprintf(names + len, sizeof(names) - len, + len +=3D scnprintf(names + len, maxlen - len, "%s%s", delim, si_names[i]); delim =3D ","; } =20 table =3D *ro_table; table.data =3D names; - table.maxlen =3D sizeof(names); + table.maxlen =3D maxlen; return proc_dostring(&table, write, buffer, lenp, ppos); } } --=20 2.50.1 From nobody Wed Apr 8 06:10:14 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (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 5AA58324B25 for ; Wed, 29 Oct 2025 11:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736365; cv=none; b=LT7lsNcrHe3TcvpGUeeA4inhIThf8W/BnJakcmPm1v1XQTWzC5sQD13QPeeRX2WCmI19BwZSBgmZcZNjaczuDWSxTj+z8HQFl1vSz/0MWVnpcbqBUZ4M+udhp4QCsgyR+dI7t3E4X1Bbxgxqr+l1fWOaeAlnCxVaBqnevUZEz/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736365; c=relaxed/simple; bh=0uzXrShVPuyyihm9bQTA7lPbESHpuHws075tcEruaY4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tAySaEHq/jxQwJVLxhl6+SdBlhVunjBorwRtXI5VCFcu2m8MAG63A7UQu/jCneU8zEKgOyRMYeG1zu3YKV1m1O2S+SQUrQJNr9HkBVsIcs192pT/Gj+UwTg6MCC+zQmNB9Hkbl9v9bq7uKGU2A1bT7eTw28K46gBoke/bT75jug= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WrdRN/yG; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WrdRN/yG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761736364; x=1793272364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0uzXrShVPuyyihm9bQTA7lPbESHpuHws075tcEruaY4=; b=WrdRN/yGHuototwyxFVHw3tBHNhBv6M95IzKH0ljbKVMPIPDKd8SKKSU 0Js+4nbQWBQe9Xwd9k2CkUHaSwSbZIa4f6OW/KfzIB7tnb9TO3163bYiM 99Oum6I+UF8Ue9T7ZZjUOdNoUR4xv/GiEdE6cxm1HUbSnlWvRQI0kakDN XpdCnqbH+SlLDRJX98wIDQTm5XWlQcro4wo26p5WD3/9XykRU5w3a1tqb Bp3vfwkKlrF9qcCCuzo5nJQLPnIVHFVUuTRL+Md7a7Vw+UrGvEarY+biI YBuCGwdtm4tyBzDLvBMWnEq4qCNLr1xWHsIilEZq8r+q0O2JDNO5U/Nqm g==; X-CSE-ConnectionGUID: bqijWOU3SCOqV5Vgi8cNtQ== X-CSE-MsgGUID: pO+cO4rqT4yPCY7CaTQa7g== X-IronPort-AV: E=McAfee;i="6800,10657,11596"; a="63060495" X-IronPort-AV: E=Sophos;i="6.19,263,1754982000"; d="scan'208";a="63060495" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2025 04:12:43 -0700 X-CSE-ConnectionGUID: oxkUqQ9UQmmY+z9DtGyGow== X-CSE-MsgGUID: 2l83DR6hRF2VfUGURAS9sA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,263,1754982000"; d="scan'208";a="186376726" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa010.fm.intel.com with ESMTP; 29 Oct 2025 04:12:42 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id ED71C9A; Wed, 29 Oct 2025 12:12:39 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton , Petr Mladek Subject: [PATCH v2 5/6] panic: sys_info: Deduplicate local variable 'table; assignments Date: Wed, 29 Oct 2025 12:07:40 +0100 Message-ID: <20251029111202.3217870-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> References: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> 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" The both handlers use the local 'table' variable and assign the same data to it, deduplicate that. Signed-off-by: Andy Shevchenko Reviewed-by: Feng Tang --- lib/sys_info.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/sys_info.c b/lib/sys_info.c index 027b2c432d07..c86f52644857 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -63,12 +63,13 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_= table, int write, if (!names) return -ENOMEM; =20 + table =3D *ro_table; + table.data =3D names; + table.maxlen =3D maxlen; + if (write) { int ret; =20 - table =3D *ro_table; - table.data =3D names; - table.maxlen =3D maxlen; ret =3D proc_dostring(&table, write, buffer, lenp, ppos); if (ret) return ret; @@ -91,9 +92,6 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_ta= ble, int write, delim =3D ","; } =20 - table =3D *ro_table; - table.data =3D names; - table.maxlen =3D maxlen; return proc_dostring(&table, write, buffer, lenp, ppos); } } --=20 2.50.1 From nobody Wed Apr 8 06:10:14 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 5A9DA323403 for ; Wed, 29 Oct 2025 11:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736366; cv=none; b=OVXXn0LOoP/jHNCnksVc6lo3KKzdxtRpw1wxSIE3E0F5BVJePkVljuXsNk0ZaE1qGsyURejGNgC/jkHYR7qW6FafO0895PQ+EFdpUP4+xX7A2REGPThHrJnqlD1/t+kLGry0mxvUEUU67ftgVZwH3r7/Zx6dYv46EfMBcmQs2FA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761736366; c=relaxed/simple; bh=3pRP7yxnE+8iPkw51mswvJbqXQU4QWREKIulx3P8Fqc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hg4FtP8mKDOSNoVb6EHIjo/LddCgOzn1k+lDyw8wquGg5qSrUCanGKZ0z9ef0OAwMRYSMpHpl7DMj52viMswh2RMuGkuxbF3EOwe8SvdMUyydoN/zMTdNRKZ/IX0++LhgNj7iEN7hG6AFGxF+HkC6hG0G64ckqgdNVEcWK8utG0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ih58e1Zw; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ih58e1Zw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761736364; x=1793272364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3pRP7yxnE+8iPkw51mswvJbqXQU4QWREKIulx3P8Fqc=; b=Ih58e1Zwik7WqRkQvRi9XkngdGpwSr5x2HhCg66CPXWLnIKHlE0ZbWXV l27ueCkedZFEmee9GFTLwElPBkjJIHGqd994mBEPJn2MIVkfJMqdN5uqT dF7AT+j5sFtFocS+CpEylbI8A7Qeea/8gqvd/vf3AemgMKJ22okXGO+Bi jWWwsAs+FM87PzjG7kBsbyHMKxMGwULXk9DN+mhaV1bE2vvs7odxP8+w0 7S7/m9leBWGC7x4ema+V8gQWk/Hlz9J/lAn4o6Nl1Y6V5btz450e9gVxA zn4GQCkDbinC5Yx0Si6B/eU8PiLnE97SJiw4EP9iCRpH4NyJzPHOeavBt w==; X-CSE-ConnectionGUID: KRRTvgh1SwyNt4etWrfVBw== X-CSE-MsgGUID: 3ytxKmDHSqC/Md7r5toaaQ== X-IronPort-AV: E=McAfee;i="6800,10657,11531"; a="63757587" X-IronPort-AV: E=Sophos;i="6.17,312,1747724400"; d="scan'208";a="63757587" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2025 04:12:44 -0700 X-CSE-ConnectionGUID: PBCwiIR4T32FjLxNRsJNKg== X-CSE-MsgGUID: GHUgm2+AQrqSDTQEHlSepg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,263,1754982000"; d="scan'208";a="184816544" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa006.jf.intel.com with ESMTP; 29 Oct 2025 04:12:42 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id F1B699B; Wed, 29 Oct 2025 12:12:39 +0100 (CET) From: Andy Shevchenko To: Feng Tang , Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Andrew Morton , Petr Mladek Subject: [PATCH v2 6/6] panic: sys_info: Factor out read and write handlers Date: Wed, 29 Oct 2025 12:07:41 +0100 Message-ID: <20251029111202.3217870-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> References: <20251029111202.3217870-2-andriy.shevchenko@linux.intel.com> 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" For the sake of the code readability and easier maintenance factor out read and write sys_info handlers. Signed-off-by: Andy Shevchenko --- lib/sys_info.c | 72 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/lib/sys_info.c b/lib/sys_info.c index c86f52644857..8ed3b4b55854 100644 --- a/lib/sys_info.c +++ b/lib/sys_info.c @@ -43,13 +43,52 @@ unsigned long sys_info_parse_param(char *str) =20 #ifdef CONFIG_SYSCTL =20 +static int sys_info_write_handler(struct ctl_table *table, + void *buffer, size_t *lenp, loff_t *ppos, + unsigned long *si_bits_global) +{ + unsigned long si_bits; + int ret; + + ret =3D proc_dostring(table, 1, buffer, lenp, ppos); + if (ret) + return ret; + + si_bits =3D sys_info_parse_param(table->data); + + /* The access to the global value is not synchronized. */ + WRITE_ONCE(*si_bits_global, si_bits); + + return 0; +} + +static int sys_info_read_handler(struct ctl_table *table, + void *buffer, size_t *lenp, loff_t *ppos, + unsigned long *si_bits_global) +{ + unsigned long si_bits; + unsigned int len =3D 0; + char *delim =3D ""; + unsigned int i; + + /* The access to the global value is not synchronized. */ + si_bits =3D READ_ONCE(*si_bits_global); + + for_each_set_bit(i, &si_bits, ARRAY_SIZE(si_names)) { + len +=3D scnprintf(table->data + len, table->maxlen - len, + "%s%s", delim, si_names[i]); + delim =3D ","; + } + + return proc_dostring(table, 0, buffer, lenp, ppos); +} + int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table table; unsigned long *si_bits_global; - unsigned long si_bits; unsigned int i; size_t maxlen; =20 @@ -67,33 +106,10 @@ int sysctl_sys_info_handler(const struct ctl_table *ro= _table, int write, table.data =3D names; table.maxlen =3D maxlen; =20 - if (write) { - int ret; - - ret =3D proc_dostring(&table, write, buffer, lenp, ppos); - if (ret) - return ret; - - si_bits =3D sys_info_parse_param(names); - /* The access to the global value is not synchronized. */ - WRITE_ONCE(*si_bits_global, si_bits); - return 0; - } else { - /* for 'read' operation */ - unsigned int len =3D 0; - char *delim =3D ""; - - /* The access to the global value is not synchronized. */ - si_bits =3D READ_ONCE(*si_bits_global); - - for_each_set_bit(i, &si_bits, ARRAY_SIZE(si_names)) { - len +=3D scnprintf(names + len, maxlen - len, - "%s%s", delim, si_names[i]); - delim =3D ","; - } - - return proc_dostring(&table, write, buffer, lenp, ppos); - } + if (write) + return sys_info_write_handler(&table, buffer, lenp, ppos, si_bits_global= ); + else + return sys_info_read_handler(&table, buffer, lenp, ppos, si_bits_global); } #endif =20 --=20 2.50.1