Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3901787ybi; Mon, 3 Jun 2019 02:10:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkgdZXDYSpdnKu6lq9ijM0TC2RVczsJ6WsMJUCZaIkAI1NO/HJurlHOnl6FC+K0NOnxhfj X-Received: by 2002:a17:90a:2590:: with SMTP id k16mr28983032pje.11.1559553051928; Mon, 03 Jun 2019 02:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559553051; cv=none; d=google.com; s=arc-20160816; b=rEMVEta+MiZyIOSd4BUNozUj7Do4ClM8rs7N5z3ndCEcqsiCZZBE/OihJAUAWZTsqc uaMz1YA5+nBHjuHfikmdM6IYr+gPgR/XCdePe3GRU0TPQubCsoWsCz3WwxSYh3LLNJvf UkSYzpnIz4PKflYRdYOAWXEVgkflNsaaVcVdk/Ia8JuxXu5+LHct8SwmwG67gOR/YHWC gfl/gNT3HZWYtjgVRxtRK8tWcyIcQGFcia5QRhzDsk+xXU1vlwbfOL6wQkNx90BaV4od 3U8aZkHutMrZ+4Uo/aZKUbrsjyJu2k47v71O17s8n4TM/EdUXjz3AjOHKxjH+SyEq5DC OVgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=Vn5axr/EA0GJETwqgKT6zxHHv4ri0GLIipXIczEsDFw=; b=g62NQFHkiPakm4q28uBZdV0Ap6LzLO5d/M1T1+VoOSwbDh7OzqfThmAuMah908YYxc wKdv6Zc6OKF2TZAP03vZWC3qdVg9Bd9Bg6jQxJ+RWLGn9CXoq3BImkOvV4DqhgG/Dosn XuQjIBrmFqeGNjI6bZcnf2C1DlBlzZO+oKd4dh50sG6yV86cckXdzMXcH9AX1Lp1pzWA FrgacbsI2EhgJo7min+TNUzfYNVAinChzTGx78D0woMyWHAvqMpuk0enQjxq/PmUyUnm PMAn6SoO0WSDVXHQlnUnLSNupA21nb0JJBqHCxkDBosfA0WHYL/mMxj5YwsOSkp5y70K xz+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 19si13036650pfi.81.2019.06.03.02.10.35; Mon, 03 Jun 2019 02:10:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727354AbfFCJIs (ORCPT + 99 others); Mon, 3 Jun 2019 05:08:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60338 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726561AbfFCJIr (ORCPT ); Mon, 3 Jun 2019 05:08:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C3C2308404B; Mon, 3 Jun 2019 09:08:47 +0000 (UTC) Received: from gondolin (ovpn-204-96.brq.redhat.com [10.40.204.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id C650C648B1; Mon, 3 Jun 2019 09:08:43 +0000 (UTC) Date: Mon, 3 Jun 2019 11:08:39 +0200 From: Cornelia Huck To: David Hildenbrand Cc: Harald Freudenberger , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Heiko Carstens , Christian Borntraeger Subject: Re: [PATCH v1] s390/pkey: Use -ENODEV instead of -EOPNOTSUPP Message-ID: <20190603110839.1a44f352.cohuck@redhat.com> In-Reply-To: <67136b8b-251f-4745-a220-2624aeac289e@redhat.com> References: <20190531093628.14766-1-david@redhat.com> <3dfea8fd-dbe7-f9d0-f7a7-2c65349c0a81@linux.ibm.com> <67136b8b-251f-4745-a220-2624aeac289e@redhat.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 03 Jun 2019 09:08:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 3 Jun 2019 10:14:53 +0200 David Hildenbrand wrote: > On 03.06.19 09:48, Harald Freudenberger wrote: > > On 31.05.19 11:36, David Hildenbrand wrote: > >> systemd-modules-load.service automatically tries to load the pkey module > >> on systems that have MSA. > >> > >> Pkey also requires the MSA3 facility and a bunch of subfunctions. > >> Failing with -EOPNOTSUPP makes "systemd-modules-load.service" fail on > >> any system that does not have all needed subfunctions. For example, > >> when running under QEMU TCG (but also on systems where protected keys > >> are disabled via the HMC). > >> > >> Let's use -ENODEV, so systemd-modules-load.service properly ignores > >> failing to load the pkey module because of missing HW functionality. > >> > >> Cc: Harald Freudenberger > >> Cc: Heiko Carstens > >> Cc: Cornelia Huck > >> Cc: Christian Borntraeger > >> Signed-off-by: David Hildenbrand > >> --- > >> drivers/s390/crypto/pkey_api.c | 6 +++--- > >> 1 file changed, 3 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c > >> index 45eb0c14b880..ddfcefb47284 100644 > >> --- a/drivers/s390/crypto/pkey_api.c > >> +++ b/drivers/s390/crypto/pkey_api.c > >> @@ -1695,15 +1695,15 @@ static int __init pkey_init(void) > >> * are able to work with protected keys. > >> */ > >> if (!cpacf_query(CPACF_PCKMO, &pckmo_functions)) > >> - return -EOPNOTSUPP; > >> + return -ENODEV; > >> > >> /* check for kmc instructions available */ > >> if (!cpacf_query(CPACF_KMC, &kmc_functions)) > >> - return -EOPNOTSUPP; > >> + return -ENODEV; > >> if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) || > >> !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) || > >> !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256)) > >> - return -EOPNOTSUPP; > >> + return -ENODEV; > >> > >> pkey_debug_init(); > >> > > I can't really agree to this: there are a lot more modules returning > > EOPNOTSUPP, for example have a look into the arch/s390/crypto > > subdirectory. The ghash_s390 module also registers for MSA feature > > and also returns EOPNOTSUPPORTED when the required hardware extension > > For s390x KVM, we return ENODEV in case the SIE (the HW feature) is not > available. Just because s390x crypto is doing it consistently this way > doesn't mean it is the right thing to do. > > Maybe we should change all s390x crypto modules then. I agree. > > > is not available. Same with the prng kernel module, sha1_s390, sha256_s390 > > and I assume there is a bunch of other kernel modules with same behavior. > > I would prefer having this fixed on the systemd-modules-load.service side. > > > A very, very bad comparison (because it contains a lot of false positives): > > t460s: ~/git/linux memory_block_devices2 $ git grep -A 20 "_init(" -- > 'drivers*.[c]' | grep ENODEV | wc -l > 1552 > > t460s: ~/git/linux memory_block_devices2 $ git grep -A 20 "_init(" -- > 'drivers*.[c]' | grep EOPNOTSUPP | wc -l > 56 > > No, I don't think EOPNOTSUPP is the right thing to do. If we frame it as -EOPNOTSUPP -> operation not supported (i.e. we cannot perform this operation) -ENODEV -> no such device (i.e. we're lacking hardware support) I think -ENODEV makes more sense (even though we could argue for both.) And it is an easy change to make...