From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03D4B15A86D; Wed, 28 Aug 2024 12:40:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=63.228.1.57 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724848813; cv=none; b=dQ3JHxGdHZJCmiUr1hgtK8NfFGLfXrLyI3k00njw31iOdEe+UEu+CIXLoyBAq+ThVQbW5rNenVyT4wSFk4yerkoDPSecMR/Su1XQcZpZO/gk9lHJHmP0vvbBho7x2kCgd20dD/95op/09FVXr7URw+zauQOD1GlmzmT69xLTVGo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724848813; c=relaxed/simple; bh=/bBNY0jv3D7Deqpb/q8fLTkX1nKaz6wX3cf774wtMYQ=; h=Date:From:To:Cc:Subject:Message-ID:References:Mime-Version: Content-Type:Content-Disposition:In-Reply-To; b=KPU+7p314uvYseFBjzsNI3jvhl7icmVi3rsbJvx1i/kOf2lxN+csPGbF/Qb4JVTIjajmUFZnP0t7KHEO6jOuJzC/eqUvVXpUVLjNae8C5F9oFLvDPNc+B3nypp8WyL88pZGiV3PM1moPYpQzssuZeq0zs80nJF737YDIgGzhivw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org; spf=pass smtp.mailfrom=kernel.crashing.org; arc=none smtp.client-ip=63.228.1.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 47SCXFAC030999; Wed, 28 Aug 2024 07:33:15 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 47SCXDte030998; Wed, 28 Aug 2024 07:33:13 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 28 Aug 2024 07:33:13 -0500 From: Segher Boessenkool To: "Jason A. Donenfeld" 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: <20240828123313.GD29862@gate.crashing.org> References: <5deb67090b214f0e6eae96b7c406546d1a16f89b.1724309198.git.christophe.leroy@csgroup.eu> <20240827180819.GB2049@sol.localdomain> <20240827225330.GC29862@gate.crashing.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i 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? Segher