Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932701AbbDJSJl (ORCPT ); Fri, 10 Apr 2015 14:09:41 -0400 Received: from mail-ig0-f177.google.com ([209.85.213.177]:38028 "EHLO mail-ig0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932470AbbDJSJi (ORCPT ); Fri, 10 Apr 2015 14:09:38 -0400 MIME-Version: 1.0 In-Reply-To: <20150410180425.GC6563@gmail.com> References: <20150409175652.GI6464@linux.vnet.ibm.com> <20150409183926.GM6464@linux.vnet.ibm.com> <20150410090051.GA28549@gmail.com> <20150410091252.GA27630@gmail.com> <20150410092152.GA21332@gmail.com> <20150410111427.GA30477@gmail.com> <20150410180425.GC6563@gmail.com> Date: Fri, 10 Apr 2015 11:09:37 -0700 X-Google-Sender-Auth: fo9m1GyaBcE9sJ2KlzvDpDTDeVM Message-ID: Subject: Re: [PATCH] x86/uaccess: Implement get_kernel() From: Linus Torvalds To: Ingo Molnar Cc: "Paul E. McKenney" , Jason Low , Peter Zijlstra , Davidlohr Bueso , Tim Chen , Aswin Chandramouleeswaran , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1601 Lines: 44 On Fri, Apr 10, 2015 at 11:04 AM, Ingo Molnar wrote: > >> >> So maybe "get_kernel_stalepointer()" or something like that. > > Ok. Note that I'm not at all married to that particular name, I just want something that describes the requirements a bit more. >> - I think we should look at sharing the code for __get_user(). Could >> we do something like this: >> >> (a) implement the basic "load with exceptions" as __get_with_exception() >> (b) #define get_kernel_stalepointer() __get_with_exception >> (c) make "__get_user()" be "stac(); __get_with_exception(); clac()" > > Will try. > > The only possible complication there might be the way we don't recover > the error code in the _ex() variants, that's actually a pretty > important aspect to making this zero cost. Yeah. You may be right. What I would really want is that "asm goto" with an output register, but gcc doesn't do that. Then we could improve on the whole try/catch thing too, so that it would just jump to the catch.. >> #ifdef CONFIG_DEBUG_PAGEALLOC >> #define get_kernel_stalepointer(x,ptr) ((x)=READ_ONCE(*(ptr)), 0) >> #else >> #define get_kernel_stalepointer(x,ptr) __get_with_exception(x,ptr) >> #endif > > I guess you meant that to be the other way around? Yes I did. Linus -- 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/