linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tomorrow Wang (王德明)" <wangdeming@inspur.com>
To: "viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	"jgg@nvidia.com" <jgg@nvidia.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] vfio: Use filp instead of fd
Date: Tue, 27 Sep 2022 01:25:51 +0000	[thread overview]
Message-ID: <0a80a16aa10142c5811eb6151f7cdbc9@inspur.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1389 bytes --]

Hi,

Why kvm_vfio_group_add use file? 

  struct file *filp;
  ......
  filp = fget(fd);
  ......
  fput(filp);



>--------
> send: Al Viro <viro@ftp.linux.org.uk> 代表 Al Viro
> 发送时间: 2022年9月27日 3:38
>to: Jason Gunthorpe <jgg@nvidia.com>
> pbonzini@redhat.com; kvm@vger.kernel.org; linux-kernel@vger.kernel.org
> sub: Re: [PATCH] vfio: Use filp instead of fd
> 
> 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 <wangdeming@inspur.com>
> > > ---
> > >  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.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3780 bytes --]

             reply	other threads:[~2022-09-27  1:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27  1:25 tomorrow Wang (王德明) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-09-27  1:21 [PATCH] vfio: Use filp instead of fd tomorrow Wang (王德明)
2022-09-27  1:37 ` Al Viro
2022-09-26  6:54 Deming Wang
2022-09-26 13:23 ` Al Viro
2022-09-26 17:07 ` Jason Gunthorpe
2022-09-26 19:38   ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a80a16aa10142c5811eb6151f7cdbc9@inspur.com \
    --to=wangdeming@inspur.com \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).