Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758823AbZCCAXU (ORCPT ); Mon, 2 Mar 2009 19:23:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753490AbZCCAXJ (ORCPT ); Mon, 2 Mar 2009 19:23:09 -0500 Received: from mx2.mail.elte.hu ([157.181.151.9]:56384 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751598AbZCCAXI (ORCPT ); Mon, 2 Mar 2009 19:23:08 -0500 Date: Tue, 3 Mar 2009 01:22:14 +0100 From: Ingo Molnar To: Masami Hiramatsu Cc: Mathieu Desnoyers , Andrew Morton , Nick Piggin , Steven Rostedt , Andi Kleen , linux-kernel@vger.kernel.org, Thomas Gleixner , Peter Zijlstra , Frederic Weisbecker , Linus Torvalds , Arjan van de Ven , Rusty Russell , "H. Peter Anvin" , Steven Rostedt Subject: Re: [RFC][PATCH] x86: make text_poke() atomic Message-ID: <20090303002214.GA4147@elte.hu> References: <49A853CD.3020607@redhat.com> <49AC10E9.1090102@redhat.com> <20090302171914.GB21735@Krystal> <49AC5A87.7000604@redhat.com> <20090302222254.GA31962@elte.hu> <49AC63FA.70801@redhat.com> <20090302230915.GA11626@elte.hu> <49AC6DEA.2050304@redhat.com> <20090302234910.GA17956@elte.hu> <49AC7453.8020307@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49AC7453.8020307@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-ELTE-VirusStatus: clean X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.3 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1798 Lines: 47 * Masami Hiramatsu wrote: > > > Ingo Molnar wrote: > > * Masami Hiramatsu wrote: > > > >> Ingo Molnar wrote: > >>>>> So perhaps another approach to (re-)consider would be to go back > >>>>> to atomic fixmaps here. It spends 3 slots but that's no big > >>>>> deal. > >>>> Oh, it's a good idea! fixmaps must make it simpler. > >>>> > >>>>> In exchange it will be conceptually simpler, and will also scale > >>>>> much better than a global spinlock. What do you think? > >>>> I think even if I use fixmaps, we have to use a spinlock to protect > >>>> the fixmap area from other threads... > >>> that's why i suggested to use an atomic-kmap, not a fixmap. > >> Even if the mapping is atomic, text_poke() has to protect pte > >> from other text_poke()s while changing code. > >> AFAIK, atomic-kmap itself doesn't ensure that, does it? > > > > Well, but text_poke() is not a serializing API to begin with. > > It's normally used in code patching sequences when we 'know' > > that there cannot be similar parallel activities. The kprobes > > usage of text_poke() looks unsafe - and that needs to be fixed. > > Oh, kprobes already prohibited parallel arming/disarming > by using kprobe_mutex. :-) yeah, but still the API is somewhat unsafe. In any case, you also answered your own question: > >> Even if the mapping is atomic, text_poke() has to protect pte > >> from other text_poke()s while changing code. > >> AFAIK, atomic-kmap itself doesn't ensure that, does it? kprobe_mutex does that. Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/