Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1365844ybj; Tue, 5 May 2020 19:10:44 -0700 (PDT) X-Google-Smtp-Source: APiQypLr2E2FZ/5g5PkaPIYcbzK3p2ZEhjdQ4x1j3avR3S1E/pVSsYwuqHdaal4IFBPC/Yb7nCmY X-Received: by 2002:a50:9547:: with SMTP id v7mr5223178eda.324.1588731044378; Tue, 05 May 2020 19:10:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588731044; cv=none; d=google.com; s=arc-20160816; b=ertCJcyzo+c7Yg5LnG7Ad+g4gn/PsK+WH7oi0Pytg4ixRrv9xyvGIubunTPVLUmfJy kHUa5BEoGnFeGILZH53iHNcIGcghfAxFnQlJ24E18Qc+aaLIAdX2Nu4PecwDNld1QFev 6LP3GetjNjXYIfz8rb3t+u3sOB26CQgOW+9rJI98+FodNf7HuKmcuq8LF6UPf81Ow+I0 4XVxRz0X/K5K8EBwOPXyLgzxrXUdLHLfzfKkPwZ+S2is6YRmakCsBpBSQjYAVEMa9or3 XsixMByY/Ih6Rx/MJhxg8RQMMs73T649Vx/y0FicWcs6++x7LREVnG/GeUZ9C8eiX8pz ACbA== 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=RSH0qOM6Feqz5b8xEkcWFiWHn6bDPKN59xqOEPzoUqA=; b=wiObwyJ/23ocQZCm7DeDjcFbNvr09opOzroj1ijs6A3V9UTjBioT8Jf/yJrGIq5ZiN EG3T68vIkB0e6xp1wQXvaBB26rOfndwi4yhapTAQqGCPsWmGEN9Re/VJXKxmdcAxTMLN lWRImiQVV1fpSUPuCCWv8PoS+5VhNuM18ngAQyOSE3NbjvM2CkAFu4egsDF7IqN71QXC 7oQ0ad2G7k1cqa+/sk86Qpc0NKVB8/IHGw8FZcvly456FDzP7NtGEWDeThf4faEoF6Ms gOn74WEODJo/pk3u2hfb+A0IsvcO/gSeTrueWdvMy02kiSaTeGsFyaPWOybxrjs2PeOk WZFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=GTHAsXCU; 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 m7si213500edv.557.2020.05.05.19.10.20; Tue, 05 May 2020 19:10:44 -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=GTHAsXCU; 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 S1729777AbgEFBfr (ORCPT + 99 others); Tue, 5 May 2020 21:35:47 -0400 Received: from ozlabs.org ([203.11.71.1]:33541 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727989AbgEFBfq (ORCPT ); Tue, 5 May 2020 21:35:46 -0400 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 49Gzgg6gf5z9sSr; Wed, 6 May 2020 11:35:43 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1588728944; bh=KUYO+PR8+oJRVW9bjsUzpPhTlm5eKF6/oKJKp8Jeo0g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=GTHAsXCUiXz5gZz3YepcK5hmp0cRbu6B1DOYuP4H0C577S3a6m8KBhhKu1Gpq/cJn DeWjzEeke2mr2CutozGTmoG98bACusrP5pMOowZTpqCxSD06ganBizqL1J2HHKl7rZ 0OOAfZyx5T+dwBG32Qar+O6gH/1QJ6EXezRf1wCsYbBIIsI5qaAhvKG+b9eXcgjrjs RkFBVRebIORbX84qfdQ4Cl3bgJXhiDSuj9XhZW9sIuwCxvWvrFZeGq2PUzqdCjzlLw KvjIuVsYvopt8AEH+SWbBipwDB9zPkLnWsQ9htr8IAf7zVJ4QL/q7Vy0bdPoCI0rrW h7Y2ZZ7I8E8Sw== From: Michael Ellerman To: Segher Boessenkool , Christophe Leroy 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' In-Reply-To: <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> <20200505155944.GO31009@gate.crashing.org> Date: Wed, 06 May 2020 11:36:00 +1000 Message-ID: <87lfm5dev3.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 Segher Boessenkool writes: > 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. The update-forms are stdux, sthux etc. right? I don't see any change in the number of those with or without the constraint. That's using GCC 9.3.0. >> Should we ifdef the "m<>" or "m" based on GCC >> version ? > > That will be a lot of churn. Just make 4.8 minimum? As I said in my other mail that's not really up to us. We could mandate a higher minimum for powerpc, but I'd rather not. I think for now I'm inclined to just drop the "<>", and we can revisit in a release or two when hopefully GCC 4.8 has become the minimum. cheers