Re: WARNING: at arch/x86_64/kernel/smp.c:397 smp_call_function_mask()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Fengguang Wu <wfg@...>
Cc: Andrew Morton <akpm@...>, Andi Kleen <ak@...>, <linux-kernel@...>
Date: Friday, September 28, 2007 - 4:52 am

Fengguang Wu wrote:
c8/2.6.23-rc8-mm2/

Thank you to report it.

on_mask()
0


the reason is the WARN_ON():

390 int smp_call_function_mask(cpumask_t mask,
391                            void (*func)(void *), void *info,
392                            int wait)
393 {
394         int ret;
395
396         /* Can deadlock when called with interrupts disabled */
397         WARN_ON(irqs_disabled());
398
399         spin_lock(&call_lock);
400         ret =3D __smp_call_function_mask(mask, func, info, wait);
401         spin_unlock(&call_lock);
402         return ret;
403 }

The patch I sent to Andi didn't include this WARN_ON() and it's why I did=
n't
find this issue. (see http://lkml.org/lkml/2007/8/24/101)

smp_call_function_mask() is called by smp_call_function() which calls a f=
unction
on all CPU except current.
The comment of smp_call_function() specifies:
=2E..
 * You must not call this function with disabled interrupts or from a
 * hardware interrupt handler or from a bottom half handler.
 * Actually there are a few legal cases, like panic.
 */

So this WARN_ON() is correct, and the caller (global_flush_tlb()) doesn't=
 follow
this rule.

I guess this WARN_ON() is only needed when we have current CPU in provide=
d mask.
So I think we should change:

int smp_call_function (void (*func) (void *info), void *info, int nonatom=
ic,
                        int wait)
{
        return smp_call_function_mask(cpu_online_map, func, info, wait);
}
("cpu_online_map" is a bad choice, comment also specifies: "run a functio=
n on
all other CPU")

to

int smp_call_function (void (*func) (void *info), void *info, int nonatom=
ic,
                        int wait)
{
        int ret;
	cpumask_t allbutself;

	allbutself =3D cpu_online_map;
	cpu_clear(smp_processor_id(), allbutself);

        spin_lock(&call_lock);
        ret =3D __smp_call_function_mask(allbutself, func, info, wait);
        spin_unlock(&call_lock);
        return ret;
}
(which is smp_call_function_mask() without the WARN_ON() and without curr=
ent cpu
in the mask)

Andi, is this correct ?
Andrew, should I send a patch implementing this change ?

Regards,
Laurent
--=20
------------- Laurent.Vivier@bull.net  --------------
          "Software is hard" - Donald Knuth
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.23-rc8-mm2, Andrew Morton, (Thu Sep 27, 5:22 am)
Re: 2.6.23-rc8-mm2, Matt Mackall, (Tue Oct 9, 1:49 pm)
Re: 2.6.23-rc8-mm2 - PowerPC link failure at arch/powerpc/ke..., Kamalesh Babulal, (Sun Sep 30, 12:10 am)
Re: 2.6.23-rc8-mm2, , (Sat Sep 29, 10:26 pm)
Re: 2.6.23-rc8-mm2, Andrew Morton, (Sun Sep 30, 4:50 am)
Re: 2.6.23-rc8-mm2, , (Mon Oct 1, 12:12 pm)
Re: 2.6.23-rc8-mm2, Rafael J. Wysocki, (Sun Sep 30, 4:01 pm)
Re: 2.6.23-rc8-mm2, , (Mon Oct 1, 1:12 pm)
Re: 2.6.23-rc8-mm2, Dave Young, (Sat Sep 29, 5:37 am)
Re: 2.6.23-rc8-mm2, Greg KH, (Sat Sep 29, 11:19 am)
Re: 2.6.23-rc8-mm2, Dave Young, (Mon Oct 8, 2:43 am)
Re: 2.6.23-rc8-mm2, , (Sun Sep 30, 1:18 am)
Re: 2.6.23-rc8-mm2, Dave Young, (Sat Sep 29, 9:29 pm)
/proc/net/ bad hard links count [Was: 2.6.23-rc8-mm2], Jiri Slaby, (Fri Sep 28, 12:30 pm)
Re: /proc/net/ bad hard links count [Was: 2.6.23-rc8-mm2], Eric W. Biederman, (Fri Sep 28, 1:03 pm)
Re: 2.6.23-rc8-mm2 - tcp_fastretrans_alert() WARNING, Cedric Le Goater, (Fri Sep 28, 11:42 am)
Re: 2.6.23-rc8-mm2 - tcp_fastretrans_alert() WARNING, Ilpo Järvinen, (Fri Sep 28, 3:10 pm)
Re: 2.6.23-rc8-mm2 - tcp_fastretrans_alert() WARNING, Ilpo Järvinen, (Sat Sep 29, 8:44 am)
Re: 2.6.23-rc8-mm2 - tcp_fastretrans_alert() WARNING, Cedric Le Goater, (Sat Sep 29, 10:55 am)
Re: 2.6.23-rc8-mm2 - tcp_fastretrans_alert() WARNING, Ilpo Järvinen, (Sat Sep 29, 4:49 pm)
Re: 2.6.23-rc8-mm2 - tcp_fastretrans_alert() WARNING, Cedric Le Goater, (Mon Oct 1, 5:26 am)
Re: 2.6.23-rc8-mm2 - tcp_fastretrans_alert() WARNING, Ilpo Järvinen, (Tue Oct 2, 6:26 am)
Re: 2.6.23-rc8-mm2 - tcp_fastretrans_alert() WARNING, Ilpo Järvinen, (Tue Oct 2, 4:06 pm)
Re: 2.6.23-rc8-mm2 - tcp_fastretrans_alert() WARNING, Ilpo Järvinen, (Tue Oct 2, 5:48 pm)
Re: WARNING: at arch/x86_64/kernel/smp.c:397 smp_call_functi..., Laurent Vivier, (Fri Sep 28, 4:52 am)
Re: 2.6.23-rc8-mm2: BUG near reiserfs_xattr_set, Laurent Riffard, (Thu Sep 27, 3:18 pm)
Re: 2.6.23-rc8-mm2: BUG near reiserfs_xattr_set, Andrew Morton, (Thu Sep 27, 3:48 pm)
Re: 2.6.23-rc8-mm2: BUG near reiserfs_xattr_set, Christoph Hellwig, (Thu Sep 27, 4:26 pm)
Re: [RFC][PATCH] make reiserfs stop using 'struct file' for ..., Christoph Hellwig, (Thu Sep 27, 5:04 pm)
Re: [RFC][PATCH] make reiserfs stop using 'struct file' for ..., Christoph Hellwig, (Fri Sep 28, 3:16 am)
[RFC][PATCH] stop abusing filp_open in reiserfs journal code, Christoph Hellwig, (Fri Sep 28, 3:29 am)
Re: 2.6.23-rc8-mm2: BUG near reiserfs_xattr_set, Dave Hansen, (Thu Sep 27, 4:05 pm)
Re: 2.6.23-rc8-mm2: problems on HP nx6325, Rafael J. Wysocki, (Thu Sep 27, 11:19 am)
Re: 2.6.23-rc8-mm2: problems on HP nx6325, Rafael J. Wysocki, (Thu Sep 27, 11:59 am)
Re: 2.6.23-rc8-mm2: problems on HP nx6325, Sam Ravnborg, (Thu Sep 27, 12:53 pm)
Re: 2.6.23-rc8-mm2: problems on HP nx6325, Randy Dunlap, (Thu Sep 27, 1:33 pm)
Re: 2.6.23-rc8-mm2: problems on HP nx6325, Sam Ravnborg, (Thu Sep 27, 3:19 pm)
Re: 2.6.23-rc8-mm2: problems on HP nx6325, Rafael J. Wysocki, (Thu Sep 27, 3:48 pm)
Re: 2.6.23-rc8-mm2: problems on HP nx6325, Randy Dunlap, (Thu Sep 27, 3:37 pm)
Re: 2.6.23-rc8-mm2: problems on HP nx6325, Rafael J. Wysocki, (Thu Sep 27, 4:01 pm)
Re: 2.6.23-rc8-mm2: problems on HP nx6325, Thomas Gleixner, (Thu Sep 27, 11:49 am)
Re: 2.6.23-rc8-mm2: problems on HP nx6325, Rafael J. Wysocki, (Fri Sep 28, 5:31 pm)
Re: 2.6.23-rc8-mm2 - drivers/net/ibm_newemac/mal - broken, Kamalesh Babulal, (Thu Sep 27, 6:52 am)