From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by ozlabs.org (Postfix) with ESMTP id 5E10E2C016A for ; Fri, 24 May 2013 23:02:17 +1000 (EST) Date: Fri, 24 May 2013 16:00:32 +0300 From: "Michael S. Tsirkin" To: Arnd Bergmann Subject: Re: [PATCH v2 07/10] powerpc: uaccess s/might_sleep/might_fault/ Message-ID: <20130524130032.GA10167@redhat.com> References: <2aa6c3da21a28120126732b5e0b4ecd6cba8ca3b.1368702323.git.mst@redhat.com> <201305221559.01806.arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <201305221559.01806.arnd@arndb.de> Cc: linux-m32r-ja@ml.linux-m32r.org, kvm@vger.kernel.org, Peter Zijlstra , Catalin Marinas , Will Deacon , David Howells , linux-mm@kvack.org, Paul Mackerras , "H. Peter Anvin" , linux-arch@vger.kernel.org, linux-am33-list@redhat.com, Hirokazu Takata , x86@kernel.org, Ingo Molnar , microblaze-uclinux@itee.uq.edu.au, Chris Metcalf , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Michal Simek , linux-m32r@ml.linux-m32r.org, linux-kernel@vger.kernel.org, Koichi Yasutake , linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, May 22, 2013 at 03:59:01PM +0200, Arnd Bergmann wrote: > On Thursday 16 May 2013, Michael S. Tsirkin wrote: > > @@ -178,7 +178,7 @@ do { \ > > long __pu_err; \ > > __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ > > if (!is_kernel_addr((unsigned long)__pu_addr)) \ > > - might_sleep(); \ > > + might_fault(); \ > > __chk_user_ptr(ptr); \ > > __put_user_size((x), __pu_addr, (size), __pu_err); \ > > __pu_err; \ > > > > Another observation: > > if (!is_kernel_addr((unsigned long)__pu_addr)) > might_sleep(); > > is almost the same as > > might_fault(); > > except that it does not call might_lock_read(). > > The version above may have been put there intentionally and correctly, but > if you want to replace it with might_fault(), you should remove the > "if ()" condition. > > Arnd Well not exactly. The non-inline might_fault checks the current segment, not the address. I'm guessing this is trying to do the same just without pulling in segment_eq, but I'd like a confirmation from more PPC maintainers. Guys would you ack - if (!is_kernel_addr((unsigned long)__pu_addr)) - might_fault(); + might_fault(); on top of this patch? Also, any volunteer to test this (not just test-build)? -- MST