lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250109143701.GA5388@noisy.programming.kicks-ass.net>
Date: Thu, 9 Jan 2025 15:37:01 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	linux-kernel@...r.kernel.org, linux-rt-devel@...ts.linux.dev,
	Ben Segall <bsegall@...gle.com>,
	Catalin Marinas <catalin.marinas@....com>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
	Mel Gorman <mgorman@...e.de>, Thomas Gleixner <tglx@...utronix.de>,
	Valentin Schneider <vschneid@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Will Deacon <will@...nel.org>, x86@...nel.org
Subject: Re: [RFC PATCH] preempt: Add a generic function to return the
 preemption string.

On Thu, Jan 09, 2025 at 09:37:02AM -0500, Steven Rostedt wrote:
> On Thu, 9 Jan 2025 12:43:39 +0100
> Peter Zijlstra <peterz@...radead.org> wrote:
> 
> > Hurmph.. a bunch of those combinations are nonsense :/
> > 
> > Also, we have a string thing in sched_dynamic_show().
> > 
> > Can't we do something like:
> > 
> > const char *preempt_model_str(void)
> > {
> > 	static char buf[128];
> > 	size_t off = 0, len = sizeof(buf), r;
> > 	bool brace = IS_ENABLED(CONFIG_PREEMPT_RT) &&
> > 		     (IS_ENABLED(CONFIG_PREEMPT_DYNAMIC) ||
> > 		      IS_ENABLED(CONFIG_PREEMPT_LAZY));
> > 
> > 	if (IS_ENABLED(CONFIG_PREEMPT_BUILD)) {
> > 		r = snprintf(buf + off, len, "PREEMPT");
> > 		off += r;
> > 		len -= r;
> > 
> > 		if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
> > 			r = snprintf(buf + off, len, "%sRT%s", 
> > 					brace ? "_{" : "_",
> > 					brace ? "," : "");
> > 			off += r;
> > 			len -= r;
> > 		}
> > 
> > 		if (IS_ENABLED(CONFIG_PREEMPT_DYNAMIC)) {
> > 			snprintf(buf + off, len, "(%s)%s", 
> > 				preempt_modes[preempt_dynamic_mode],
> > 				brace ? "}" : "");
> > 			retun buf;
> > 		}
> > 
> > 		if (IS_ENABLED(CONFIG_PREEMPT_LAZY)) {
> > 			snprintf(buf + off, len, "LAZY%s", 
> > 				brace ? "}" : "");
> > 			retun buf;
> > 		}
> 
> I'm sorry, but I can't even tell what the above is doing without my brain
> hurting. Why make code that was easy to read into a cryptic obfuscation? I
> can't see this as an optimization as IS_ENABLED() is determined at compile
> time.

Upgrade brain. Also the proposed thing was just plain wrong.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ