From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD11A31064B for ; Mon, 15 Dec 2025 16:09:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765814999; cv=none; b=uqRQn7iOR3EEhiaCuxTy9QjbB13DiQGeWlGUxpK67fZrHlt60XdOJVGcNqVIy5C5//e3WjmSfXn6BplrHRPvPolq85LZsbjxPpFXzIp6Y4WCgAQ/0WdOpYuRgDMpDngayEt5gMDfO+U1gl3N37soS04HlXLSu9n+wT+0tUNTCQM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765814999; c=relaxed/simple; bh=L1OsdweHVz+3Jw6fnUStinQkV81GCFsxEWJcxpMYHaE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BxzJnOH5rlSGUBDcZW1eVTzFLy22bNgVSrFG/GB9yMo2KBskIgBImR19YDGNAyGOTf1nKWdcWJ5UldO03zBBV3g730ltlSFfUdjUANWlgtc4sNS0OdxTeaObI+xLb31YyT6LyFAZ6T8UaCNNMNyEzqaFd/Syr9OnqxNMGBYegAk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=YG6Idh2Q; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="YG6Idh2Q" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-42f9ece6387so1467093f8f.0 for ; Mon, 15 Dec 2025 08:09:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1765814996; x=1766419796; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=F+xOY4zDrovYw2cGqpKgQC2pBK8I7REPhKoi7farlag=; b=YG6Idh2QwgVNQsJcoIttUD7amnTmIZyPzt1ta8e0FgnaRms7oRSA3G9xMgGdRYKffd xDvteR/d9gT8NjeNIX4f6JBFRSNT2X8EmsHgGA29V9lTTXgcZ7xTmYdrn/6bVN4onqZs 9W1rXDuzFR424oVWFqQyjZVDu/8Tif6Sf08TuzJRXEQyh/iY6hTiyIDre6Egu4BpW5+P ii+B/5GfSnqMYNyX5gVJUGkFx5aZ204wD1oeM2xrujShlzB+qlTXCkZ2uNnmR0C/swwG ob0/3cWGc+TSrE9i9Vff0pdEocsgKGlezMBQZkxK3OnokO2t5Sj+K0Ss0/xObgodPZo4 l9yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765814996; x=1766419796; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F+xOY4zDrovYw2cGqpKgQC2pBK8I7REPhKoi7farlag=; b=TrhYicAjFLQvOMckAdigUvc2oKpO0i/G1V8eE/zAtl59kOwP7HzPC3jZWl7rqDOdjj SHa0eD+SlBVyrDdSoX+eY+dbnuNjoBKpk+afh1jqDKQCPkCRRlqkX84SE9MTx82KJrU7 qB87ZpGTkDuRsR4p1dKWgiJpw+/IuAZ0AhuqVHfYgqzM0FdAyyT6hJSw7ZFRzkBx4yS8 xuSRn8kAkHG4CpvCU1anx4cj80J/gfSvWhXW4VVFm4yqkNgc0MO4dOZrlavkoq937cfp 9y+F3ohFC6mfiBn0qXjoiJyLfm5k/lSZlmbnBeINA40QNPZZQwtO2S4Ay5s15ox1n3Ig hZTA== X-Forwarded-Encrypted: i=1; AJvYcCW6T9J/FOcX0ahl8HfZbwQsBuhbxtu/cAod00aX8qOjZ07kzIbvWXtfstz4XPxiOdh/64FtTLLzC7TRNbU=@vger.kernel.org X-Gm-Message-State: AOJu0YxCHqAOtrItrl6OmabYJlHay5sO2OBehr+G3qCVAaivblRRB5dX 1153DRNlde1yC92tdQrT8yYYJ2ApmDxK/5aVSZiGvuBCBKGX3yay/OxOwoXskxS9jl4= X-Gm-Gg: AY/fxX5OojpdJVTz8N6uDmYu+1Ziv6sxXR3SXUPrVX9L8wGA6LbTIoKw+wWEO0sUINa 8RVk10uvE4IqCuk9MzVKIMvZ6DfZUOe9g8aOlkkjQBbHz89vxX6wCElnE8s7BWue6ETOQtn4twf Pfme9fucXvNJCuUf3UHe5JV7Xz3mtbd2k1JUaeHkPyCi52CDgJLJttN5aIMlik1zhLOkSnbI78L 9gTwAdbGnDA4FfNtafy13CLY0dHiGuyRByZFznPysTXaaT/BQhAsT/SHr1CGKgOJ0052Z7G8SSm FfPbLVoTJhsM7ixUhsoXBLDN1o4dXacaMEiCyUu+WG6mOCJ+twWTgXbbAuX5oNwCS8zSr23PLWv 8Ll1pssxhuDHnP36iUarvX4tHcOMCCaqRuz5zQZykbqCk4BSiCgdoFsl9PBMF6UOzm3zEj92klc +HK0M= X-Google-Smtp-Source: AGHT+IExX4wa+zEP2IOKssyIlYMdreAqy3Tlk2VUtXzM3n4mOdtzsvUZdpIT78uSO6koeFncPAE9WA== X-Received: by 2002:a05:6000:611:b0:426:eef2:fa86 with SMTP id ffacd0b85a97d-42fb447742cmr14010645f8f.11.1765814995814; Mon, 15 Dec 2025 08:09:55 -0800 (PST) Received: from pathway ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-430f42a3290sm14656110f8f.17.2025.12.15.08.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Dec 2025 08:09:55 -0800 (PST) Date: Mon, 15 Dec 2025 17:09:52 +0100 From: Petr Mladek To: Joel Granados Cc: Chris Down , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Sergey Senozhatsky , Steven Rostedt , John Ogness , Geert Uytterhoeven , Tony Lindgren , kernel-team@fb.com Subject: Re: [PATCH v8 18/21] printk: Deconstruct kernel.printk into discrete sysctl controls Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon 2025-12-15 11:08:12, Joel Granados wrote: > On Fri, Dec 12, 2025 at 04:24:17PM +0100, Petr Mladek wrote: > > Adding Joel into Cc. Joel, see the original patch at > > https://lore.kernel.org/all/c3e5cc507eb3fd7db0a002f31d7e47d764cad176.1764272407.git.chris@chrisdown.name/ > Thx for adding me. Please CC me in the next versions of this series as > the interface might change (slightly) again. By having this on my radar > we can better coordinate (if needed) linux-next and PRs for Linus. > > > > On Fri 2025-11-28 03:44:25, Chris Down wrote: > > > Introduce two new sysctl interfaces for configuring global loglevels: > > > > > > --- a/include/linux/sysctl.h > > > +++ b/include/linux/sysctl.h > > > @@ -235,6 +235,13 @@ extern struct ctl_table_header *register_sysctl_mount_point(const char *path); > > > > > > void do_sysctl_args(void); > > > bool sysctl_is_alias(char *param); > > > +int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp, int *valp, > > > + int write, void *data); > > > +int do_proc_dointvec(const struct ctl_table *table, int write, > > > + void *buffer, size_t *lenp, loff_t *ppos, > > > + int (*conv)(bool *negp, unsigned long *lvalp, int *valp, > > > + int write, void *data), > > > + void *data); > > > int do_proc_douintvec(const struct ctl_table *table, int write, > > > void *buffer, size_t *lenp, loff_t *ppos, > > > int (*conv)(unsigned long *lvalp, > > > > This hunk can be removed in v6.19. There is another interface in 6.19, > > see below. > > > > > diff --git a/kernel/printk/sysctl.c b/kernel/printk/sysctl.c > > > index da77f3f5c1fe..034739939a61 100644 > > > --- a/kernel/printk/sysctl.c > > > +++ b/kernel/printk/sysctl.c > > > @@ -11,6 +11,9 @@ > > > > > > static const int ten_thousand = 10000; > > > > > > +static int min_msg_loglevel = LOGLEVEL_EMERG; > > > +static int max_msg_loglevel = LOGLEVEL_DEBUG; > > > + > > > static int proc_dointvec_minmax_sysadmin(const struct ctl_table *table, int write, > > > void *buffer, size_t *lenp, loff_t *ppos) > > > { > > > @@ -20,6 +23,50 @@ static int proc_dointvec_minmax_sysadmin(const struct ctl_table *table, int writ > > > return proc_dointvec_minmax(table, write, buffer, lenp, ppos); > > > } > > > > The new way is to define the needed helpers using macros. We need this: > > > > static SYSCTL_USER_TO_KERN_INT_CONV(, SYSCTL_CONV_IDENTITY) > > static SYSCTL_KERN_TO_USER_INT_CONV(, SYSCTL_CONV_IDENTITY) > > static SYSCTL_INT_CONV_CUSTOM(, sysctl_user_to_kern_int_conv, > > sysctl_kern_to_user_int_conv, false) > > > > > > > +static int do_proc_dointvec_console_loglevel(bool *negp, unsigned long *lvalp, > > > + int *valp, > > > + int write, void *data) > > > > There parameters have got renamed and @table is passed instead or @data: > > > > static int do_proc_dointvec_console_loglevel(bool *negp, unsigned long *u_ptr, > > int *k_ptr, int dir, > > const struct ctl_table *table) > > > > > > > +{ > > > + int level, ret; > > > + > > > + /* > > > + * If writing, first do so via a temporary local int so we can > > > + * bounds-check it before touching *valp. > > > + */ > > > + int *intp = write ? &level : valp; > > > > The direction is newly checked by macro: > > > > int *int_ptr = SYSCTL_USER_TO_KERN(dir) ? &level : k_ptr; > > > > > + ret = do_proc_dointvec_conv(negp, lvalp, intp, write, data); > > > > The following helper is defined by the above mentioned macros: > > > > ret = do_proc_int_conv(negp, u_ptr, int_ptr, dir, table); > > > > > + if (ret) > > > + return ret; > > > + > > > + if (write) { > > > > The new way: > > > > if (SYSCTL_USER_TO_KERN(dir)) { > > > > > + if (level != console_clamp_loglevel(level)) > > > + return -ERANGE; > > > + > > > + /* > > > + * Honour the administrator-configured minimum console > > > + * loglevel (third element of kernel.printk). This mirrors > > > + * the syslog() and sysfs control paths so that once the floor > > > + * is raised we do not let this sysctl silently bypass it. > > > + */ > > > + if (minimum_console_loglevel > CONSOLE_LOGLEVEL_MIN && > > > + level < minimum_console_loglevel) > > > + level = minimum_console_loglevel; > > > + > > > + WRITE_ONCE(*valp, level); > > > > New parameter name: > > > > WRITE_ONCE(*k_ptr, level); > > > > > + } > > > + > > > + return 0; > > > +} > > > + > > > +static int proc_dointvec_console_loglevel(const struct ctl_table *table, > > > + int write, void *buffer, size_t *lenp, > > > + loff_t *ppos) > > > +{ > > > + return do_proc_dointvec(table, write, buffer, lenp, ppos, > > > + do_proc_dointvec_console_loglevel, NULL); > > > > There is a new function where the last NULL parameter is not longer passed: > > > > return proc_dointvec_conv(table, write, buffer, lenp, ppos, > > do_proc_dointvec_console_loglevel); > > > > > +} > > > + > > > static const struct ctl_table printk_sysctls[] = { > > > { > > > .procname = "printk", > > > > > > Here are the above described changes made by diff: > The changes look ok, Great. > but there is a lot of context that I'm missing from > just looking at this change. Will there be another version re-based on > top of v19-rc1? Yes, we need v9. Chris, please add Joel into Cc. Thanks a lot for checking. Best Regards, Petr