Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp783667ybj; Tue, 5 May 2020 07:30:02 -0700 (PDT) X-Google-Smtp-Source: APiQypJkmv4uTqa4RnRX4W9+Bf1RBMHqbVaGqlaifCohmSFl3HcRMy3081Mr/i+jEJFRVAuVziyH X-Received: by 2002:a05:6402:887:: with SMTP id e7mr3015656edy.178.1588689002805; Tue, 05 May 2020 07:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588689002; cv=none; d=google.com; s=arc-20160816; b=At2q5/ZpIeKTWOotwOC96cN2vvUOTZuiihYkEvqPEpwQNF5U+RfPVAs/j5nR9BzZw1 zzCpz0PeENgdu0vKDPeTUNtzpCnYFrDQyM9/NOUEpcjKXdoKWv4Emp08mAcVLuSv5zbv uwG5MKKZ+V+wk25C/DnU7ZhNuPwTI66zPtJxkHYicuNCXUxQsLGnlzgiEe1M6UBOchCu eonLdUqLJbrnLb28PHcHpgienebkBMV4FreWvirJ1RS3sb5WDbgjvgFZ5ZY6pyVsFgnY EJUr3CbATfZ5kEpKJ1TPhNmegxD2gqHcwX1JlfL5L18bs1n0bWGUFyR0igz8ed7AuKEO j9Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=frl7h1qFU7Dxxfj4Gb9FVyfaImKnduvzdWX70qfEYWk=; b=UtHpH3LSS8CBV+2pcakQteC4KlSCUM9ZGC6bbJVTLvSQnlkZ8B4nS3y6EXbhKD+Hsb J984U7/0PxxYQKdXx8exqYrTsOfVGm0jY4HKMlSneHxmVQbwjuIKoeBZ6WpcuwCR/phy zpP24Sajm3mGz36fRGUdDaUmJtnwz7TdNNrjLoq8IE4Kws77laOYJ/9Gr1QDh9iu21ew RUSvR2SnodUjZYA1vyu09VY0I9jq5uN4Xe5VRzz0PJRWDgbAdv7Joh3zgIxNZhUVHTkd AAZpGZF2YLvH0p5kKHKmZTPwV4Bs0CSiPJtiXe4VWpAHlqCOmc3fW/pyZ5B9lnsOron4 ieWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=AYudScwg; 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 z13si1246463eju.18.2020.05.05.07.29.34; Tue, 05 May 2020 07:30:02 -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; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=AYudScwg; 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 S1729415AbgEEO1u (ORCPT + 99 others); Tue, 5 May 2020 10:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729275AbgEEO1t (ORCPT ); Tue, 5 May 2020 10:27:49 -0400 Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E68BFC061A10 for ; Tue, 5 May 2020 07:27:48 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 49Ghrw1s5zz9sTp; Wed, 6 May 2020 00:27:43 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1588688864; bh=tKWmkjZzDQuTCUpYsJT44pgEzBrMuLquVBArlnJPTok=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=AYudScwgGeF513DR39+vld/7XBnzPx/RmHX/ZpsMbR2xXEUEL2wuQW4p4g7Kvsisv 9BkStSD8LskDREEIZEUcnucf5n8bIAP/kQu2rNGVG4fIKIdYaiLi+vc3W32DET/0hz 5nsmqgrX3/E2FGtgYlYHZLqT5wY+S9qw+8b60lg/xiFk9lQCri05hPLII8zOg03WtG PzAzrymQXDPh8UfjPGwC7IuvwSJwXnjW1UDF04L9jrzlQAsxufL0jpsgaVkvW/fPcm FkzgDihqutVRnj1lbOzrs8G2my6pLc9rXtAY5CntiQp+YF12WDNjpeIJ+Iwrq2Q2bI 9B+Cn2SIClkKg== From: Michael Ellerman To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , npiggin@gmail.com, segher@kernel.crashing.org Cc: 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' In-Reply-To: <23e680624680a9a5405f4b88740d2596d4b17c26.1587143308.git.christophe.leroy@c-s.fr> References: <23e680624680a9a5405f4b88740d2596d4b17c26.1587143308.git.christophe.leroy@c-s.fr> Date: Wed, 06 May 2020 00:27:58 +1000 Message-ID: <87sggecv81.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Plain "m" works, how much does the "<>" affect code gen in practice? A quick diff here shows no difference from removing "<>". cheers