Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp114000ybj; Wed, 6 May 2020 12:53:21 -0700 (PDT) X-Google-Smtp-Source: APiQypJKmlOn22hl3teax4e2APwzbBXJLrkQJjxhPMVe/66utU9SUZHLlV+QFJ89YTd/CmIqks0k X-Received: by 2002:a05:6402:6d5:: with SMTP id n21mr8894679edy.82.1588794801204; Wed, 06 May 2020 12:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588794801; cv=none; d=google.com; s=arc-20160816; b=z2k8ogQqPz+cf55Jv9LO9EgiG0KPekKor8H/lex2+sd0jmkyNpH7gfet5M9TCRrGGK dhTeelNRAK8p7j9jBztS5o0P6LFvjYJ+n/Z4JjRy8IhuOPFG14glKfZ9ARU4AqDxftcD 4jKF8PnhFCmg7puTvUta0fcYzYZnJf5a/WqK2Rtm6lwB821PReDZoHgsB1pA1N5vxK+A K6uxTVE7QZANCZTS4bHiAQcjBMcFKDdwW6iAhwROPldrxwZY57cOEV8swonp2xF8TqxC T/K01q3aP70GIDJPyew/g2xxdCqL5GzLLFw5lTT5HrWjlZkTy/6+08IF1SxjNjvX05kT Q2fQ== 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=z/PO03kojR8Or+DXP71enYvG9Uf8RdPP4vtyevWleL0=; b=c8pHcyn6cGtd0byqjbyDA5pt2oOfzdf1CeUZweyfAOedeOM/a3WqBKrtEMqHRO9xXn MGdMShju1qE/FrENeeX+7zYNdgSLhHhqaruBxNdq/3XgRNOrHI8AUWeLDS2VxX32uJVh AbRB5SlXeiEXypeW8PoL3+IYLoyVPOsg5lHlS8bZRkrJeba74tq+SAnzWnSetL09Wah3 Kiae+mVHfzXkKlmbJB3OmFpAzpayl8pGK9GlOLOLK4x+kw1htAA93vk6h8pRKeW1VuOi 1Jl/JMxvhFQRwFiG+lcadDTY7MZnxNztKjyqDopThD8xTChyon6V94OJ0XqNAQuaMCtt ReNg== 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 p7si1662680edx.98.2020.05.06.12.52.58; Wed, 06 May 2020 12:53:21 -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 S1729467AbgEFR7P (ORCPT + 99 others); Wed, 6 May 2020 13:59:15 -0400 Received: from gate.crashing.org ([63.228.1.57]:53441 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728082AbgEFR7P (ORCPT ); Wed, 6 May 2020 13:59: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 046HwoSC014327; Wed, 6 May 2020 12:58:50 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 046HwnT3014321; Wed, 6 May 2020 12:58:49 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 6 May 2020 12:58:49 -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: <20200506175849.GT31009@gate.crashing.org> References: <23e680624680a9a5405f4b88740d2596d4b17c26.1587143308.git.christophe.leroy@c-s.fr> <87sggecv81.fsf@mpe.ellerman.id.au> <20200505153245.GN31009@gate.crashing.org> <87pnbhdgkw.fsf@mpe.ellerman.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87pnbhdgkw.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 On Wed, May 06, 2020 at 10:58:55AM +1000, Michael Ellerman wrote: > >> 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. ] > > Moving up to 4.6.4 wouldn't actually help with this though would it? Nope. But 4.6.4 is a bug-fix release, 91 bugs fixed since 4.6.3, so you should switch to it if you can :-) > Also I have 4.6.3 compilers already built, I don't really have time to > rebuild them for 4.6.4. > > The kernel has a top-level minimum version, which I'm not in charge of, see: > > https://www.kernel.org/doc/html/latest/process/changes.html?highlight=gcc Yes, I know. And it is much preferred not to have stricter requirements for Power, I know that too. Something has to give though :-/ > There were discussions about making 4.8 the minimum, but I'm not sure > where they got to. Yeah, just petered out I think? All significant distros come with a 4.8 as system compiler. > >> 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? > > So like this? > > diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h > index 62cc8d7640ec..ca847aed8e45 100644 > --- a/arch/powerpc/include/asm/uaccess.h > +++ b/arch/powerpc/include/asm/uaccess.h > @@ -207,10 +207,10 @@ do { \ > > #define __put_user_asm_goto(x, addr, label, op) \ > asm volatile goto( \ > - "1: " op "%U1%X1 %0,%1 # put_user\n" \ > + "1: " op "%X1 %0,%1 # put_user\n" \ > EX_TABLE(1b, %l2) \ > : \ > - : "r" (x), "m<>" (*addr) \ > + : "r" (x), "m" (*addr) \ > : \ > : label) Like that. But you will have to do that to *all* places we use the "<>" constraints, or wait for more stuff to fail? And, there probably are places we *do* want update form insns used (they do help in some loops, for example)? Segher