Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp315875rwb; Mon, 26 Sep 2022 12:46:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kdqFJjWbyowZ73R7dTHwXyv8ezpa3d669lkJgBRMu21xCi1gpfGdsT7Qec387enzVAWYr X-Received: by 2002:a63:c06:0:b0:439:9b18:8574 with SMTP id b6-20020a630c06000000b004399b188574mr21251810pgl.608.1664221614765; Mon, 26 Sep 2022 12:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664221614; cv=none; d=google.com; s=arc-20160816; b=uatC+262sOrqBYwl+xTma/hzp4rPxgm1PW+0x1Hipg38nf9e2/GHfbN1afZoB9+7mi KGjYGiHtQMuyaQwwVgOXh2qyjwrdVg+IpZrkjWPf0NtqFjtRoKHpglrVoie3Fj/noTka DfITLgFztsKupVVtRSI0npcmA2GjwHJsjeGHtsB9gHQiFA0QL/ZE8HuYPoGm9oqpfO7T ZZ0MwJI1HPIJDH7Qqr1SB1+6E4D52GDM0aIz7FYnkfHnzTQ3oj8pHyts0dfI8XgmNV+J WvT1R8aFTQ1z+QoHjhfcK44tvJHAJgQVTl8osCnVdfLoEAyHqHyUdSCcNeLIETISE8h3 WVEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=y/fhhdO+hP5SZGRczsI4VmDv/zHyzfyxBK/7E32g0Fc=; b=cM94/1Blca/i1yGVwm9KqxnHmUYdt9pibWG1wsp4ZYiOW/Iqo449PUP6QoRREIg7d+ iYJYCWyBeRtXr3H27vqixjsE6GZ5AyF0Botuy2BCRjwzX0NnDSBH7ifRKjO25p3CXcWN HHCsuc2M/i9Q/5K5pgzeI7F6kIDGc9+xS+4NB0LmF/fjhqIv8RLZVWdpLWoFkbTviOQj h4/gpTH9/XMAayTmnRyZtCKeLMsQFSFmPy1aVyTBzY7lnCymsO9O8wquxNOYo2KMvA1M si1i5OuQBRox2fYV+/PzVMlxqTZt+UsRtDygYXoF9Ot3zYgjVPfR0QIqjoIF/jtG6LVO owbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=Jja4SiCU; 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=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id np15-20020a17090b4c4f00b001fd7ae1ae32si15509713pjb.126.2022.09.26.12.46.42; Mon, 26 Sep 2022 12:46:54 -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.org.uk header.s=zeniv-20220401 header.b=Jja4SiCU; 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=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229803AbiIZTie (ORCPT + 99 others); Mon, 26 Sep 2022 15:38:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbiIZTic (ORCPT ); Mon, 26 Sep 2022 15:38:32 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C9FE6CF64; Mon, 26 Sep 2022 12:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=y/fhhdO+hP5SZGRczsI4VmDv/zHyzfyxBK/7E32g0Fc=; b=Jja4SiCUJTT/PeyL/ZQOcHGXdn lMtW7G6herngtQ8QyA/+X7G8sY1RETTMsuYQQmaMTDI/RcCe7jqrmwsqo9bBE6j1P5R42hFnQBpOG rkX8lBmAHsWLbxvFtjA8S0nbrPv+w6Kg2Jt51U0IzmPPxrAObcLsC/eeE4I+NJT9w/3uWqjuvieRP ygFIT4H5bkpWj0lmabIbKh6uty0Irgmr0hxyuZNPTONxORKvdJMzMo+2CzvLOrWz52JzA9IccUht0 qhx2y/FkRkTAwAtKV9qt25O29JjSRo2bquTCp8xVizyy2FX5ybSF6gFtbjeWH7sNdBBpCbCEvVaIc gn1jeUhA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1octvm-0048Eh-01; Mon, 26 Sep 2022 19:38:18 +0000 Date: Mon, 26 Sep 2022 20:38:17 +0100 From: Al Viro To: Jason Gunthorpe Cc: Deming Wang , pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] vfio: Use filp instead of fd Message-ID: References: <20220926065407.2389-1-wangdeming@inspur.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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 On Mon, Sep 26, 2022 at 02:07:43PM -0300, Jason Gunthorpe wrote: > On Mon, Sep 26, 2022 at 02:54:07AM -0400, Deming Wang wrote: > > The function of kvm_vfio_group_set_spapr_tce and kvm_vfio_group_del > > use fd indirectly.But,it only be used for fd.file. So,we can directly > > use the struct of file instead. > > > > Signed-off-by: Deming Wang > > --- > > virt/kvm/vfio.c | 24 ++++++++++++------------ > > 1 file changed, 12 insertions(+), 12 deletions(-) > > I thought about changing this too when I was looking at > this. fdget/fdput includes a tiny micro-optimization that is legal > here, however I doubt anyone cares about performance on this path. Microoptimization or not, I'd rather keep fget() limited to cases where we really need it. There are non-trivial cases and having them easy to find is a good thing. Again, the preferred way to do descriptor lookups is fdget() family, not fget() one.