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 333B7C43334 for ; Fri, 15 Jul 2022 07:59:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9ABEF9401D5; Fri, 15 Jul 2022 03:59:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 935549401A5; Fri, 15 Jul 2022 03:59:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FC4B9401D5; Fri, 15 Jul 2022 03:59:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6E5F49401A5 for ; Fri, 15 Jul 2022 03:59:58 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 36EC5612CF for ; Fri, 15 Jul 2022 07:59:58 +0000 (UTC) X-FDA: 79688585676.27.5C2DC6E Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf02.hostedemail.com (Postfix) with ESMTP id C37BA8002F for ; Fri, 15 Jul 2022 07:59:57 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26F7DL0h022959; Fri, 15 Jul 2022 07:59:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=fVYrmCLytRMdV2BuUoTmeC7LqWv1xHlIm6mX4jyrEIU=; b=CaLEcwDAoHcAOweuugtUI4MgffuSpzZp1JePN15H0U2bv6FPP1llgP4oIVCleiIhddvr MYeDJtjpK2e6zJEYQuNlaR9unkbYqfXpVMpLZFyE63cW8DbDN/i9iRimShfkWCGx2IWw nqUIfF4iQL4YC7oOBwMpQHU2LqYFHSh8I+3SGIQvQ+XNXs+f608q6VWqfM6FZciRQa4D 324smx7NftRKGwCm8KsQl+OrgA+zo6U90iCiMTi4Qdi/pdD+3sfoLX4RFMxBakU0Y+cY itqm3lYIXHEs9G3yM2CT1iZUOtfGzUyjwoF7fC3LgwbCyqIyGAmAriNfxIuMH2HfT1jw yw== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3hb3nd8uff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Jul 2022 07:59:56 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26F7wUPD024616; Fri, 15 Jul 2022 07:59:55 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma06ams.nl.ibm.com with ESMTP id 3h70xj03xa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Jul 2022 07:59:55 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26F7xpca25297284 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jul 2022 07:59:52 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E28F042045; Fri, 15 Jul 2022 07:59:51 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CC1C642042; Fri, 15 Jul 2022 07:59:51 +0000 (GMT) Received: from vela (unknown [9.145.26.36]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 15 Jul 2022 07:59:51 +0000 (GMT) Received: from brueckner by vela with local (Exim 4.94.2) (envelope-from ) id 1oCGEo-0002br-2L; Fri, 15 Jul 2022 09:59:50 +0200 Date: Fri, 15 Jul 2022 09:59:49 +0200 From: Hendrik Brueckner To: Steffen Eiden Cc: Heiko Carstens , Alexander Gordeev , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Vasily Gorbik , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, nrb@linux.ibm.com Subject: Re: [PATCH v2 1/3] s390/cpufeature: rework to allow more than only hwcap bits Message-ID: References: <20220713125644.16121-1-seiden@linux.ibm.com> <20220713125644.16121-2-seiden@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220713125644.16121-2-seiden@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Q_DGKmW8O11JVK0pBqw0XchW-w0XMO0R X-Proofpoint-ORIG-GUID: Q_DGKmW8O11JVK0pBqw0XchW-w0XMO0R X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-15_02,2022-07-14_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 malwarescore=0 bulkscore=0 adultscore=0 impostorscore=0 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207150031 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657871997; a=rsa-sha256; cv=none; b=DG27gMkddqJuUnDQ1YnkBGzOVHatTyoLu8wGyamgTNFkpb3lPwMFoSIzyUPKaBjAmvGqjG ap+mazKqnFyTAY26QrFl704ATXR+yiwgYPrtrJHaohkbkE6/xX5d6SOWtIxB5f/aGCmJ6E ejBqAeoAeoYdvEsZhw8SxNVWeeqI4Ys= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=CaLEcwDA; spf=pass (imf02.hostedemail.com: domain of brueckner@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=brueckner@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657871997; 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=fVYrmCLytRMdV2BuUoTmeC7LqWv1xHlIm6mX4jyrEIU=; b=eNuCOmnj2TRBmKE8MeEbZw93WBDhrK1kHGhH2KvCZIi5OSnSLPruOM9Kv0saPzVD1BZy/Y Dd5id84fFZBk+QtSJgFXX2KgCY/qR/9iWP5I2Bb/BaHN1Hx9ms+NN9NhdNNrJpEAr+SKUw Th7eAyhao1tEeuNrDQCNEeuo+98RWQs= X-Rspam-User: X-Rspamd-Queue-Id: C37BA8002F Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=CaLEcwDA; spf=pass (imf02.hostedemail.com: domain of brueckner@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=brueckner@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Rspamd-Server: rspam04 X-Stat-Signature: y8o7radrtd79uxghxaqip6cfyikxkjif X-HE-Tag: 1657871997-902816 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000096, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jul 13, 2022 at 02:56:42PM +0200, Steffen Eiden wrote: > From: Heiko Carstens > > Rework cpufeature implementation to allow for various cpu feature > indications, which is not only limited to hwcap bits. This is achieved > by adding a sequential list of cpu feature numbers, where each of them > is mapped to an entry which indicates what this number is about. > > Each entry contains a type member, which indicates what feature > name space to look into (e.g. hwcap, or cpu facility). If wanted this > allows also to automatically load modules only in e.g. z/VM > configurations. > > Signed-off-by: Heiko Carstens > Signed-off-by: Steffen Eiden > --- > arch/s390/crypto/aes_s390.c | 2 +- > arch/s390/crypto/chacha-glue.c | 2 +- > arch/s390/crypto/crc32-vx.c | 2 +- > arch/s390/crypto/des_s390.c | 2 +- > arch/s390/crypto/ghash_s390.c | 2 +- > arch/s390/crypto/prng.c | 2 +- > arch/s390/crypto/sha1_s390.c | 2 +- > arch/s390/crypto/sha256_s390.c | 2 +- > arch/s390/crypto/sha3_256_s390.c | 2 +- > arch/s390/crypto/sha3_512_s390.c | 2 +- > arch/s390/crypto/sha512_s390.c | 2 +- Regarding facility bits for cpu features: Initially, I used MSA hwcap to cover all ciphers among all hw generations. With facility bit checks, it makes more sense to fine-tune and load based on respective MSA level or CPACF functions that is required for ciphers/hashes. E.g. like > diff --git a/arch/s390/crypto/sha512_s390.c b/arch/s390/crypto/sha512_s390.c > index 43ce4956df73..04f11c407763 100644 > --- a/arch/s390/crypto/sha512_s390.c > +++ b/arch/s390/crypto/sha512_s390.c > @@ -142,7 +142,7 @@ static void __exit fini(void) > crypto_unregister_shash(&sha384_alg); > } > > -module_cpu_feature_match(MSA, init); > +module_cpu_feature_match(S390_CPU_FEATURE_MSA, init); > module_exit(fini); which becomes automatically loaded if (any) MSA is available and then performs this check: cpacf_query_func(CPACF_KIMD, CPACF_KIMD_SHA_512 which in the worst case would fail. This might be a very useful follow-up patch to remove those mod init checks into the cpu feature. Other than that, Reviewed-by: Hendrik Brueckner