* [PATCH RESEND] tty/sysrq: Do not call sync directly from sysrq_do_reset()
@ 2018-11-26 20:57 Mark Tomlinson
2018-11-27 10:11 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Mark Tomlinson @ 2018-11-26 20:57 UTC (permalink / raw)
To: gregkh, linux-kernel; +Cc: Mark Tomlinson
sysrq_do_reset() is called in softirq context, so it cannot call
sync() directly. Instead, call orderly_reboot(), which creates a work
item to run /sbin/reboot, or do emergency_sync and restart if the
command fails.
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
---
drivers/tty/sysrq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index ad1ee5d01b53..f2ca32c1ad7c 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -660,8 +660,7 @@ static void sysrq_do_reset(struct timer_list *t)
state->reset_requested = true;
- ksys_sync();
- kernel_restart(NULL);
+ orderly_reboot();
}
static void sysrq_handle_reset_request(struct sysrq_state *state)
--
2.19.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] tty/sysrq: Do not call sync directly from sysrq_do_reset()
2018-11-26 20:57 [PATCH RESEND] tty/sysrq: Do not call sync directly from sysrq_do_reset() Mark Tomlinson
@ 2018-11-27 10:11 ` Greg KH
2018-11-27 19:58 ` Mark Tomlinson
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2018-11-27 10:11 UTC (permalink / raw)
To: Mark Tomlinson; +Cc: linux-kernel
On Tue, Nov 27, 2018 at 09:57:23AM +1300, Mark Tomlinson wrote:
> sysrq_do_reset() is called in softirq context, so it cannot call
> sync() directly. Instead, call orderly_reboot(), which creates a work
> item to run /sbin/reboot, or do emergency_sync and restart if the
> command fails.
>
> Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
> ---
> drivers/tty/sysrq.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index ad1ee5d01b53..f2ca32c1ad7c 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -660,8 +660,7 @@ static void sysrq_do_reset(struct timer_list *t)
>
> state->reset_requested = true;
>
> - ksys_sync();
> - kernel_restart(NULL);
> + orderly_reboot();
Is this something new? Why haven't we had reports of this failing in
the past? Or has something changed recently to cause this to now be
needed?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] tty/sysrq: Do not call sync directly from sysrq_do_reset()
2018-11-27 10:11 ` Greg KH
@ 2018-11-27 19:58 ` Mark Tomlinson
0 siblings, 0 replies; 3+ messages in thread
From: Mark Tomlinson @ 2018-11-27 19:58 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel
On 27/11/18 11:11 PM, Greg KH wrote:
> On Tue, Nov 27, 2018 at 09:57:23AM +1300, Mark Tomlinson wrote:
>> sysrq_do_reset() is called in softirq context, so it cannot call
>> sync() directly. Instead, call orderly_reboot(), which creates a work
>> item to run /sbin/reboot, or do emergency_sync and restart if the
>> command fails.
>>
>> Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
>> ---
>> drivers/tty/sysrq.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
>> index ad1ee5d01b53..f2ca32c1ad7c 100644
>> --- a/drivers/tty/sysrq.c
>> +++ b/drivers/tty/sysrq.c
>> @@ -660,8 +660,7 @@ static void sysrq_do_reset(struct timer_list *t)
>>
>> state->reset_requested = true;
>>
>> - ksys_sync();
>> - kernel_restart(NULL);
>> + orderly_reboot();
>
> Is this something new? Why haven't we had reports of this failing in
> the past? Or has something changed recently to cause this to now be
> needed?
>
> thanks,
>
> greg k-h
>
As far as I can tell, sysrq_do_reset() is only used when setting the
"keyset" property in "/chosen/linux,sysrq-reset-seq" (which is what I
want to do). No DTS file in the kernel tree sets this, so I don't know
if anyone else is using this. I am wondering whether it ever worked. A
reboot does occur after a kernel panic, so if the console is not
available, it may appear to have worked.
Pressing the standard 'sysrq' key followed by 'b'(reboot) instead calls
sysrq_handle_reboot(), which does not call sync at all, but
emergency_restart(). Also, the 's'(sync) key calls emergency_sync(),
which performs the sync via a work queue.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-27 19:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-26 20:57 [PATCH RESEND] tty/sysrq: Do not call sync directly from sysrq_do_reset() Mark Tomlinson
2018-11-27 10:11 ` Greg KH
2018-11-27 19:58 ` Mark Tomlinson
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).