Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2755959rdb; Mon, 5 Feb 2024 17:31:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDQIXgAfB5TM10+wZc/SkDZ4MihTcpY715eF6+KpE9u858borCvW/ouf6hopE5eQcu50sV X-Received: by 2002:a17:906:24c9:b0:a35:ee97:7ca6 with SMTP id f9-20020a17090624c900b00a35ee977ca6mr744829ejb.24.1707183092694; Mon, 05 Feb 2024 17:31:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707183092; cv=pass; d=google.com; s=arc-20160816; b=ntseIfk4nwV0V13iz1UbB+oHFF4MZG5GUBBAI6/mbvsdWtnPExux0MF0zxvHwPIPd8 5YoFPwo43Dbi73uss+HSeln46dkdGUkl7hTrkczD5Mn3BwfwZCNXZBTZ7r3C30c2HLjT 2FaK3reQHpwKMlgDhrcEuANiET7F5fRWoLcxZqCozOiHORcot6HFWx2IoFrtS5gmByQ1 0ufVL+R8sm+UBqiuz2ky57txCSK5joif82NquUGNx5blX7C7nouYzV4P3U7ZyYHCQqti V/W8jDpzaOJSk9WrI2uMn2RPDCFkVioRicT9ESI/yc6u1A1AZUgo7Zp83GwMiJdIAH/I jmxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1DqUVIajL871IepC1/NP/sDAXsLkDVQ/Z/JphGH/4zQ=; fh=6Z7AaYmWs0T8qpGmANri1Tx+XoAqr+btHYoW30+lrA8=; b=eQjtVrKpxRNkWar+PCxD88AZb5FXv/RVSZKFg1YKN+lHdEvrtupMazVIEhaQXxz+sB I5a0H07oEbKBePUJ7lFpWb4Nei6d+R1EMYS3dB52ov8WJ3kbdmy6oEvzlNkVZrc5Xo78 4QLXgmvGkY0Bbn+sHprzqzQYWWM4950DrJ8CXAKEKROLeMwM9wVgvUiM4vEXQZm8ZI1S Vg3033OsjDIt99tAWMIsltAESAg/BKa2DKi1SwYQ59Og20zWlmjG4OM3xcbVSf6vtoky ynwc3ahksPT2kkZes6SIgEDEtZF7ou0YAM3PLn+iIRBXDQoHQ/jMX1OkMKKdtXPbSAnl WvSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I/Rrwaw8"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54153-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54153-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCU1PpUGrSEj3/GAaNqJIpvDQSZg5kUkLTk0fr5kcJnIfTpgxXkaAW+3StxorjYvR+G3+QqKtqTRlTVISWYYIqeYtXghsBwBgsEheWb+3g== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u23-20020a170906c41700b00a2f944ff7d2si469304ejz.842.2024.02.05.17.31.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 17:31:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54153-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I/Rrwaw8"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54153-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54153-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 744091F242D8 for ; Tue, 6 Feb 2024 01:31:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D3CE15A7; Tue, 6 Feb 2024 01:31:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I/Rrwaw8" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A16410F4; Tue, 6 Feb 2024 01:31:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707183083; cv=none; b=BZw8voMonx8xGtVTY0uJCKyvHD3oSaLIDQoXp4TNuQFJ7r0dznEuXBnRS84nFxStZEF3Yc0KSgCT07eFkiefRRL4+QQKLsbK9dQKtTuNpoGqowOxGJG8O/yAWzD2uuCfLGsnmnMeY8rZEbJnBbPqwkeC+F6oxVJ7/rBGtnHwJBU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707183083; c=relaxed/simple; bh=32iDvBACWJxOXF6/oXubS4npaM7/Q4g4fdElgQomezI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bcjQNkxVVyu53impbEzeNPrT1o1LxPOxUZfu2hpyw2gW9R171nWxUxyATC7iKIgtulNnNW0fxA71w4OHu3elrBK9FfaRmwd5VsPsP6qFh6QrEdzmt6YP5zga5CPhasb1olrRznHd+5qQyfA9XmTEskcUNLljmd5+35N5R1F4Wxg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I/Rrwaw8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C13A1C433F1; Tue, 6 Feb 2024 01:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707183083; bh=32iDvBACWJxOXF6/oXubS4npaM7/Q4g4fdElgQomezI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I/Rrwaw8t5gj73Rw7uEgJuX0GX+xIb6h6sK+16CarivRG+3ELluh+fjWPdFmx4qWv 3osU/ZvJfItj+s70GSsY00w/l1cCCinN7ABMeKLCrZzQTtR4sneXBy/eik5UgNp9nk c4ZQFJUDozWPrEbyC6Os9Cds0s6g+zupS0DbMs+Dff2qQzrTfyh8ejvoslVDFHnhPY QGmRzWEgF0pEMrTH/CIBA0OvJceFIqEi5MWjk5Hora4UltU9hcYOXwvbPfdP9aU2Ij OXfINZbjSeRnpZsenZiAKjNF9NFaNipsMdqlB/tIF5M6wf05gwcuuHuJ56xCAIrGGD vAHs7s/tyccsQ== Date: Mon, 5 Feb 2024 18:31:21 -0700 From: Nathan Chancellor To: Heiko Carstens Cc: Kees Cook , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, Vasily Gorbik , Alexander Gordeev Subject: Re: [PATCH 2/2] s390/fpu: make use of __uninitialized macro Message-ID: <20240206013121.GB2616098@dev-arch.thelio-3990X> References: <20240205154844.3757121-1-hca@linux.ibm.com> <20240205154844.3757121-3-hca@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20240205154844.3757121-3-hca@linux.ibm.com> On Mon, Feb 05, 2024 at 04:48:44PM +0100, Heiko Carstens wrote: > Code sections in s390 specific kernel code which use floating point or > vector registers all come with a 520 byte stack variable to save already in > use registers, if required. > > With INIT_STACK_ALL_PATTERN or INIT_STACK_ALL_ZERO enabled this variable > will always be initialized on function entry in addition to saving register > contents, which contradicts the intend (performance improvement) of such > code sections. > > Therefore provide a DECLARE_KERNEL_FPU_ONSTACK() macro which provides > struct kernel_fpu variables with an __uninitialized attribute, and convert > all existing code to use this. > > This way only this specific type of stack variable will not be initialized, > regardless of config options. > > Signed-off-by: Heiko Carstens Reviewed-by: Nathan Chancellor > --- > arch/s390/crypto/chacha-glue.c | 2 +- > arch/s390/crypto/crc32-vx.c | 2 +- > arch/s390/include/asm/fpu/types.h | 3 +++ > arch/s390/kernel/sysinfo.c | 2 +- > lib/raid6/s390vx.uc | 4 ++-- > 5 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/arch/s390/crypto/chacha-glue.c b/arch/s390/crypto/chacha-glue.c > index ed9959e6f714..a823132fc563 100644 > --- a/arch/s390/crypto/chacha-glue.c > +++ b/arch/s390/crypto/chacha-glue.c > @@ -22,7 +22,7 @@ static void chacha20_crypt_s390(u32 *state, u8 *dst, const u8 *src, > unsigned int nbytes, const u32 *key, > u32 *counter) > { > - struct kernel_fpu vxstate; > + DECLARE_KERNEL_FPU_ONSTACK(vxstate); > > kernel_fpu_begin(&vxstate, KERNEL_VXR); > chacha20_vx(dst, src, nbytes, key, counter); > diff --git a/arch/s390/crypto/crc32-vx.c b/arch/s390/crypto/crc32-vx.c > index 017143e9cef7..6ae3e3ff5b0a 100644 > --- a/arch/s390/crypto/crc32-vx.c > +++ b/arch/s390/crypto/crc32-vx.c > @@ -49,8 +49,8 @@ u32 crc32c_le_vgfm_16(u32 crc, unsigned char const *buf, size_t size); > static u32 __pure ___fname(u32 crc, \ > unsigned char const *data, size_t datalen) \ > { \ > - struct kernel_fpu vxstate; \ > unsigned long prealign, aligned, remaining; \ > + DECLARE_KERNEL_FPU_ONSTACK(vxstate); \ > \ > if (datalen < VX_MIN_LEN + VX_ALIGN_MASK) \ > return ___crc32_sw(crc, data, datalen); \ > diff --git a/arch/s390/include/asm/fpu/types.h b/arch/s390/include/asm/fpu/types.h > index d889e9436865..b1afa13c07b7 100644 > --- a/arch/s390/include/asm/fpu/types.h > +++ b/arch/s390/include/asm/fpu/types.h > @@ -35,4 +35,7 @@ struct kernel_fpu { > }; > }; > > +#define DECLARE_KERNEL_FPU_ONSTACK(name) \ > + struct kernel_fpu name __uninitialized > + > #endif /* _ASM_S390_FPU_TYPES_H */ > diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c > index f6f8f498c9be..b439f17516eb 100644 > --- a/arch/s390/kernel/sysinfo.c > +++ b/arch/s390/kernel/sysinfo.c > @@ -426,9 +426,9 @@ subsys_initcall(create_proc_service_level); > */ > void s390_adjust_jiffies(void) > { > + DECLARE_KERNEL_FPU_ONSTACK(fpu); > struct sysinfo_1_2_2 *info; > unsigned long capability; > - struct kernel_fpu fpu; > > info = (void *) get_zeroed_page(GFP_KERNEL); > if (!info) > diff --git a/lib/raid6/s390vx.uc b/lib/raid6/s390vx.uc > index cd0b9e95f499..7b0b355e1a26 100644 > --- a/lib/raid6/s390vx.uc > +++ b/lib/raid6/s390vx.uc > @@ -81,7 +81,7 @@ static inline void COPY_VEC(int x, int y) > > static void raid6_s390vx$#_gen_syndrome(int disks, size_t bytes, void **ptrs) > { > - struct kernel_fpu vxstate; > + DECLARE_KERNEL_FPU_ONSTACK(vxstate); > u8 **dptr, *p, *q; > int d, z, z0; > > @@ -114,7 +114,7 @@ static void raid6_s390vx$#_gen_syndrome(int disks, size_t bytes, void **ptrs) > static void raid6_s390vx$#_xor_syndrome(int disks, int start, int stop, > size_t bytes, void **ptrs) > { > - struct kernel_fpu vxstate; > + DECLARE_KERNEL_FPU_ONSTACK(vxstate); > u8 **dptr, *p, *q; > int d, z, z0; > > -- > 2.40.1 >