Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp857849ybj; Tue, 5 May 2020 08:38:10 -0700 (PDT) X-Google-Smtp-Source: APiQypJgwpKRy8shWrW9JMQBFtDOfRpr2l5+TfBQTK/sEWzZDRPPEf98bVk2xtaScaGGLXENvRHr X-Received: by 2002:a50:f058:: with SMTP id u24mr2981838edl.171.1588693090520; Tue, 05 May 2020 08:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588693090; cv=none; d=google.com; s=arc-20160816; b=Mv5BMOfhYtqqd8LqLYFNlkAEypTI0JFmOE9tC7NYx3I4K4+igUup6lfSBoMhVre7LH Ga5O6gwT/xN1xHolUZNphr8kQdPgFZVTmK+lLOuqrkYWJY0Yn9xIcL5so7q0kGaoYblg qRZWRW9n/GrP1jWIPN0khVqJhcLs7PJFSTovQ7wRyq2WmregU9u5UJhnOv6beMs7GaY4 JH8MnYR/woV5IgQHjzofF0ZFWGZ7j2FZye/ZM+AicUrmKwINvOZHA+7Ebxlyi5vA51fY HuYyeCzg02rwKcOk+sTBjZ+UVP2QowRN1vVQpuaIqdz7GZXeIOYH/L7GwPIV3BMONiNc 70HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ciJdAe2cmVkpKh6oCbIb/EqJdN2UKKlLnScj0+ib0e4=; b=h3ZeM92Njh0LzOMusxm2UNThoAGMcgbdVwmh5FD8o+U0jnsnTPjRnEvKfQAScVEAym 07l4o6QjdmTocXy3mwR8B++OxVMDi4HqLsue0hYGrKU77n964zUrnK+hBJaAkXPCqPpT hXQp6N+GfXgg6iadOGvVvakSyKsf3QRV6+CHmyM1hsROgamj4hTXFRatnvUaK3f4bWm5 0qchxbn9GRTtKlJe8FK7wm9S5GPmAbR01oEAwaYqvqos1IkA8Paw2Yr5sygH+BaXP4n/ wVAQjtW7TUjyVVWZOTxPio//E1RJPMwS7oCQ54rBxAgErUoUPuuAZKQuRJh2vrZu14/7 5jSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo2si1521357edb.438.2020.05.05.08.37.42; Tue, 05 May 2020 08:38:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730352AbgEEPdQ (ORCPT + 99 others); Tue, 5 May 2020 11:33:16 -0400 Received: from gate.crashing.org ([63.228.1.57]:42699 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730346AbgEEPdP (ORCPT ); Tue, 5 May 2020 11:33:15 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 045FWkQB009965; Tue, 5 May 2020 10:32:46 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 045FWjVS009961; Tue, 5 May 2020 10:32:45 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 5 May 2020 10:32:45 -0500 From: Segher Boessenkool To: Michael Ellerman Cc: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , npiggin@gmail.com, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v4 1/2] powerpc/uaccess: Implement unsafe_put_user() using 'asm goto' Message-ID: <20200505153245.GN31009@gate.crashing.org> References: <23e680624680a9a5405f4b88740d2596d4b17c26.1587143308.git.christophe.leroy@c-s.fr> <87sggecv81.fsf@mpe.ellerman.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87sggecv81.fsf@mpe.ellerman.id.au> User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! On Wed, May 06, 2020 at 12:27:58AM +1000, Michael Ellerman wrote: > Christophe Leroy writes: > > unsafe_put_user() is designed to take benefit of 'asm goto'. > > > > Instead of using the standard __put_user() approach and branch > > based on the returned error, use 'asm goto' and make the > > exception code branch directly to the error label. There is > > no code anymore in the fixup section. > > > > This change significantly simplifies functions using > > unsafe_put_user() > > > ... > > > > Signed-off-by: Christophe Leroy > > --- > > arch/powerpc/include/asm/uaccess.h | 61 +++++++++++++++++++++++++----- > > 1 file changed, 52 insertions(+), 9 deletions(-) > > > > diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h > > index 9cc9c106ae2a..9365b59495a2 100644 > > --- a/arch/powerpc/include/asm/uaccess.h > > +++ b/arch/powerpc/include/asm/uaccess.h > > @@ -196,6 +193,52 @@ do { \ > > }) > > > > > > +#define __put_user_asm_goto(x, addr, label, op) \ > > + asm volatile goto( \ > > + "1: " op "%U1%X1 %0,%1 # put_user\n" \ > > + EX_TABLE(1b, %l2) \ > > + : \ > > + : "r" (x), "m<>" (*addr) \ > > The "m<>" here is breaking GCC 4.6.3, which we allegedly still support. [ You shouldn't use 4.6.3, there has been 4.6.4 since a while. And 4.6 is nine years old now. Most projects do not support < 4.8 anymore, on any architecture. ] > Plain "m" works, how much does the "<>" affect code gen in practice? > > A quick diff here shows no difference from removing "<>". It will make it impossible to use update-form instructions here. That probably does not matter much at all, in this case. If you remove the "<>" constraints, also remove the "%Un" output modifier? Segher