Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp754980ybz; Wed, 15 Apr 2020 18:14:42 -0700 (PDT) X-Google-Smtp-Source: APiQypKFimqUW2xsEMQYavAV04whAVbs6IGZgHhxn74zLXmsd2icfSvariJlHu4tVqeZbrWyqzjm X-Received: by 2002:a17:906:6444:: with SMTP id l4mr7205406ejn.313.1586999682212; Wed, 15 Apr 2020 18:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586999682; cv=none; d=google.com; s=arc-20160816; b=HzRqBjb2S27wC6XuF782hVRLO5Q7yaYQR3wW0/vasttcLl5hZoEZIoklwnJ7OJUk/j 8ccWk62os+Qg0gCFbtZ2ut6zTt2BkrLFD7pQVA/UFEaR3JZlYEM64rjBzEAE7Fg96cwQ C2Sspi+hxu8ibK2+1dBbjRQp1wj7kyCvFEO63P6A/OHNEy4MOnIxdq5aAgv9nnwCButT qOIU5bHuoH6+IEGVj5E54bS3E1dHr05pJzYTUatv+ITJj3YNbNGmypjhntjEX5vFaLb7 scoWAy0w21WQ0UY03FFkc61TuCsQcHp7D5/k5THL3v/mPxLTdSLJ0AS6YxnPo75UD6mT lfMw== 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=0x/yrlZ8FJ7A4vvXN48RiV7cZ3VGk0WP/keOMA0yLOI=; b=k+wMIpoR4FaQbhFcVA/Io8rwgXqI5hPa4220VNDajKcZjW6hYOq0oPM58myJvVGo3m G5E23iIgZ/+T8Yel/xO/dKSVOcRKf6q8F8+au4fwf80/KcUHJNHtU4KBekMoCRjstRKm GnEZEJ5+FCWyCNYTbIvDAKFi+44PpEn0wD5GodyU6ef/3bn6X3VhGYHKYh4pFtvqaCRO 2BsF6s0tOcnn016iI7QIoLkId7HhBU2l6mBZe7NgovUc/1wRSXtArHK/9cMlKPzC/rrN Xq1XwJzsfDTu8FKSIBmYATBVQ4SkX7GOQLJBwm0TiKNt2i/FOUp1503FiPil4WEhvucA GbJw== 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 i17si2560320edu.511.2020.04.15.18.14.19; Wed, 15 Apr 2020 18:14:42 -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 S1732180AbgDOWiM (ORCPT + 99 others); Wed, 15 Apr 2020 18:38:12 -0400 Received: from gate.crashing.org ([63.228.1.57]:54212 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725800AbgDOWiI (ORCPT ); Wed, 15 Apr 2020 18:38:08 -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 03FMbmpQ029595; Wed, 15 Apr 2020 17:37:48 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 03FMblsA029594; Wed, 15 Apr 2020 17:37:47 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 15 Apr 2020 17:37:47 -0500 From: Segher Boessenkool To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , npiggin@gmail.com, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2] powerpc/uaccess: Implement unsafe_put_user() using 'asm goto' Message-ID: <20200415223747.GX26902@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Apr 15, 2020 at 09:25:59AM +0000, Christophe Leroy wrote: > +#define __put_user_goto(x, ptr, label) \ > + __put_user_nocheck_goto((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)), label) This line gets too long, can you break it up somehow? > +#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) \ > + : \ > + : label) Same "%Un" problem as in the other patch. You could use "m<>" here, but maybe just dropping "%Un" is better. > +#ifdef __powerpc64__ > +#define __put_user_asm2_goto(x, ptr, label) \ > + __put_user_asm_goto(x, ptr, label, "std") > +#else /* __powerpc64__ */ > +#define __put_user_asm2_goto(x, addr, label) \ > + asm volatile goto( \ > + "1: stw%U1%X1 %0, %1\n" \ > + "2: stw%U1%X1 %L0, %L1\n" \ > + EX_TABLE(1b, %l2) \ > + EX_TABLE(2b, %l2) \ > + : \ > + : "r" (x), "m" (*addr) \ > + : \ > + : label) > +#endif /* __powerpc64__ */ Here, you should drop it for sure. Rest looks fine. Reviewed-by: Segher Boessenkool Segher