Skip to contentSkip to conversation

mce: replace TIF_MCE_NOTIFY with TIF_USER_RETURN_NOTIFY

POC Luck, Tony 2 participants 2 messages May 28, 2011 – Jun 5, 2011 x86

lore
Share & tools
lore

Luck, Tony

author
#0 lore raw

[Oops - forgot to Cc: LKML!]

Quoted 2 lines · Ingo

We already have a generic facility to do such things at
return-to-userspace: _TIF_USER_RETURN_NOTIFY.

This is what it might look like if we replaced the current use of TIF_MCE_NOTIFY with TIF_USER_RETURN_NOTIFY in mce.c

Question: the notifier can potentially send signals to the current process - so should the check for _TIF_USER_RETURN_NOTIFY in do_notify_resume be moved before the check for _TIF_SIGPENDING? Would doing do be a problem for the existing user of user-return-notifiers (kvm)?

Note1 - this is a backport of a version that I wrote and tested on top of my mce-recovery patch set - since I had a debug environment set up to test it there ... the backport was relatively painless, but this version has only been compile tested.

Note2 - I didn't delete the TIF_MCE_NOTIFY definition - I'd like to keep bit 10 available for a _TIF_USER_RETURN_NOTIFY_TASK feature that would be run in the context of a specific task (on any cpu) rather than on a specific cpu (in any task context).

-Tony

---

arch/x86/Kconfig +1 -0
index cc6c53a..054e127 100644
@@ -845,6 +845,7 @@ config X86_REROUTE_FOR_BROKEN_BOOT_IRQS
 
 config X86_MCE
 	bool "Machine Check / overheating reporting"
+	select USER_RETURN_NOTIFIER
 	---help---
 	  Machine Check support allows the processor to notify the
 	  kernel if it detects a problem (e.g. overheating, data corruption).
arch/x86/kernel/cpu/mcheck/mce.c +34 -13

95 lines not on this page · raw message

arch/x86/kernel/signal.c +0 -6
index 4fd173c..44efc22 100644
@@ -838,12 +838,6 @@ static void do_signal(struct pt_regs *regs)
 void
 do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
 {
-#ifdef CONFIG_X86_MCE
-	/* notify userspace of pending MCEs */
-	if (thread_info_flags & _TIF_MCE_NOTIFY)
-		mce_notify_process();
-#endif /* CONFIG_X86_64 && CONFIG_X86_MCE */
-
 	/* deal with pending signal delivery */
 	if (thread_info_flags & _TIF_SIGPENDING)
 		do_signal(regs);
#1 lore raw
Quoted 11 lines · Tony

[Oops - forgot to Cc: LKML!]

Quoted 2 lines · Ingo

We already have a generic facility to do such things at
return-to-userspace: _TIF_USER_RETURN_NOTIFY.

This is what it might look like if we replaced the current use of TIF_MCE_NOTIFY with TIF_USER_RETURN_NOTIFY in mce.c

Question: the notifier can potentially send signals to the current process - so should the check for _TIF_USER_RETURN_NOTIFY in do_notify_resume be moved before the check for _TIF_SIGPENDING?

It is unnecessary. If a signal is raised, then _TIF_SIGPENDING will be ORed into the flags, and when we try to return again, we'll notice it and go right back into do_notify_resume().

Quoted 2 lines

Would doing do be a problem
for the existing user of user-return-notifiers (kvm)?

It would not be a problem. The orders of the checks should be immaterial.

<snip patch>

Looks good.

Signature · 1 line
error compiling committee.c: too many arguments to function