From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCC7ECA0ED3 for ; Mon, 2 Sep 2024 14:16:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E78F8D00DE; Mon, 2 Sep 2024 10:16:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5755A8D0065; Mon, 2 Sep 2024 10:16:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39DE28D00DE; Mon, 2 Sep 2024 10:16:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1B18C8D0065 for ; Mon, 2 Sep 2024 10:16:55 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id BB93E41DF4 for ; Mon, 2 Sep 2024 14:16:54 +0000 (UTC) X-FDA: 82519999548.09.EC0CD10 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf05.hostedemail.com (Postfix) with ESMTP id 26B5D100014 for ; Mon, 2 Sep 2024 14:16:51 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf05.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725286520; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fJtPK70PfuJNJz0/UnZuUoSfT+e9BXHpgQUWbLMsGYE=; b=MRdy6CFYt35ABrrS6wDTQben1R+FX1kk+/Gfwy/hpA9W1XIT/OAIOt5g39v1XCxPgLUOMS Rh9r1xwkUGVXcYJs27SyqNZW8UGVw0G7lBExHRm0VDucZl49BNVPkB3t3q7minfxetR63k Of9akmmfd27VBBIrP1Y4VPoYXpBHPMc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725286520; a=rsa-sha256; cv=none; b=kuaiwtAg0HzH6WvNGEwH5Xu7/7Emna8loDsbvQXkcqRXjAYfZQ51TnWpE/0oCGt3jUqdRQ rOzFwXOrdmKTmHam7UW2QJiewfLeZV8JyTdmfa8hYx5la7eUqCHjQxjZAjL6pC0jpP4T1V f/Yc7iHGDRPK/dz1LGbALXtcYvV6O5M= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf05.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Wy9mf0dPHz9sST; Mon, 2 Sep 2024 16:16:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6Tgia6VqhxQ6; Mon, 2 Sep 2024 16:16:49 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4Wy9md6m7Rz9sSS; Mon, 2 Sep 2024 16:16:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D570A8B76C; Mon, 2 Sep 2024 16:16:49 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 7vewUwjhFmRj; Mon, 2 Sep 2024 16:16:49 +0200 (CEST) Received: from [192.168.234.167] (unknown [192.168.234.167]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D65958B763; Mon, 2 Sep 2024 16:16:48 +0200 (CEST) Message-ID: Date: Mon, 2 Sep 2024 16:16:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 5/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC64 To: "Jason A. Donenfeld" Cc: Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Shuah Khan , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, Adhemerval Zanella , Xi Ruoyao References: <27de70dcc356e56754a03a2887a97597f5e840a4.1725278148.git.christophe.leroy@csgroup.eu> Content-Language: fr-FR From: Christophe Leroy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 26B5D100014 X-Stat-Signature: e1qitcppkz9nj643n93kadhrh1gc96br X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1725286611-889418 X-HE-Meta: U2FsdGVkX1//L3DconWQ8NYFNOz/OoWJ1hoSVeC8+9ZLMTmDYpnDJlpbfA8QoGv24hGjwRoMXnOEhb0r09ytK4v21teAPUD0NylX6M+uKbqPpRwlKcfJjkLSdWavYblan3x6d2d9cdKwkn/mDNC89hplkSJA9JC29pQMZpVOUVzl0OKW6DI8IqnPB61nqBuqiDvYJleEL8UkMyWV+caq1NiWzia7IFWSw+S4ROn032uUti/I+Dvd2TsePQJa1CuZXGkeKQF52AV744zVpmAANEtBUSwEifyyqkwhdsld4z5sPoqZu79LEZ19dKxCcFerhnEUQV7iUaFFYR7i7smNorBvLgkjQRlWfEmmY0bZNnho8dAnxSExJCPh/mbZYhNMwECbRLXyXG7w1bPC7NLhBPkosIbTVnJwMuWy9yUpZddF2SlNUYEZF2PX2FnfKuboBvK87uDztHFiNfCroC547hSD8m283Vr/ukrQxXzkACJdCRSS/u8iA3fRihx+FSnBOEI75207Or84zCz0kBzPpAJUZcOkHNPPulSCnk70UdlvksGqwpalsjyrP7jZrBfUdoQ5mC9Zi8E/dGPrw1NRPhhdwzX+AY4HLtxo0onTjLuMzFlPCWJe65H6nwPe9rQ27NL2yqb/N9L1gxj+3qTMdntW4XBAhneGBCDPAKAWnjWfNzyfMgxsyFnodSpModX8pL0TSife0nDODUCwWUjr1+O5X/C7b7g2okaH4UDiDQCCcFBPHbowwiwZfoJGsgByhvhGq2s3DghAAxoF70vJWp8UwVwHsXx7z9vIERhbxnC8L6ym/J41Rk6HSRsnEiAr6ZBrJCKYU1STevfjFaVFq88w/0BPgMqPCMNim1PDH1NQrdWGMYIldjCGIcagShmFSvedZ8LUTyASl3aKGGEzkiTX2fOsAQqhJiqCH9oCdb3XliFB6IQWO3VQMyHYQ05WLHB+dGh42XOwsBK6lhc ifVVn1P/ GPFzwiYZw6okgcEq7NwEEqRZhrCPS4JLn3BgOsMaesSdQ1sdNT9wy6rO/iUEK4ps24mB0EXxuDXrgmAOwq/YN6DscFEoNZm1a1ThG8k4TM1rrSTDJVI8dmZhbDHp4a2qw4oyVUitBDUMoPtk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Le 02/09/2024 à 16:00, Jason A. Donenfeld a écrit : > On Mon, Sep 02, 2024 at 03:12:47PM +0200, Christophe Leroy wrote: >> >> >> Le 02/09/2024 à 14:41, Jason A. Donenfeld a écrit : >>> On Mon, Sep 02, 2024 at 02:04:42PM +0200, Christophe Leroy wrote: >>>> SYM_FUNC_START(__arch_chacha20_blocks_nostack) >>>> #ifdef __powerpc64__ >>>> - blr >>>> + std r5, -216(r1) >>>> + >>>> + std r14, -144(r1) >>>> + std r15, -136(r1) >>>> + std r16, -128(r1) >>>> + std r17, -120(r1) >>>> + std r18, -112(r1) >>>> + std r19, -104(r1) >>>> + std r20, -96(r1) >>>> + std r21, -88(r1) >>>> + std r22, -80(r1) >>>> + std r23, -72(r1) >>>> + std r24, -64(r1) >>>> + std r25, -56(r1) >>>> + std r26, -48(r1) >>>> + std r27, -40(r1) >>>> + std r28, -32(r1) >>>> + std r29, -24(r1) >>>> + std r30, -16(r1) >>>> + std r31, -8(r1) >>>> #else >>>> stwu r1, -96(r1) >>>> stw r5, 20(r1) >>>> +#ifdef __BIG_ENDIAN__ >>>> stmw r14, 24(r1) >>>> +#else >>>> + stw r14, 24(r1) >>>> + stw r15, 28(r1) >>>> + stw r16, 32(r1) >>>> + stw r17, 36(r1) >>>> + stw r18, 40(r1) >>>> + stw r19, 44(r1) >>>> + stw r20, 48(r1) >>>> + stw r21, 52(r1) >>>> + stw r22, 56(r1) >>>> + stw r23, 60(r1) >>>> + stw r24, 64(r1) >>>> + stw r25, 68(r1) >>>> + stw r26, 72(r1) >>>> + stw r27, 76(r1) >>>> + stw r28, 80(r1) >>>> + stw r29, 84(r1) >>>> + stw r30, 88(r1) >>>> + stw r31, 92(r1) >>>> +#endif >>>> +#endif >>> >>> This confuses me. Why are you adding code to the !__powerpc64__ branch >>> in this commit? (Also, why does stmw not work on LE?) >> >> That's for the VDSO32 ie running 32 bits binaries on a 64 bits kernel. >> >> "Programming Environments Manual for 32-Bit Implementations of the >> PowerPC™ Architecture" say: In some implementations operating with >> little-endian byte order, execution of an lmw or stmw instruction >> causes the system alignment error handler to be invoked >> >> And GCC doesn't like it either: >> >> tools/arch/powerpc/vdso/vgetrandom-chacha.S:84: Error: `stmw' invalid >> when little-endian > > Does it make sense to do all the 32-bit stuff in the PPC32 commit (and > then you can introduce the selftests there without the error you > mentioned), and then add the 64-bit stuff in this commit? Can do that, but there will still be a problem with chacha selftests if I don't opt-out the entire function content when it is ppc64. It will build properly but if someone runs it on a ppc64 it will likely crash because only the low 32 bits of registers will be saved. That's the reason why I really prefered the approach where I set something in vdso_config.h so that the assembly is used only for powerpc32 and when building powerpc64 the assembly part is kept out and vdso_test_chacha simply tells it is not supported. Christophe