Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp885603ybj; Tue, 5 May 2020 09:05:27 -0700 (PDT) X-Google-Smtp-Source: APiQypLRP3BwOB4mM4czjb+1iEg8B2L7rsAy/6NQT5eTuRH5dVY2IP6gvPCIXRtDW+UFHM6HO6u2 X-Received: by 2002:a17:907:1185:: with SMTP id uz5mr3349460ejb.335.1588694726809; Tue, 05 May 2020 09:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588694726; cv=none; d=google.com; s=arc-20160816; b=I/qJ1ED6MPlFgnO1dG+fNu23M2HV2UUCNY4dkQC+Mder/fJCju/KnQ3j1sb+/fVao5 s/uGpzETCwp+qwu6pmheFxzlGDLGIntwvEZ+HO6Yvo74jyRFcdQEtnM2JORrkhqYKrfM YZUSET1kqjdfywcswFN0stWORs9FlU4Gx/Eirs62OAVnsY0IqeLs+WwxSUE5LYnGoTtU DhnRcmMi6lq/v0GqEY8FFokTX7Bkq1qPgF03ANf5pwAHqFn1fhg1KHJprtgAKTZ/psUN j98W3vWuA7aTKjOQ+tg6EruUnvgf4UKlP9FDXo0xpo0OtKrOHT2UChqzOO+FdkbdxuqZ 6ZoA== 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=2zMMIyHv2edv31X9vFLGSbS7MNUvOMMiRGUXf+alwY8=; b=cFmL6kLBGlc9U/lCQ5ScZF5rxRAQqILc90VpAyKlprXjHN5w5nrPN8OK7f76EIZBZc j4mYhscGWnXtakCrRQvuGvih6vqp7Sqhd7e6dWJ8mp9H71YPmeD1PytPGI+mV4h+YKAE NtaW3gwtruJ/Jx1mtQ3ix+JX5fsFqFdy74fzv2xori/s/NULxtr7LliFOpywc9X7/oWN hXWHotSEKGve/phACVi6Jen5+sZY4v4BmcuoXm3O2fEBRZLZprkIcapKRXN7+2v4dh3Z YR5Y/XGhb7SFBlPFzIqodQlLdK5nTjaJ5q1yytE2QG4aEfAtiO49AmwA/XSjQM1Q3w6D sx6Q== 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 z13si1408381eju.18.2020.05.05.09.05.01; Tue, 05 May 2020 09:05:26 -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 S1730114AbgEEQAU (ORCPT + 99 others); Tue, 5 May 2020 12:00:20 -0400 Received: from gate.crashing.org ([63.228.1.57]:53459 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729392AbgEEQAT (ORCPT ); Tue, 5 May 2020 12:00:19 -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 045Fxiqh012171; Tue, 5 May 2020 10:59:45 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 045FxikO012170; Tue, 5 May 2020 10:59:44 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 5 May 2020 10:59:44 -0500 From: Segher Boessenkool To: Christophe Leroy Cc: Michael Ellerman , 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: <20200505155944.GO31009@gate.crashing.org> References: <23e680624680a9a5405f4b88740d2596d4b17c26.1587143308.git.christophe.leroy@c-s.fr> <87sggecv81.fsf@mpe.ellerman.id.au> <1c6379b2-7e0a-91fe-34f0-51f5adca7929@csgroup.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1c6379b2-7e0a-91fe-34f0-51f5adca7929@csgroup.eu> 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 Tue, May 05, 2020 at 05:40:21PM +0200, Christophe Leroy wrote: > >>+#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 "<>". > > It was recommended by Segher, there has been some discussion about it on > v1 of this patch, see > https://patchwork.ozlabs.org/project/linuxppc-dev/patch/4fdc2aba6f5e51887d1cd0fee94be0989eada2cd.1586942312.git.christophe.leroy@c-s.fr/ > > As far as I understood that's mandatory on recent gcc to get the > pre-update form of the instruction. With older versions "m" was doing > the same, but not anymore. Yes. How much that matters depends on the asm. On older CPUs (6xx/7xx, say) the update form was just as fast as the non-update form. On newer or bigger CPUs it is usually executed just the same as an add followed by the memory access, so it just saves a bit of code size. > Should we ifdef the "m<>" or "m" based on GCC > version ? That will be a lot of churn. Just make 4.8 minimum? Segher