linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Julia Cartwright <julia@ni.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	linux-rt-users@vger.kernel.org
Subject: Re: Making rcu_normal=1 in RT
Date: Wed, 2 Nov 2016 17:05:47 +0100	[thread overview]
Message-ID: <20161102160547.uscnkzhw7we3hucn@linutronix.de> (raw)
In-Reply-To: <20161101051400-mutt-send-email-mst@kernel.org>

On 2016-11-01 05:31:56 [+0200], Michael S. Tsirkin wrote:
> > > > > > 
> > > > > > > - optionally it has been requested to make synchronize_rcu() behave like
> > > > > > >   synchronize_rcu_expedited() on shutdown and kexec().
> 
> I was trying to say that the fact net core calls expedited sync
> implies that many people care about boot time.
> 
> Should rcu_normal_after_boot override rcu_expedited?
> I'm not sure what happens if you specify both ATM.

I think what you asked for is something like this:

diff --git a/kernel/reboot.c b/kernel/reboot.c
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -283,6 +283,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
 	struct pid_namespace *pid_ns = task_active_pid_ns(current);
 	char buffer[256];
 	int ret = 0;
+	bool force_rcu_exp = false;
 
 	/* We only trust the superuser with rebooting the system. */
 	if (!ns_capable(pid_ns->user_ns, CAP_SYS_BOOT))
@@ -311,7 +312,19 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
 	if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
 		cmd = LINUX_REBOOT_CMD_HALT;
 
+	switch (cmd) {
+	case LINUX_REBOOT_CMD_RESTART:
+	case LINUX_REBOOT_CMD_HALT:
+	case LINUX_REBOOT_CMD_POWER_OFF:
+	case LINUX_REBOOT_CMD_RESTART2:
+	case LINUX_REBOOT_CMD_KEXEC:
+		force_rcu_exp = true;
+	}
+
 	mutex_lock(&reboot_mutex);
+	if (force_rcu_exp)
+		rcu_expedite_gp();
+
 	switch (cmd) {
 	case LINUX_REBOOT_CMD_RESTART:
 		kernel_restart(NULL);
@@ -362,6 +375,8 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
 		ret = -EINVAL;
 		break;
 	}
+	if (force_rcu_exp)
+		rcu_unexpedite_gp();
 	mutex_unlock(&reboot_mutex);
 	return ret;
 }

and problem that this patch is pointless because it is too late. This
RESTART, POWER_OFF, KEXEC hooks here called once the `shutdown' binary
is done doing sync & cleanup and invokes the kernel for the final
operation.
So to achieve what you ask for, we would need a
LINUX_REBOOT_CMD_RCU_FAST option which is invoked by the `shutdown'
binary as the first thing - long before it gets to
LINUX_REBOOT_CMD_RESTART (or KEXEC).

Sebastian

  reply	other threads:[~2016-11-02 16:05 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 15:12 Making rcu_normal=1 in RT Luiz Capitulino
2016-10-12 16:21 ` Julia Cartwright
2016-10-12 16:39   ` Paul E. McKenney
2016-10-12 16:49   ` Luiz Capitulino
2016-10-12 17:15     ` Julia Cartwright
2016-10-12 20:32       ` Paul E. McKenney
2016-10-13 16:25         ` Michael S. Tsirkin
2016-10-14  9:20           ` Paul E. McKenney
2016-10-16  1:45             ` Michael S. Tsirkin
2016-10-16 11:28               ` Paul E. McKenney
2016-10-31 17:38                 ` Sebastian Andrzej Siewior
2016-10-31 18:15                   ` Paul E. McKenney
2016-10-31 22:37                     ` Michael S. Tsirkin
2016-11-01  2:19                       ` Paul E. McKenney
2016-11-01  2:36                         ` Michael S. Tsirkin
2016-11-01  2:52                           ` Paul E. McKenney
2016-11-01  3:31                             ` Michael S. Tsirkin
2016-11-02 16:05                               ` Sebastian Andrzej Siewior [this message]
2016-11-03 16:26                                 ` Paul E. McKenney
2016-11-02 16:30                     ` [PATCH] rcu: update: make RCU_EXPEDITE_BOOT default Sebastian Andrzej Siewior
2016-11-03 16:22                       ` Paul E. McKenney
2016-11-03 16:33                         ` Sebastian Andrzej Siewior
2016-11-03 16:59                           ` Paul E. McKenney
2016-11-07 17:19                             ` Steven Rostedt
2016-11-07 17:30                               ` Sebastian Andrzej Siewior
2016-11-07 17:35                                 ` Josh Triplett
2016-11-07 18:05                                   ` Paul E. McKenney
2016-11-07 18:08                                     ` Josh Triplett
2016-11-07 19:04                                       ` Paul E. McKenney
2016-11-02 16:51   ` Making rcu_normal=1 in RT Sebastian Andrzej Siewior
2016-11-02 17:41     ` Luiz Capitulino

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=20161102160547.uscnkzhw7we3hucn@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=julia@ni.com \
    --cc=lcapitulino@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    /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).