public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Jason Baron <jbaron@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	rostedt@goodmis.org, mingo@elte.hu, mathieu.desnoyers@polymtl.ca,
	hpa@zytor.com, tglx@linutronix.de, andi@firstfloor.org,
	roland@redhat.com, rth@redhat.com,
	masami.hiramatsu.pt@hitachi.com, fweisbec@gmail.com,
	avi@redhat.com, davem@davemloft.net, sam@ravnborg.org,
	michael@ellerman.id.au, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] jump label: add enabled/disabled state to jump	label key entries
Date: Wed, 24 Nov 2010 08:56:01 -0800	[thread overview]
Message-ID: <4CED43A1.7020402@caviumnetworks.com> (raw)
In-Reply-To: <20101124154200.GD2815@redhat.com>

On 11/24/2010 07:42 AM, Jason Baron wrote:
> On Wed, Nov 24, 2010 at 04:24:05PM +0100, Peter Zijlstra wrote:
>> On Wed, 2010-11-24 at 10:19 -0500, Jason Baron wrote:
>>> On Wed, Nov 24, 2010 at 04:11:18PM +0100, Peter Zijlstra wrote:
>>>> On Wed, 2010-11-24 at 09:54 -0500, Jason Baron wrote:
>>>>> On Wed, Nov 24, 2010 at 09:20:09AM +0100, Peter Zijlstra wrote:
>>>>>> On Tue, 2010-11-23 at 16:27 -0500, Jason Baron wrote:
>>>>>>>          struct hlist_head modules;
>>>>>>>          unsigned long key;
>>>>>>> +       u32 nr_entries : 31,
>>>>>>> +              enabled :  1;
>>>>>>>   };
>>>>>>
>>>>>> I still don't see why you do this, why not simply mandate that the key
>>>>>> is of type atomic_t* and use *key as enabled state?
>>>>>>
>>>>>
>>>>> Because I want to use *key as a pointer directly to 'struct jump_label_entry'.
>>>>> In this way jump_label_enable(), jump_label_disable(), become O(1) operations.
>>>>> That way we don't need any hashing.
>>>>
>>>> But but but, you're doing a friggin stop_machine to poke text, that's
>>>> way more expensive than anything else.
>>>>
>>>
>>> Yes, but other arches do not require stop_machine(). Also, there is work
>>> for x86 to make the code patching happen without stop_machine().
>>
>> Even without stop machine you're sending IPIs to all CPUs, that's not
>> free either.
>>
>> And I think the only arch where you can do text pokes without cross-cpu
>> synchronization is one that doesn't have SMP support.
>>
>>
>
> is this really true?
>

For MIPS SMP it is.  ICache invalidation is done per CPU.  If you need 
the change to be visible on all CPUs, you have to do an IPI to get all 
CPUs to do their own ICache invalidation.


> The powerpc implementation uses patch_instruction():
>
>
> arch/powerpc/lib/code-patching.c:
>
> void patch_instruction(unsigned int *addr, unsigned int instr)
> {
>          *addr = instr;
>          asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r"
> (addr));
> }
>
>
> And sparc does uses flushi():
>
>
> include/asm/system_64.h:
>
> #define flushi(addr)    __asm__ __volatile__ ("flush %0" : : "r" (addr)
> : "memory")
>

I don't know how SPARC and PPC work, but does that really work on SMP 
(or even NUMA) machines?

David Daney

  parent reply	other threads:[~2010-11-24 16:56 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 21:27 [PATCH 0/3] jump label: updates for 2.6.37 Jason Baron
2010-11-23 21:27 ` [PATCH 1/3] jump label: add enabled/disabled state to jump label key entries Jason Baron
2010-11-23 23:43   ` Mathieu Desnoyers
2010-11-24  0:00     ` Steven Rostedt
2010-11-24  0:24       ` Mathieu Desnoyers
2010-11-24 18:24         ` Jason Baron
2010-11-24 18:39           ` Peter Zijlstra
2010-11-24 19:07             ` Jason Baron
2010-11-24  8:20   ` Peter Zijlstra
2010-11-24 14:54     ` Jason Baron
2010-11-24 15:11       ` Peter Zijlstra
2010-11-24 15:19         ` Jason Baron
2010-11-24 15:24           ` Peter Zijlstra
2010-11-24 15:42             ` Jason Baron
2010-11-24 15:53               ` Steven Rostedt
2010-11-25  2:39                 ` Michael Ellerman
2010-11-25  6:52                   ` Peter Zijlstra
2010-11-25 13:14                     ` Mathieu Desnoyers
2010-11-25 13:42                     ` Michael Ellerman
2010-11-25 21:26                       ` Benjamin Herrenschmidt
2010-11-24 16:56               ` David Daney [this message]
2010-11-24 15:15       ` Steven Rostedt
2010-11-24 15:21         ` Jason Baron
2010-11-24 15:25           ` Peter Zijlstra
2010-11-24 15:57           ` Steven Rostedt
2010-11-24 19:18             ` Jason Baron
2010-11-24 15:21         ` Peter Zijlstra
2010-11-23 21:27 ` [PATCH 2/3] jump label: move jump table to r/w section Jason Baron
2010-11-23 23:55   ` Mathieu Desnoyers
2010-11-24  0:04     ` Steven Rostedt
2010-11-24  0:27       ` Mathieu Desnoyers
2010-11-24  0:35         ` Steven Rostedt
2010-11-24  2:18     ` Steven Rostedt
2010-11-24  2:59       ` Steven Rostedt
2010-11-23 21:27 ` [PATCH 3/3] jump label: add docs Jason Baron
2010-11-23 21:36 ` [PATCH 0/3] jump label: updates for 2.6.37 H. Peter Anvin
2010-11-23 23:11   ` Steven Rostedt
2010-11-23 23:32     ` H. Peter Anvin
2010-11-24  0:10       ` Steven Rostedt
2010-11-24  0:36         ` Steven Rostedt
2010-11-24  0:37           ` H. Peter Anvin
2010-11-23 21:42 ` Steven Rostedt
2010-11-23 21:56   ` Jason Baron
2010-11-23 23:10     ` Steven Rostedt
2010-11-24  8:29       ` Peter Zijlstra
2010-11-24  9:21         ` Andi Kleen
2010-11-24 12:47         ` Steven Rostedt
2010-11-24 13:49           ` Steven Rostedt

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=4CED43A1.7020402@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=michael@ellerman.id.au \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=roland@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=rth@redhat.com \
    --cc=sam@ravnborg.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox