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 X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40880C4360F for ; Thu, 4 Apr 2019 08:35:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 11B88206DD for ; Thu, 4 Apr 2019 08:35:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bwfGqOCE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11B88206DD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8NjS96qL07SlExIkiblz59vJy5+1VoQ1RmKe2z2DQaA=; b=bwfGqOCETs1An8 9bTizTJep7a8PRc8/GM5RVbxun/x3h5cdRzr7DIyXGldLdOwCk+s4lJ8KMm8BqLj+A1aHwDO+sKK6 2fm6jqvJdpzK0WC2uBu7YwpgtlDDjN0m0xSZyS0Lo6LNE15Ky8Ks/1HrryICYnJVGM1N+NKXbcb4E 4K7/cq1HXmicuqIJnfX732eYC8R5fo1OL807CmCpbvGIUBcNR2KT7t9YBVNBLnMN/WhxZDqF9a8UU 8SAalvFXdh8TuoNlWSi/DMng7uZaaAfdQoJOS7Jzwg0xBFSGdVRDdJKFVctEid/e4PexgYZgX7D5z dH1opSQaZ0ds40B8kfWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBxqQ-0000Ki-Cr; Thu, 04 Apr 2019 08:35:34 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBxqN-0000KJ-PX for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2019 08:35:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5DF0280D; Thu, 4 Apr 2019 01:35:31 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 665853F557; Thu, 4 Apr 2019 01:35:29 -0700 (PDT) Date: Thu, 4 Apr 2019 09:35:26 +0100 From: Dave Martin To: Andrew Jones Subject: Re: [PATCH v7 26/27] KVM: Document errors for KVM_GET_ONE_REG and KVM_SET_ONE_REG Message-ID: <20190404083526.GZ3567@e103592.cambridge.arm.com> References: <1553864452-15080-1-git-send-email-Dave.Martin@arm.com> <1553864452-15080-27-git-send-email-Dave.Martin@arm.com> <20190403202746.yoxwokr5uitli5q4@kamzik.brq.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190403202746.yoxwokr5uitli5q4@kamzik.brq.redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190404_013531_835231_F2E2FE2E X-CRM114-Status: GOOD ( 21.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Okamoto Takayuki , Christoffer Dall , Ard Biesheuvel , Marc Zyngier , Catalin Marinas , Will Deacon , Zhang Lei , Julien Grall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 03, 2019 at 10:27:46PM +0200, Andrew Jones wrote: > On Fri, Mar 29, 2019 at 01:00:51PM +0000, Dave Martin wrote: > > KVM_GET_ONE_REG and KVM_SET_ONE_REG return some error codes that > > are not documented (but hopefully not surprising either). To give > > an indication of what these may mean, this patch adds brief > > documentation. > > = > > Signed-off-by: Dave Martin > > --- > > Documentation/virtual/kvm/api.txt | 6 ++++++ > > 1 file changed, 6 insertions(+) > > = > > diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/= kvm/api.txt > > index 2d4f7ce..cd920dd 100644 > > --- a/Documentation/virtual/kvm/api.txt > > +++ b/Documentation/virtual/kvm/api.txt > > @@ -1871,6 +1871,9 @@ Architectures: all > > Type: vcpu ioctl > > Parameters: struct kvm_one_reg (in) > > Returns: 0 on success, negative value on failure > > +Errors: > > + =A0ENOENT: =A0=A0no such register > > + =A0EINVAL: =A0=A0other errors, such as bad size encoding for a known = register > > = > > struct kvm_one_reg { > > __u64 id; > > @@ -2192,6 +2195,9 @@ Architectures: all > > Type: vcpu ioctl > > Parameters: struct kvm_one_reg (in and out) > > Returns: 0 on success, negative value on failure > > +Errors: > > + =A0ENOENT: =A0=A0no such register > > + =A0EINVAL: =A0=A0other errors, such as bad size encoding for a known = register > > = > > This ioctl allows to receive the value of a single register implemented > > in a vcpu. The register to read is indicated by the "id" field of the > > -- = > > 2.1.4 > > > = > Are we sure all architectures have these, and only these errors? A quick > grep indicates not. I'm not sure we can document this easily here due to > it addressing all architectures at once. Maybe we could add arch-specific > subsections, but I'm not sure it's worth it. Error codes are generally indicative at best, and rarely mutually exclusive in a given situation. Writing a caveat to say that you shouldn't make assumptions about precisely what error code will be returned in a given situation would look odd: that really applies widely all over the kernel/user ABI, not just here. _Maybe_ everything is exhaustively correct in this file already, but given the size of it, and the fact that many things are implemented per-arch, the chance of this seems zero. I could add "invalid register ID" for EINVAL. This allows some ambiguity about which error code applies for a nonexistent register. Alternatively, we could revert this documentation instead. It seemed appropriate to document the EPERM error for finalization ordering (added later), but since correct userspace code should never see this maybe it's reasonable to leave it undocumented(?) Cheers ---Dave _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel