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 D4E53C54FAA for ; Wed, 28 Aug 2024 13:07:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 69ABB6B0088; Wed, 28 Aug 2024 09:07:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 64ACD6B008A; Wed, 28 Aug 2024 09:07:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 512576B0092; Wed, 28 Aug 2024 09:07:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2F8896B0088 for ; Wed, 28 Aug 2024 09:07:31 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A5E151A1F6B for ; Wed, 28 Aug 2024 13:07:30 +0000 (UTC) X-FDA: 82501680660.18.8C4BC22 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf06.hostedemail.com (Postfix) with ESMTP id CF8B5180029 for ; Wed, 28 Aug 2024 13:07:28 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b="ODK/7ERo"; spf=pass (imf06.hostedemail.com: domain of "SRS0=8W/7=P3=zx2c4.com=Jason@kernel.org" designates 147.75.193.91 as permitted sender) smtp.mailfrom="SRS0=8W/7=P3=zx2c4.com=Jason@kernel.org"; dmarc=pass (policy=quarantine) header.from=zx2c4.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724850361; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oeaYEeMYW7hEo3u8qxst85yaDnh5A2IqHmNMDFLAgFo=; b=uJiGJLPwAorRe60H9obS+l7ixxkuvA5Tzs5K2f45yjBpqgi9UqGqYtHpcNPqJxGqfmjViN q0CEX5AshF/iRiolwxhVvn00Uhqz/vru+WURL2qfrnvtimgRQY+/H62RkkkSM5wztPbn/r d7Pew4XKrpUqWIy+xfHgIlAh8se6iPw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724850361; a=rsa-sha256; cv=none; b=HzhnBh5WsRVNJkGuoq5sCFuBBKl7VXsRrHLEhtBybImLJtZJdbBpqjBTGYW89jJ0+rMGAR OwZTW+R4qWrvuerGA/zc5hRynIUE6gHtylyyeg3wAyDUYp6kba41Q4Ci7B0UEYMKetduAI RYzYSLzIS8BN8kbaXiKXtuoLO9hpOFM= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b="ODK/7ERo"; spf=pass (imf06.hostedemail.com: domain of "SRS0=8W/7=P3=zx2c4.com=Jason@kernel.org" designates 147.75.193.91 as permitted sender) smtp.mailfrom="SRS0=8W/7=P3=zx2c4.com=Jason@kernel.org"; dmarc=pass (policy=quarantine) header.from=zx2c4.com Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 9D548A4088C; Wed, 28 Aug 2024 13:07:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EADC3C4FEAA; Wed, 28 Aug 2024 12:51:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1724849467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oeaYEeMYW7hEo3u8qxst85yaDnh5A2IqHmNMDFLAgFo=; b=ODK/7ERoI7S8QMrOJubKV+KYvxjfHTDZ1zzNE6AiRyLjnfeCtBY3W36gNo8wympvGHxdgN NSlxiq62JUyQC+aiXpMPbstKEvistBZZgAUjEOeILQQdAc9aNvROXJCsA6m9EfcUlXBIZM Xx5CPriIkEngv9c0pT/XBKJFCpvNkmI= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id a0cc7065 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 28 Aug 2024 12:51:06 +0000 (UTC) Date: Wed, 28 Aug 2024 14:51:05 +0200 From: "Jason A. Donenfeld" To: Segher Boessenkool Cc: Eric Biggers , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom Message-ID: References: <5deb67090b214f0e6eae96b7c406546d1a16f89b.1724309198.git.christophe.leroy@csgroup.eu> <20240827180819.GB2049@sol.localdomain> <20240827225330.GC29862@gate.crashing.org> <20240828123313.GD29862@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240828123313.GD29862@gate.crashing.org> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: CF8B5180029 X-Stat-Signature: saz8twr6wd3cw65pua5x1kbw9twwcde8 X-HE-Tag: 1724850448-618785 X-HE-Meta: U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19sa3oBBvu5mzuvThu9Nju07GNCEBmtcB0HKGGfypxrtQcl1fWeQqvyYiwAYrlWVhT035UbfKzsd2tfFA0bRQBsDuzKaJ1mwpWErYnBouexwoPXyS9Tdt19YWW9EIBCUayh48d2nXWYugKdE1JU/qxO+afzxBI3Ts5eLzqvuDbXFEUJ48WycRyoLrHogJOzX6OVWuw5sSlKyM222Vuc6V/cm/JBRJVV9ePibI38GSOcq9tQAeZoZWsIcupidK33v0c030vcoq9YRcvhcmH0gIeoEnUFA2DKJbgvypKfewNKsgZeIOcyiLVKDydb/ESddVPlU8DSq3SrtnDPX/gA== 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: On Wed, Aug 28, 2024 at 07:33:13AM -0500, Segher Boessenkool wrote: > On Wed, Aug 28, 2024 at 01:18:34PM +0200, Jason A. Donenfeld wrote: > > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > > > On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: > > > > > + for (i = 0; i < ARRAY_SIZE(params->reserved); i++) > > > > > + params->reserved[i] = 0; > > This is a loop. With -ftree-loop-distribute-patterns, the default at > -O2, this is optimised to > > memset(params->reserved, 0, ...); > > (which is perfectly fine, since memset is required to be there even > for freestanding environments, this is documented!) > > > > -fno-tree-loop-distribute-patterns . But, as always, read up on it, see > > > what it actually does (and how it avoids your problem, and mostly: learn > > > what the actual problem *was*!) > > > > This might help with various loops, but it doesn't help with the matter > > that this patch fixes, which is struct initialization. I just tried it > > with the arm64 patch to no avail. > > It very much *does* help. Try harder? Maybe you typoed? Scroll up and reread the original patch. You are confused. The loop is what fixes the matter. It's struct initialization that generates the memset.