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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 297EDC001DB for ; Fri, 4 Aug 2023 16:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=VX75xe/KPhpGojG0VnT0+XespeTiBBpvRITXPJX8fsc=; b=SnQJvt4z5PKaur 8ajuw0SV5rLJBckvdPd5z0UlRcLE0krmz4y8JgHuFTZDFKuxZW1h1WFRpu5Lc7vKg6vB6SHbybcMi 4y7DzSPW2aAle/7WCYmQAFYGDaYlr5oYPfxX7V+YNi3GfDIB3Q+yVcSkz6/5uC25VydsrfHBH4fY8 YSONhDgqIETCPw0hF6E+xkdGKBieG+dtrpBCE+3fuRrJ+bVGDX/nrgY9YYZp/4OLhRkuLqe1asFXq NEFf9cJvaap2mabmy2vUfkR5TBXMyCuGFAnRq8hF37ngoVxufsz99eeyLlAwjxD9V80SXlDuyoPET 53AhakYGS4wolwBSfKhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRxwl-00CorH-0a; Fri, 04 Aug 2023 16:46:39 +0000 Received: from out-126.mta0.migadu.com ([91.218.175.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRxwh-00Copm-1y for linux-arm-kernel@lists.infradead.org; Fri, 04 Aug 2023 16:46:37 +0000 Date: Fri, 4 Aug 2023 16:46:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691167586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qaR2G5Chx/VcUIaTYRuVF0uwhqVmW9NgGj+Bf+hZY7o=; b=r+7WDHTAnuE6UxfVFf9fmVXWZrmioqVjtqh2KCn/L35YcmjQRsSJVd/v1z+Ks6eJx8J4jA LS+cxW2YC2JZ/gzgc8G8izhmj/IUaH3i22/t7+ES3S7mAYiT5/wal8BUgHjTB9cBHWagSe 11Un/V39kIbT2E0Q/LNoUv+MPvnz+qU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Sean Christopherson Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Michal Luczaj Subject: Re: [PATCH 2/4] KVM: selftests: Add helper macros for ioctl()s that return file descriptors Message-ID: References: <20230804004226.1984505-1-seanjc@google.com> <20230804004226.1984505-3-seanjc@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230804004226.1984505-3-seanjc@google.com> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230804_094636_083755_4748F854 X-CRM114-Status: GOOD ( 11.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Sean, On Thu, Aug 03, 2023 at 05:42:24PM -0700, Sean Christopherson wrote: > Add KVM, VM, and vCPU scoped helpers for ioctl()s that return file > descriptors, i.e. deduplicate code for asserting success on ioctls() for > which a positive return value, not just zero, is considered success. > > Signed-off-by: Sean Christopherson I appreciate the desire to eliminate duplicate code, but I think the naming just muddies the waters. TBH, when I first read the diff w/o the changelog, I thought you were describing the input fd (i.e. 'kvm_fd', 'vm_fd', 'vcpu_fd'). I don't think explicitly spelling out the condition each time (i.e. ret >= 0) is all that difficult. [...] > /* > * Looks up and returns the value corresponding to the capability > * (KVM_CAP_*) given by cap. > */ > static inline int vm_check_cap(struct kvm_vm *vm, long cap) > { > - int ret = __vm_ioctl(vm, KVM_CHECK_EXTENSION, (void *)cap); > - > - TEST_ASSERT(ret >= 0, KVM_IOCTL_ERROR(KVM_CHECK_EXTENSION, ret)); > - return ret; > + return vm_fd_ioctl(vm, KVM_CHECK_EXTENSION, (void *)cap); > } Though the same error condition, this isn't returning an fd. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel