linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Michal Hocko <mhocko@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Mel Gorman <mgorman@suse.de>,
	Frederic Weisbecker <fweisbecker@suse.de>,
	Ingo Molnar <mingo@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	x86@kernel.org, Linus Torvalds <torvalds@linux-foundation.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: [RFC PATCH v2 0/5] allow overriding default preempt mode from command line
Date: Tue, 27 Oct 2020 13:22:41 +0100	[thread overview]
Message-ID: <20201027122241.GA140902@lothringen> (raw)
In-Reply-To: <20201009174554.GS2611@hirez.programming.kicks-ass.net>

On Fri, Oct 09, 2020 at 07:45:54PM +0200, Peter Zijlstra wrote:
> +DEFINE_STATIC_KEY_TRUE(irq_preemption_key);
> +
> +/*
> + * SC:cond_resched
> + * SC:might_resched
> + * SC:preempt_schedule
> + * SC:preempt_schedule_notrace
> + * SB:irq_preemption_key
> + *
> + *
> + * ZERO
> + *   cond_resched             <- RET0
> + *   might_resched            <- NOP
> + *   preempt_schedule         <- NOP
> + *   preempt_schedule_notrace <- NOP
> + *   irq_preemption_key       <- false
> + *
> + * NONE:
> + *   cond_resched             <- __cond_resched
> + *   might_resched            <- NOP
> + *   preempt_schedule         <- NOP
> + *   preempt_schedule_notrace <- NOP
> + *   irq_preemption_key       <- false
> + *
> + * VOLUNTARY:
> + *   cond_resched             <- __cond_resched
> + *   might_resched            <- __might_resched
> + *   preempt_schedule         <- NOP
> + *   preempt_schedule_notrace <- NOP
> + *   irq_preemption_key       <- false
> + *
> + * FULL:
> + *   cond_resched             <- RET0
> + *   might_resched            <- NOP
> + *   preempt_schedule         <- preempt_schedule
> + *   preempt_schedule_notrace <- preempt_schedule_notrace
> + *   irq_preemption_key       <- true
> + */

That's cute! I'll try to end up to that result.

> +static int __init setup_preempt_mode(char *str)
> +{
> +	if (!strcmp(str, "zero")) {
> +		static_call_update(cond_resched, __static_call_return0);
> +		static_call_update(might_resched, (void (*)(void))NULL);
> +		static_call_update(preempt_schedule, (void (*)(void))NULL);
> +		static_call_update(preempt_schedule_notrace, (void (*)(void))NULL);
> +		static_branch_disable(&irq_preemption_key);
> +		printk("XXX PREEMPT: %s\n", str);
> +	} else if (!strcmp(str, "none")) {
> +		static_call_update(cond_resched, __cond_resched);
> +		static_call_update(might_resched, (void (*)(void))NULL);
> +		static_call_update(preempt_schedule, (void (*)(void))NULL);
> +		static_call_update(preempt_schedule_notrace, (void (*)(void))NULL);
> +		static_branch_disable(&irq_preemption_key);
> +		printk("XXX PREEMPT: %s\n", str);
> +	} else if (!strcmp(str, "voluntary")) {
> +		static_call_update(cond_resched, __cond_resched);
> +		static_call_update(might_resched, __might_resched);
> +		static_call_update(preempt_schedule, (void (*)(void))NULL);
> +		static_call_update(preempt_schedule_notrace, (void (*)(void))NULL);
> +		static_branch_disable(&irq_preemption_key);
> +		printk("XXX PREEMPT: %s\n", str);
> +	} else if (!strcmp(str, "ponies")) {
> +		static_call_update(cond_resched, __cond_resched);
> +		static_call_update(might_resched, (void (*)(void))NULL);
> +		static_call_update(preempt_schedule, preempt_schedule_thunk);
> +		static_call_update(preempt_schedule_notrace, preempt_schedule_notrace_thunk);
> +		static_branch_enable(&irq_preemption_key);
> +		printk("XXX PREEMPT: %s\n", str);

Why would we need that ponies version?

Thanks!

  reply	other threads:[~2020-10-27 12:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 12:04 [RFC PATCH] kernel: allow to configure PREEMPT_NONE, PREEMPT_VOLUNTARY on kernel command line Michal Hocko
2020-10-07 12:19 ` Peter Zijlstra
2020-10-07 12:29   ` Michal Hocko
2020-10-07 13:01     ` Mel Gorman
2020-10-07 12:21 ` Peter Zijlstra
2020-10-07 12:35   ` Michal Hocko
2020-10-09  9:47     ` Peter Zijlstra
2020-10-09 10:14       ` Michal Hocko
2020-10-09 10:20         ` Peter Zijlstra
2020-10-09 10:48           ` Michal Hocko
2020-10-09 11:17             ` Michal Hocko
2020-10-09 11:26               ` Michal Hocko
2020-10-09 11:39             ` Peter Zijlstra
2020-10-09  9:12 ` Michal Hocko
2020-10-09  9:42   ` Peter Zijlstra
2020-10-09 10:10     ` Michal Hocko
2020-10-09 10:14       ` Peter Zijlstra
2020-10-09 10:37         ` Michal Hocko
2020-10-09 11:42           ` Peter Zijlstra
2020-10-09 12:29 ` [RFC PATCH v2 0/5] allow overriding default preempt mode from " Michal Hocko
2020-10-09 12:29   ` [RFC PATCH v2 1/5] jump_label: split out declaration parts into its own headers Michal Hocko
2020-10-09 12:29   ` [RFC PATCH v2 2/5] kernel: allow to configure PREEMPT_NONE, PREEMPT_VOLUNTARY on kernel command line Michal Hocko
2020-10-09 12:29   ` [RFC PATCH v2 3/5] kernel: ARCH_NO_PREEMPT shouldn't exclude PREEMPT_VOLUNTARY Michal Hocko
2020-10-09 12:29   ` [RFC PATCH v2 4/5] kernel: introduce CONFIG_PREEMPT_DYNAMIC Michal Hocko
2020-10-09 12:29   ` [RFC PATCH v2 5/5] kernel: drop PREEMPT_NONE compile time option Michal Hocko
2020-10-09 12:50   ` [RFC PATCH v2 0/5] allow overriding default preempt mode from command line Peter Zijlstra
2020-10-09 13:03     ` Michal Hocko
2020-10-09 13:22       ` Peter Zijlstra
2020-10-09 17:45   ` Peter Zijlstra
2020-10-27 12:22     ` Frederic Weisbecker [this message]
2020-10-27 12:28       ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201027122241.GA140902@lothringen \
    --to=frederic@kernel.org \
    --cc=fweisbecker@suse.de \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).