Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp177070rwb; Fri, 4 Aug 2023 10:52:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUUiEw9RXaTPBFVCqSmKApfJc3LDjE8/QO9b7XJmj9xaxpunpMb4eQHtRYKQx9X38yf+xj X-Received: by 2002:a05:6a21:3384:b0:13f:e0b0:359e with SMTP id yy4-20020a056a21338400b0013fe0b0359emr2730844pzb.21.1691171521015; Fri, 04 Aug 2023 10:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691171520; cv=none; d=google.com; s=arc-20160816; b=NXBS4N0CnCa2ilGGulGGYr5CtwnQ/Z2CGB5K3rQmeHIa9YeEC4cLwSq5k2ABZMAZSV A7fvKcBgm7NbTeCj+KaNsPQw+1Xw5D2X/uOQjS9/0a/bsTdZJKOOsoKXcpq0ZCYdG1qL brmxfI2ZdUA6wKq3zIh+jQxXm2eDup1ag+qVzrB56uEpbCZ1UinC6ZK5jpIFkOfQWDVU VMttQZ7swVp3XDLpQJsTPjje3mTNt/PanqzRMKo8hSN0vQT6z2DURZ3wcgT8f3kIPtqS sh7jVaYGSs14FzW/4K9oGhxXVu4VjuVkal2lznDOR+gygthJ1aFRcg3F3ZMwygPwsqWp RnKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=qaR2G5Chx/VcUIaTYRuVF0uwhqVmW9NgGj+Bf+hZY7o=; fh=sTZkpLAzbrEbQ6zyW9An71uuR7+h0KdgdZ2lIiUvHuQ=; b=yDS8eUyRV5ItH2AI427lem09+3wKH08mv6Xms33UBITttKM9z6iEtp5NYkTZ7wFZMT 3UOd3E23ZGDVMvuRS7mQ6VNcdE5PG2CtEjwPFZXTX1FcPVZCOu+lrk+WYlD/KNdBZOkg bTeZd9bhJxtbmIrH8UP61eDTFqbnjAo4VVDlZzvkY84MvoQ9AIQeHAtUinyAT9MSKbiZ oAL2RuMPPng2ce0wHlkMZlBQixcRrOOvWy6zRG/K4IDNp/vhnTFi5rE6+UZMu0hEzkrs X9qG78rNMyZH42jw9EpEQy4Np1QxOQoS2FThKR8oydeC6bd6MpgXFRo6ddf5o8Pb85gn IVqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=r+7WDHTA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14-20020a63e00e000000b00563fe7f89e9si2005933pgh.186.2023.08.04.10.51.47; Fri, 04 Aug 2023 10:52:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=r+7WDHTA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230444AbjHDQqf (ORCPT + 99 others); Fri, 4 Aug 2023 12:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbjHDQqd (ORCPT ); Fri, 4 Aug 2023 12:46:33 -0400 Received: from out-110.mta0.migadu.com (out-110.mta0.migadu.com [IPv6:2001:41d0:1004:224b::6e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36D714C0B for ; Fri, 4 Aug 2023 09:46:28 -0700 (PDT) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230804004226.1984505-3-seanjc@google.com> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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