All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Luca Tettamanti <kronos.it@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix SMP alternatives : use mutex instead of spinlock, text_poke is sleepable
Date: Thu, 1 May 2008 16:08:59 -0400	[thread overview]
Message-ID: <20080501200858.GA12246@Krystal> (raw)
In-Reply-To: <alpine.LFD.1.10.0805011151521.5994@woody.linux-foundation.org>

* Linus Torvalds (torvalds@linux-foundation.org) wrote:
> 
> 
> On Thu, 1 May 2008, Mathieu Desnoyers wrote:
> > 
> > Yep. I think using a mutex should fix it. There is no reason to use a
> > spinlock rather than a mutex here.
> 
> Is there any reason to do any locking what-so-ever?
> 
> If this code could possibly race with something else, that sounds like a 
> bug in itself, no?
> 
> 		Linus

The smp_alt mutex taken in
alternatives_smp_module_add/alternatives_smp_module_del seems required
because this code will run at module load/free, even in SMP context (not
within stop_machine_run).

As for alternatives_smp_switch, which is called when switching between
UP and SMP, always in UP context, I guess we should assume it could be
executed concurrently wrt the module_load/free, even in UP on a
CONFIG_PREEMPT kernel.

Mathieu


-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  reply	other threads:[~2008-05-01 20:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-30 19:51 [BUG] smp alternatives: sleeping function called from invalid context Luca Tettamanti
2008-05-01 13:04 ` Mathieu Desnoyers
2008-05-01 15:02   ` Luca Tettamanti
2008-05-01 16:44     ` Luca Tettamanti
2008-05-01 18:46       ` [PATCH] Fix SMP alternatives : use mutex instead of spinlock, text_poke is sleepable Mathieu Desnoyers
2008-05-01 18:52         ` Linus Torvalds
2008-05-01 20:08           ` Mathieu Desnoyers [this message]
     [not found] <20080413224207.4430a09c@daedalus.pq.iki.fi>
2008-04-13 20:05 ` [BUG/PATCH] x86 mmiotrace: dynamically disable non-boot CPUs Pekka Paalanen
2008-04-14  6:57   ` Ingo Molnar
2008-04-19 15:41     ` [BUG] kmalloc_node(GFP_KERNEL) while smp_alt spinlocked Pekka Paalanen
2008-04-19 16:19       ` [PATCH] Fix SMP alternatives : use mutex instead of spinlock, text_poke is sleepable Mathieu Desnoyers
2008-04-19 21:06         ` Pekka Paalanen

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=20080501200858.GA12246@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=kronos.it@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.