* [PATCH 0/3] HWPOISON: improve memory error handling for multithread process
[not found] <53877e9c.8b2cdc0a.1604.ffffea43SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2014-05-30 6:51 ` Naoya Horiguchi
2014-05-30 6:51 ` [PATCH 1/3] memory-failure: Send right signal code to correct thread Naoya Horiguchi
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Naoya Horiguchi @ 2014-05-30 6:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Tony Luck, Andi Kleen, Kamil Iskra, Borislav Petkov, Chen Gong,
linux-kernel, linux-mm
This patchset is the summary of recent discussion about memory error handling
on multithread application. Patch 1 and 2 is for action required errors, and
patch 3 is for action optional errors.
This patchset is based on mmotm-2014-05-21-16-57.
Patches are also available on the following tree/branch.
git@github.com:Naoya-Horiguchi/linux.git hwpoison/master
Thanks,
Naoya Horiguchi
---
Summary:
Naoya Horiguchi (1):
mm/memory-failure.c: support dedicated thread to handle SIGBUS(BUS_MCEERR_AO)
Tony Luck (2):
memory-failure: Send right signal code to correct thread
memory-failure: Don't let collect_procs() skip over processes for MF_ACTION_REQUIRED
Documentation/vm/hwpoison.txt | 5 +++
mm/memory-failure.c | 75 ++++++++++++++++++++++++++++++-------------
2 files changed, 58 insertions(+), 22 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] memory-failure: Send right signal code to correct thread
2014-05-30 6:51 ` [PATCH 0/3] HWPOISON: improve memory error handling for multithread process Naoya Horiguchi
@ 2014-05-30 6:51 ` Naoya Horiguchi
2014-06-02 22:44 ` Andrew Morton
2014-05-30 6:51 ` [PATCH 2/3] memory-failure: Don't let collect_procs() skip over processes for MF_ACTION_REQUIRED Naoya Horiguchi
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Naoya Horiguchi @ 2014-05-30 6:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Tony Luck, Andi Kleen, Kamil Iskra, Borislav Petkov, Chen Gong,
linux-kernel, linux-mm
From: Tony Luck <tony.luck@intel.com>
When a thread in a multi-threaded application hits a machine
check because of an uncorrectable error in memory - we want to
send the SIGBUS with si.si_code = BUS_MCEERR_AR to that thread.
Currently we fail to do that if the active thread is not the
primary thread in the process. collect_procs() just finds primary
threads and this test:
if ((flags & MF_ACTION_REQUIRED) && t == current) {
will see that the thread we found isn't the current thread
and so send a si.si_code = BUS_MCEERR_AO to the primary
(and nothing to the active thread at this time).
We can fix this by checking whether "current" shares the same
mm with the process that collect_procs() said owned the page.
If so, we send the SIGBUS to current (with code BUS_MCEERR_AR).
Reported-by: Otto Bruggeman <otto.g.bruggeman@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Chen Gong <gong.chen@linux.jf.intel.com>
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
mm/memory-failure.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git mmotm-2014-05-21-16-57.orig/mm/memory-failure.c mmotm-2014-05-21-16-57/mm/memory-failure.c
index e3154d99b87f..b73098ee91e6 100644
--- mmotm-2014-05-21-16-57.orig/mm/memory-failure.c
+++ mmotm-2014-05-21-16-57/mm/memory-failure.c
@@ -204,9 +204,9 @@ static int kill_proc(struct task_struct *t, unsigned long addr, int trapno,
#endif
si.si_addr_lsb = page_size_order(page) + PAGE_SHIFT;
- if ((flags & MF_ACTION_REQUIRED) && t == current) {
+ if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
si.si_code = BUS_MCEERR_AR;
- ret = force_sig_info(SIGBUS, &si, t);
+ ret = force_sig_info(SIGBUS, &si, current);
} else {
/*
* Don't use force here, it's convenient if the signal
--
1.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] memory-failure: Don't let collect_procs() skip over processes for MF_ACTION_REQUIRED
2014-05-30 6:51 ` [PATCH 0/3] HWPOISON: improve memory error handling for multithread process Naoya Horiguchi
2014-05-30 6:51 ` [PATCH 1/3] memory-failure: Send right signal code to correct thread Naoya Horiguchi
@ 2014-05-30 6:51 ` Naoya Horiguchi
2014-05-30 6:51 ` [PATCH 3/3] mm/memory-failure.c: support dedicated thread to handle SIGBUS(BUS_MCEERR_AO) Naoya Horiguchi
2014-05-30 17:25 ` [PATCH 0/3] HWPOISON: improve memory error handling for multithread process Luck, Tony
3 siblings, 0 replies; 9+ messages in thread
From: Naoya Horiguchi @ 2014-05-30 6:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Tony Luck, Andi Kleen, Kamil Iskra, Borislav Petkov, Chen Gong,
linux-kernel, linux-mm
From: Tony Luck <tony.luck@intel.com>
When Linux sees an "action optional" machine check (where h/w has
reported an error that is not in the current execution path) we
generally do not want to signal a process, since most processes
do not have a SIGBUS handler - we'd just prematurely terminate the
process for a problem that they might never actually see.
task_early_kill() decides whether to consider a process - and it
checks whether this specific process has been marked for early signals
with "prctl", or if the system administrator has requested early
signals for all processes using /proc/sys/vm/memory_failure_early_kill.
But for MF_ACTION_REQUIRED case we must not defer. The error is in
the execution path of the current thread so we must send the SIGBUS
immediatley.
Fix by passing a flag argument through collect_procs*() to
task_early_kill() so it knows whether we can defer or must
take action.
Signed-off-by: Tony Luck <tony.luck@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Chen Gong <gong.chen@linux.jf.intel.com>
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
mm/memory-failure.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git mmotm-2014-05-21-16-57.orig/mm/memory-failure.c mmotm-2014-05-21-16-57/mm/memory-failure.c
index b73098ee91e6..fbcdb1d54c55 100644
--- mmotm-2014-05-21-16-57.orig/mm/memory-failure.c
+++ mmotm-2014-05-21-16-57/mm/memory-failure.c
@@ -380,10 +380,12 @@ static void kill_procs(struct list_head *to_kill, int forcekill, int trapno,
}
}
-static int task_early_kill(struct task_struct *tsk)
+static int task_early_kill(struct task_struct *tsk, int force_early)
{
if (!tsk->mm)
return 0;
+ if (force_early)
+ return 1;
if (tsk->flags & PF_MCE_PROCESS)
return !!(tsk->flags & PF_MCE_EARLY);
return sysctl_memory_failure_early_kill;
@@ -393,7 +395,7 @@ static int task_early_kill(struct task_struct *tsk)
* Collect processes when the error hit an anonymous page.
*/
static void collect_procs_anon(struct page *page, struct list_head *to_kill,
- struct to_kill **tkc)
+ struct to_kill **tkc, int force_early)
{
struct vm_area_struct *vma;
struct task_struct *tsk;
@@ -409,7 +411,7 @@ static void collect_procs_anon(struct page *page, struct list_head *to_kill,
for_each_process (tsk) {
struct anon_vma_chain *vmac;
- if (!task_early_kill(tsk))
+ if (!task_early_kill(tsk, force_early))
continue;
anon_vma_interval_tree_foreach(vmac, &av->rb_root,
pgoff, pgoff) {
@@ -428,7 +430,7 @@ static void collect_procs_anon(struct page *page, struct list_head *to_kill,
* Collect processes when the error hit a file mapped page.
*/
static void collect_procs_file(struct page *page, struct list_head *to_kill,
- struct to_kill **tkc)
+ struct to_kill **tkc, int force_early)
{
struct vm_area_struct *vma;
struct task_struct *tsk;
@@ -439,7 +441,7 @@ static void collect_procs_file(struct page *page, struct list_head *to_kill,
for_each_process(tsk) {
pgoff_t pgoff = page_pgoff(page);
- if (!task_early_kill(tsk))
+ if (!task_early_kill(tsk, force_early))
continue;
vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff,
@@ -465,7 +467,8 @@ static void collect_procs_file(struct page *page, struct list_head *to_kill,
* First preallocate one tokill structure outside the spin locks,
* so that we can kill at least one process reasonably reliable.
*/
-static void collect_procs(struct page *page, struct list_head *tokill)
+static void collect_procs(struct page *page, struct list_head *tokill,
+ int force_early)
{
struct to_kill *tk;
@@ -476,9 +479,9 @@ static void collect_procs(struct page *page, struct list_head *tokill)
if (!tk)
return;
if (PageAnon(page))
- collect_procs_anon(page, tokill, &tk);
+ collect_procs_anon(page, tokill, &tk, force_early);
else
- collect_procs_file(page, tokill, &tk);
+ collect_procs_file(page, tokill, &tk, force_early);
kfree(tk);
}
@@ -963,7 +966,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
* there's nothing that can be done.
*/
if (kill)
- collect_procs(ppage, &tokill);
+ collect_procs(ppage, &tokill, flags & MF_ACTION_REQUIRED);
ret = try_to_unmap(ppage, ttu);
if (ret != SWAP_SUCCESS)
--
1.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] mm/memory-failure.c: support dedicated thread to handle SIGBUS(BUS_MCEERR_AO)
2014-05-30 6:51 ` [PATCH 0/3] HWPOISON: improve memory error handling for multithread process Naoya Horiguchi
2014-05-30 6:51 ` [PATCH 1/3] memory-failure: Send right signal code to correct thread Naoya Horiguchi
2014-05-30 6:51 ` [PATCH 2/3] memory-failure: Don't let collect_procs() skip over processes for MF_ACTION_REQUIRED Naoya Horiguchi
@ 2014-05-30 6:51 ` Naoya Horiguchi
2014-06-02 22:42 ` Andrew Morton
2014-05-30 17:25 ` [PATCH 0/3] HWPOISON: improve memory error handling for multithread process Luck, Tony
3 siblings, 1 reply; 9+ messages in thread
From: Naoya Horiguchi @ 2014-05-30 6:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Tony Luck, Andi Kleen, Kamil Iskra, Borislav Petkov, Chen Gong,
linux-kernel, linux-mm
Currently memory error handler handles action optional errors in the deferred
manner by default. And if a recovery aware application wants to handle it
immediately, it can do it by setting PF_MCE_EARLY flag. However, such signal
can be sent only to the main thread, so it's problematic if the application
wants to have a dedicated thread to handler such signals.
So this patch adds dedicated thread support to memory error handler. We have
PF_MCE_EARLY flags for each thread separately, so with this patch AO signal
is sent to the thread with PF_MCE_EARLY flag set, not the main thread. If
you want to implement a dedicated thread, you call prctl() to set PF_MCE_EARLY
on the thread.
Memory error handler collects processes to be killed, so this patch lets it
check PF_MCE_EARLY flag on each thread in the collecting routines.
No behavioral change for all non-early kill cases.
ChangeLog:
- document more specifically
- add parenthesis in find_early_kill_thread()
- move position of find_early_kill_thread() and task_early_kill()
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Cc: Kamil Iskra <iskra@mcs.anl.gov>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Chen Gong <gong.chen@linux.jf.intel.com>
---
Documentation/vm/hwpoison.txt | 5 ++++
mm/memory-failure.c | 58 ++++++++++++++++++++++++++++++++-----------
2 files changed, 48 insertions(+), 15 deletions(-)
diff --git mmotm-2014-05-21-16-57.orig/Documentation/vm/hwpoison.txt mmotm-2014-05-21-16-57/Documentation/vm/hwpoison.txt
index 550068466605..6ae89a9edf2a 100644
--- mmotm-2014-05-21-16-57.orig/Documentation/vm/hwpoison.txt
+++ mmotm-2014-05-21-16-57/Documentation/vm/hwpoison.txt
@@ -84,6 +84,11 @@ PR_MCE_KILL
PR_MCE_KILL_EARLY: Early kill
PR_MCE_KILL_LATE: Late kill
PR_MCE_KILL_DEFAULT: Use system global default
+ Note that if you want to have a dedicated thread which handles
+ the SIGBUS(BUS_MCEERR_AO) on behalf of the process, you should
+ call prctl(PR_MCE_KILL_EARLY) on the designated thread. Otherwise,
+ the SIGBUS is sent to the main thread.
+
PR_MCE_KILL_GET
return current mode
diff --git mmotm-2014-05-21-16-57.orig/mm/memory-failure.c mmotm-2014-05-21-16-57/mm/memory-failure.c
index fbcdb1d54c55..9751e19ab13b 100644
--- mmotm-2014-05-21-16-57.orig/mm/memory-failure.c
+++ mmotm-2014-05-21-16-57/mm/memory-failure.c
@@ -380,15 +380,44 @@ static void kill_procs(struct list_head *to_kill, int forcekill, int trapno,
}
}
-static int task_early_kill(struct task_struct *tsk, int force_early)
+/*
+ * Find a dedicated thread which is supposed to handle SIGBUS(BUS_MCEERR_AO)
+ * on behalf of the thread group. Return task_struct of the (first found)
+ * dedicated thread if found, and return NULL otherwise.
+ */
+static struct task_struct *find_early_kill_thread(struct task_struct *tsk)
+{
+ struct task_struct *t;
+ rcu_read_lock();
+ for_each_thread(tsk, t)
+ if ((t->flags & PF_MCE_PROCESS) && (t->flags & PF_MCE_EARLY))
+ goto found;
+ t = NULL;
+found:
+ rcu_read_unlock();
+ return t;
+}
+
+/*
+ * Determine whether a given process is "early kill" process which expects
+ * to be signaled when some page under the process is hwpoisoned.
+ * Return task_struct of the dedicated thread (main thread unless explicitly
+ * specified) if the process is "early kill," and otherwise returns NULL.
+ */
+static struct task_struct *task_early_kill(struct task_struct *tsk,
+ int force_early)
{
+ struct task_struct *t;
if (!tsk->mm)
- return 0;
+ return NULL;
if (force_early)
- return 1;
- if (tsk->flags & PF_MCE_PROCESS)
- return !!(tsk->flags & PF_MCE_EARLY);
- return sysctl_memory_failure_early_kill;
+ return tsk;
+ t = find_early_kill_thread(tsk);
+ if (t)
+ return t;
+ if (sysctl_memory_failure_early_kill)
+ return tsk;
+ return NULL;
}
/*
@@ -410,16 +439,16 @@ static void collect_procs_anon(struct page *page, struct list_head *to_kill,
read_lock(&tasklist_lock);
for_each_process (tsk) {
struct anon_vma_chain *vmac;
-
- if (!task_early_kill(tsk, force_early))
+ struct task_struct *t = task_early_kill(tsk, force_early);
+ if (!t)
continue;
anon_vma_interval_tree_foreach(vmac, &av->rb_root,
pgoff, pgoff) {
vma = vmac->vma;
if (!page_mapped_in_vma(page, vma))
continue;
- if (vma->vm_mm == tsk->mm)
- add_to_kill(tsk, page, vma, to_kill, tkc);
+ if (vma->vm_mm == t->mm)
+ add_to_kill(t, page, vma, to_kill, tkc);
}
}
read_unlock(&tasklist_lock);
@@ -440,10 +469,9 @@ static void collect_procs_file(struct page *page, struct list_head *to_kill,
read_lock(&tasklist_lock);
for_each_process(tsk) {
pgoff_t pgoff = page_pgoff(page);
-
- if (!task_early_kill(tsk, force_early))
+ struct task_struct *t = task_early_kill(tsk, force_early);
+ if (!t)
continue;
-
vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff,
pgoff) {
/*
@@ -453,8 +481,8 @@ static void collect_procs_file(struct page *page, struct list_head *to_kill,
* Assume applications who requested early kill want
* to be informed of all such data corruptions.
*/
- if (vma->vm_mm == tsk->mm)
- add_to_kill(tsk, page, vma, to_kill, tkc);
+ if (vma->vm_mm == t->mm)
+ add_to_kill(t, page, vma, to_kill, tkc);
}
}
read_unlock(&tasklist_lock);
--
1.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* RE: [PATCH 0/3] HWPOISON: improve memory error handling for multithread process
2014-05-30 6:51 ` [PATCH 0/3] HWPOISON: improve memory error handling for multithread process Naoya Horiguchi
` (2 preceding siblings ...)
2014-05-30 6:51 ` [PATCH 3/3] mm/memory-failure.c: support dedicated thread to handle SIGBUS(BUS_MCEERR_AO) Naoya Horiguchi
@ 2014-05-30 17:25 ` Luck, Tony
[not found] ` <5388cd0e.463edd0a.755d.6f61SMTPIN_ADDED_BROKEN@mx.google.com>
3 siblings, 1 reply; 9+ messages in thread
From: Luck, Tony @ 2014-05-30 17:25 UTC (permalink / raw)
To: Naoya Horiguchi, Andrew Morton
Cc: Andi Kleen, Kamil Iskra, Borislav Petkov, Chen Gong,
linux-kernel, linux-mm
> This patchset is the summary of recent discussion about memory error handling
> on multithread application. Patch 1 and 2 is for action required errors, and
> patch 3 is for action optional errors.
Naoya,
You suggested early in the discussion (when there were just two patches) that
they deserved a "Cc: stable@vger.kernel.org". I agreed, and still think the same
way.
-Tony
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] mm/memory-failure.c: support dedicated thread to handle SIGBUS(BUS_MCEERR_AO)
2014-05-30 6:51 ` [PATCH 3/3] mm/memory-failure.c: support dedicated thread to handle SIGBUS(BUS_MCEERR_AO) Naoya Horiguchi
@ 2014-06-02 22:42 ` Andrew Morton
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Morton @ 2014-06-02 22:42 UTC (permalink / raw)
To: Naoya Horiguchi
Cc: Tony Luck, Andi Kleen, Kamil Iskra, Borislav Petkov, Chen Gong,
linux-kernel, linux-mm
On Fri, 30 May 2014 02:51:10 -0400 Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:
> Currently memory error handler handles action optional errors in the deferred
> manner by default. And if a recovery aware application wants to handle it
> immediately, it can do it by setting PF_MCE_EARLY flag. However, such signal
> can be sent only to the main thread, so it's problematic if the application
> wants to have a dedicated thread to handler such signals.
>
> So this patch adds dedicated thread support to memory error handler. We have
> PF_MCE_EARLY flags for each thread separately, so with this patch AO signal
> is sent to the thread with PF_MCE_EARLY flag set, not the main thread. If
> you want to implement a dedicated thread, you call prctl() to set PF_MCE_EARLY
> on the thread.
>
> Memory error handler collects processes to be killed, so this patch lets it
> check PF_MCE_EARLY flag on each thread in the collecting routines.
>
> No behavioral change for all non-early kill cases.
>
> ...
>
> --- mmotm-2014-05-21-16-57.orig/mm/memory-failure.c
> +++ mmotm-2014-05-21-16-57/mm/memory-failure.c
> @@ -380,15 +380,44 @@ static void kill_procs(struct list_head *to_kill, int forcekill, int trapno,
> }
> }
>
> -static int task_early_kill(struct task_struct *tsk, int force_early)
> +/*
> + * Find a dedicated thread which is supposed to handle SIGBUS(BUS_MCEERR_AO)
> + * on behalf of the thread group. Return task_struct of the (first found)
> + * dedicated thread if found, and return NULL otherwise.
> + */
> +static struct task_struct *find_early_kill_thread(struct task_struct *tsk)
> +{
> + struct task_struct *t;
> + rcu_read_lock();
> + for_each_thread(tsk, t)
> + if ((t->flags & PF_MCE_PROCESS) && (t->flags & PF_MCE_EARLY))
> + goto found;
> + t = NULL;
> +found:
> + rcu_read_unlock();
> + return t;
> +}
> +
> +/*
> + * Determine whether a given process is "early kill" process which expects
> + * to be signaled when some page under the process is hwpoisoned.
> + * Return task_struct of the dedicated thread (main thread unless explicitly
> + * specified) if the process is "early kill," and otherwise returns NULL.
> + */
> +static struct task_struct *task_early_kill(struct task_struct *tsk,
> + int force_early)
> {
> + struct task_struct *t;
> if (!tsk->mm)
> - return 0;
> + return NULL;
> if (force_early)
> - return 1;
> - if (tsk->flags & PF_MCE_PROCESS)
> - return !!(tsk->flags & PF_MCE_EARLY);
> - return sysctl_memory_failure_early_kill;
> + return tsk;
> + t = find_early_kill_thread(tsk);
> + if (t)
> + return t;
> + if (sysctl_memory_failure_early_kill)
> + return tsk;
> + return NULL;
> }
The above two functions are to be called under
read_lock(tasklist_lock), which is rather important...
Given this requirement, did find_early_kill_thread() need rcu_read_lock()?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] HWPOISON: improve memory error handling for multithread process
[not found] ` <5388cd0e.463edd0a.755d.6f61SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2014-06-02 22:43 ` Andrew Morton
2014-06-02 23:37 ` Luck, Tony
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Morton @ 2014-06-02 22:43 UTC (permalink / raw)
To: Naoya Horiguchi
Cc: Tony Luck, Andi Kleen, Kamil Iskra, Borislav Petkov, Chen Gong,
linux-kernel, linux-mm
On Fri, 30 May 2014 14:24:52 -0400 Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:
> On Fri, May 30, 2014 at 05:25:39PM +0000, Luck, Tony wrote:
> > > This patchset is the summary of recent discussion about memory error handling
> > > on multithread application. Patch 1 and 2 is for action required errors, and
> > > patch 3 is for action optional errors.
> >
> > Naoya,
> >
> > You suggested early in the discussion (when there were just two patches) that
> > they deserved a "Cc: stable@vger.kernel.org". I agreed, and still think the same
> > way.
>
> Correct. AR error handling was added in v3.2-rc5, so adding
> "Cc: stable@vger.kernel.org # v3.2+" is fine.
I'm not sure that "[PATCH 3/3] mm/memory-failure.c: support dedicated
thread to handle SIGBUS(BUS_MCEERR_AO)" is a -stable thing? That's a
feature addition more than a bugfix?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] memory-failure: Send right signal code to correct thread
2014-05-30 6:51 ` [PATCH 1/3] memory-failure: Send right signal code to correct thread Naoya Horiguchi
@ 2014-06-02 22:44 ` Andrew Morton
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Morton @ 2014-06-02 22:44 UTC (permalink / raw)
To: Naoya Horiguchi
Cc: Tony Luck, Andi Kleen, Kamil Iskra, Borislav Petkov, Chen Gong,
linux-kernel, linux-mm
On Fri, 30 May 2014 02:51:08 -0400 Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:
> From: Tony Luck <tony.luck@intel.com>
>
> When a thread in a multi-threaded application hits a machine
> check because of an uncorrectable error in memory - we want to
> send the SIGBUS with si.si_code = BUS_MCEERR_AR to that thread.
> Currently we fail to do that if the active thread is not the
> primary thread in the process. collect_procs() just finds primary
> threads and this test:
> if ((flags & MF_ACTION_REQUIRED) && t == current) {
> will see that the thread we found isn't the current thread
> and so send a si.si_code = BUS_MCEERR_AO to the primary
> (and nothing to the active thread at this time).
>
> We can fix this by checking whether "current" shares the same
> mm with the process that collect_procs() said owned the page.
> If so, we send the SIGBUS to current (with code BUS_MCEERR_AR).
>
> Reported-by: Otto Bruggeman <otto.g.bruggeman@intel.com>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> Cc: Andi Kleen <andi@firstfloor.org>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Chen Gong <gong.chen@linux.jf.intel.com>
> Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
You were on the patch delivery path, so it should have included your
signed-off-by. Documentation/SubmittingPatches section 12 has the
details.
I have made that change to my copies of patches 1 and 2.
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH 0/3] HWPOISON: improve memory error handling for multithread process
2014-06-02 22:43 ` Andrew Morton
@ 2014-06-02 23:37 ` Luck, Tony
0 siblings, 0 replies; 9+ messages in thread
From: Luck, Tony @ 2014-06-02 23:37 UTC (permalink / raw)
To: Andrew Morton, Naoya Horiguchi
Cc: Andi Kleen, Kamil Iskra, Borislav Petkov, Chen Gong,
linux-kernel, linux-mm
> I'm not sure that "[PATCH 3/3] mm/memory-failure.c: support dedicated
> thread to handle SIGBUS(BUS_MCEERR_AO)" is a -stable thing? That's a
> feature addition more than a bugfix?
No - the old behavior was crazy - someone with a multithreaded process might
well expect that if they call prctl(PF_MCE_EARLY) in just one thread, then that
thread would see the SIGBUS with si_code = BUS_MCEERR_A0 - even if that
thread wasn't the main thread for the process.
Perhaps the description for the commit should better reflect that?
-Tony
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-06-02 23:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <53877e9c.8b2cdc0a.1604.ffffea43SMTPIN_ADDED_BROKEN@mx.google.com>
2014-05-30 6:51 ` [PATCH 0/3] HWPOISON: improve memory error handling for multithread process Naoya Horiguchi
2014-05-30 6:51 ` [PATCH 1/3] memory-failure: Send right signal code to correct thread Naoya Horiguchi
2014-06-02 22:44 ` Andrew Morton
2014-05-30 6:51 ` [PATCH 2/3] memory-failure: Don't let collect_procs() skip over processes for MF_ACTION_REQUIRED Naoya Horiguchi
2014-05-30 6:51 ` [PATCH 3/3] mm/memory-failure.c: support dedicated thread to handle SIGBUS(BUS_MCEERR_AO) Naoya Horiguchi
2014-06-02 22:42 ` Andrew Morton
2014-05-30 17:25 ` [PATCH 0/3] HWPOISON: improve memory error handling for multithread process Luck, Tony
[not found] ` <5388cd0e.463edd0a.755d.6f61SMTPIN_ADDED_BROKEN@mx.google.com>
2014-06-02 22:43 ` Andrew Morton
2014-06-02 23:37 ` Luck, Tony
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).