Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp291026rdf; Tue, 21 Nov 2023 02:57:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUQvSKply/1ONcGn6oO4SvgvflZqhUEhHGrUhiogW1Oghn2NAuKNGeYgc36wkVI4shFK5/ X-Received: by 2002:a17:902:dacb:b0:1cf:678a:6536 with SMTP id q11-20020a170902dacb00b001cf678a6536mr4340351plx.6.1700564267566; Tue, 21 Nov 2023 02:57:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700564267; cv=none; d=google.com; s=arc-20160816; b=ivNsiCpQ1X+7cRKoCnHh0AdXdJ5n8L0ibC4kuqZnFyP3cvfXZxPL2xTAe7KrzRtdga IHC/KBR5igyTUvmkwCU+0HgUUlTw6p1dC2IceHYkR0ND/IsN0DGPEVON8+uZGtfR1/Sq OqIwl3qyMj/ezDjik47wf6l3O5DLCmBIGEWoprZSxeXCcfFACN+vU5pdAzTSlyQAeRJR q6usAzykHS3i8GH/L6wgZjg8Y8pHNNgMwiJpSDhz8HeZ2Wbu1yGJUlDfey9xlSBIAuAe rdNJyHnJvqpFORiVjm8T1RRXig8ouZxhTStuxuB3s45pK3ycbWxAmFJ8XXq3ZObOWTx/ oCwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=bTB+l0widxjDghboT6EPJhzDshmWckSVZMbGpEmtp7g=; fh=q7mhBkN9Gj3wwmwWvpHqS4z58lcJzfDF8ghqId51Qd4=; b=QD/QAJXsIyJLznpTQJIUoBfOyDhr25c0FUV354IKmf0UKlSH+/svhy2zI7HQU4FUXQ qAJC6eCoARhvJcsOD4lyVRVG3XxOM5XA33gY8OekRlqBASxPbe0ypotYlwEb5aPXpRQG OK0MGzzUcP635QJMvDCAOE6za5UB6A8lfcs4vCVDXnweDiq6LmEJJt1D6lW3zbUW5BwD 76akSgklu704Kl82/W0oaq+Nb0Xl5HjuI7EHClTTgadvnHRlURYrMnv6NKrNCNYYaabg dZuo3x8ESnVea+Hctl28UkdIWftUfowC4LCXi5zyztGYcRH20DB0XtbgVLi2+f1YrLf3 NtFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id u14-20020a170902e80e00b001cf5cc1cac9si1222668plg.221.2023.11.21.02.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:57:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id A0316802957A; Tue, 21 Nov 2023 02:57:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233871AbjKUK5i convert rfc822-to-8bit (ORCPT + 99 others); Tue, 21 Nov 2023 05:57:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjKUK5e (ORCPT ); Tue, 21 Nov 2023 05:57:34 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCBC8C1 for ; Tue, 21 Nov 2023 02:57:29 -0800 (PST) Received: from lhrpeml100001.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SZLmv0DcRz6J9yP; Tue, 21 Nov 2023 18:52:31 +0800 (CST) Received: from lhrpeml500001.china.huawei.com (7.191.163.213) by lhrpeml100001.china.huawei.com (7.191.160.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 21 Nov 2023 10:57:27 +0000 Received: from lhrpeml500001.china.huawei.com ([7.191.163.213]) by lhrpeml500001.china.huawei.com ([7.191.163.213]) with mapi id 15.01.2507.035; Tue, 21 Nov 2023 10:57:27 +0000 From: Salil Mehta To: Oliver Upton , "Russell King (Oracle)" CC: Jianyong Wu , "maz@kernel.org" , "james.morse@arm.com" , "will@kernel.org" , "suzuki.poulose@arm.com" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "justin.he@arm.com" Subject: RE: [PATCH] arm64/kvm: Introduce feature extension for SMCCC filter Thread-Topic: [PATCH] arm64/kvm: Introduce feature extension for SMCCC filter Thread-Index: AQHaGIJSPxqmEiVqkkOrXIqhoEeoZ7B9TvAAgABHfQCABwlmkA== Date: Tue, 21 Nov 2023 10:57:27 +0000 Message-ID: <9367235ee3b34a30af43a5689173f61e@huawei.com> References: <20231116114152.912344-1-jianyong.wu@arm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.195.245.211] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 21 Nov 2023 02:57:44 -0800 (PST) > From: Oliver Upton > Sent: Thursday, November 16, 2023 11:22 PM > To: Russell King (Oracle) > > On Thu, Nov 16, 2023 at 07:06:18PM +0000, Russell King (Oracle) wrote: > > On Thu, Nov 16, 2023 at 11:41:52AM +0000, Jianyong Wu wrote: > > > 821d935c87b introduces support for userspace SMCCC filtering, but lack > > > of a way to tell userspace if we have this feature. Add a corresponding > > > feature extension can resolve this issue. > > > > > > For example, the incoming feature Vcpu Hotplug needs the SMCCC filter. > > > As there is no way to check this feature, VMM will run into error when > > > it calls this feature on an old kernel. It's bad for backward compatible. > > > > Can't you just attempt to use the SMCCC filtering, and if it errors out > > with the appropriate error code, decide that SMCCC filtering is not > > available? > > That would also work, as we return ENXIO for the unsupported ioctl. > > > That's how most things like kernel syscalls work - if they're not > > implemented they return -ENOSYS. glibc can detect that and use a > > fallback. > > I generally agree, but KVM has gone in the other direction of providing > auxiliary interfaces for discovering new UAPI. ENXIO has been slightly > overloaded to imply that a given ioctl is non-existent or otherwise > unsupported due to some dynamic configuration. Agreed. We require this check for vCPU Hotplug series as well exactly for the reason you stated above i.e. to clearly distinguish the case when KVM host does not support SMCCC filter and when it does but an error is purged out during configuration of this filter. In the later we would like to abort the VM initialization (as being done in RFC V2) but in former we would just continue without supporting vCPU Hotplug feature. Handling is different in each. Thanks Salil. > > Is it ideal? Of course not. With that said userspace may as well use the > preferred / documented discoverability mechanism. And in Jianyong's case > the KVM documentation is rather unambiguous (for once) about how you > discover device attributes. > > https://docs.kernel.org/virt/kvm/api.html#kvm-has-device-attr > > -- > Thanks, > Oliver