Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp258644rwb; Fri, 4 Aug 2023 12:12:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIHitIoRbqkehgycUcOsIkPgG1PRp3ZPf9bHs75F1zQQmbSWV001DUGdqXs30XRtC/db4s X-Received: by 2002:a17:907:75f9:b0:971:eb29:a082 with SMTP id jz25-20020a17090775f900b00971eb29a082mr2018516ejc.49.1691176344190; Fri, 04 Aug 2023 12:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691176344; cv=none; d=google.com; s=arc-20160816; b=u4PvB13DpeqMObixIR6/l4qvPJUQlCc/63AM4zJuixHMUAJdiSdtZtXCPGfZWJzapz Yx2VRsJFtIYpo6aibBXFXj6l+NkkJKtqtHA7krDhjEnqSvTyh+9IOAGyTpOH3yJdBPVN r2dObUuQbLw2m7ZXwJaV06N2M8neG1sObAJhya4bb0Li0rhOfu42/hFK2AqcQxia95br VdOM/1w1blm5dQXIbqKIzZHEABorvDhaREMPK9WzPemII3dFhwdQzAb7ZNx/SO3bxvKJ yUynoMUY5H8faaGXZCaS7CNcDoKxnnGecoyvtNTAonVWcmpew6idiDeiLtkvzgt4B9TN QqWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version :in-reply-to:date:dkim-signature; bh=2rR0xmb+YpEUj3rb8g7lk+IJj++fv45EBtjmO2AP5zk=; fh=uWp3pwWTeZRUactJmaDMyoO6ZBbrg2bwrqXAE91OV7s=; b=HAATiMSAmRq+Eckvj25HCPmWhsdlwtqCWa/S90W5WHOvk3xj0TXaxSiXSFNcahF+48 /hsBUAaVLYVuXLZOeBDSNMChk+nx24E9OU+1fva11lsI/UcEfNKXtmOZ17M2ET5vfCPB 49GWN76Quet7TTSlHtG87pO31INkM7HZLnDi0v2bs50AkbkVVAAwgmlM2r2K1ci5kKMD RDKNK4le46C1FUJqGg0Zy7fz+RI8vpHtqh0RcAmZcdeZq5LKZxKS4XoGX7VdzkNkgzMb 8n3QWvE1jGtHxfairWpVghQSXmt3f67nLKZgpJ0wlSOUANeLOeVD4+xVfKU80gvIWm5Z 2o4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=bumgosh2; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a1709061e4400b0099279210460si2204657ejj.643.2023.08.04.12.11.56; Fri, 04 Aug 2023 12:12:24 -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=@google.com header.s=20221208 header.b=bumgosh2; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbjHDR6E (ORCPT + 99 others); Fri, 4 Aug 2023 13:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbjHDR6A (ORCPT ); Fri, 4 Aug 2023 13:58:00 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BB1C46A0 for ; Fri, 4 Aug 2023 10:57:59 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-58440eb872aso26602357b3.3 for ; Fri, 04 Aug 2023 10:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691171878; x=1691776678; h=cc:to:from:subject:message-id:mime-version:in-reply-to:date:from:to :cc:subject:date:message-id:reply-to; bh=2rR0xmb+YpEUj3rb8g7lk+IJj++fv45EBtjmO2AP5zk=; b=bumgosh2Fglx/mRvU+e7OVXgC7GL8e1cUh6pLrPTjFCr9UtxKS8jKIgjXdbGU7nyIB oO617f8ho1qd8wT+xD4VFYTeaPZi2dl+K0fiOnV/oFPm98E/jQofZA3C46eOZpkfeTzt 953FClrdMN0nv5fZLFsdS92yXZz+Afi5KT8m7tdXL7zd4opZR3yx0deF4nNrYv+FXPn7 bKZ5BWu9uX07QDRB0lf3xnOAJG0MxOoOr0rZsvjSJ6u1u9iK9LaJlMjvHMRLWtt+vRqp gb7S1Mnrtcnfui9PfIh95nI/IYX7GEfDoTk12muH3wg97/2y9dAu3HKdoHHJldszxmPv G/Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691171878; x=1691776678; h=cc:to:from:subject:message-id:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2rR0xmb+YpEUj3rb8g7lk+IJj++fv45EBtjmO2AP5zk=; b=R+idzKZYVHWhWozituHJtgOiTHAo4e7ppTqDVcvG1lup2sHjNhBJZYge17WqfEw02E mCVJLonnk++7gTdVWq4w39pvQccp12tOQyyP8gmEiLUxXtbAwzVxXMzXvUuUAnmqxVZS f1otml/TsiBjnm2mzboOxAd9LV08UuG7yNeXpfuBtmFK5LfQw6upsIfYrxAdTVKClOGM WquL9OvR4/pNVCP+2xkmL0TWIXHyCe+j+JzUlmC0YbKycBOGdNKdHvn/acJz1bA5qDRQ L7tlXv7Wu3jUe++T18CIEtmI9QgjM7peZXCcxNDo5l8jmN53llacRgXQsIo3t865gAJe JMKQ== X-Gm-Message-State: AOJu0Yxs2UJSzAMSdAruxl5xNKg8bbnWzv2l5RdpOtfXJKkT9x0HHjvL xNfWePuubHzNBaWOGvPhv/4mArCEb4oddJ32Kw== X-Received: from coltonlewis-kvm.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:14ce]) (user=coltonlewis job=sendgmr) by 2002:a25:aa4e:0:b0:d45:1b81:1154 with SMTP id s72-20020a25aa4e000000b00d451b811154mr9675ybi.2.1691171878397; Fri, 04 Aug 2023 10:57:58 -0700 (PDT) Date: Fri, 04 Aug 2023 17:57:57 +0000 In-Reply-To: (message from Oliver Upton on Fri, 4 Aug 2023 16:46:22 +0000) Mime-Version: 1.0 Message-ID: Subject: Re: [PATCH 2/4] KVM: selftests: Add helper macros for ioctl()s that return file descriptors From: Colton Lewis To: Oliver Upton Cc: seanjc@google.com, maz@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, mhal@rbox.co Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 Oliver Upton writes: > 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. Couldn't ret >= 0 be the assert condition for everything? Don't see why there needs to be different helpers to check == 0 and >= 0. Unless I'm missing something, error returns are only ever negative.