Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp151445imm; Thu, 31 May 2018 21:01:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLXVeN4WXDFh0Kzf/OxHc2zGn+4jDDl/UoYSOUECi4RGZ2QNA1ZXzabEceraUBouqkMdCsZ X-Received: by 2002:a17:902:600a:: with SMTP id r10-v6mr9374075plj.70.1527825704468; Thu, 31 May 2018 21:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527825704; cv=none; d=google.com; s=arc-20160816; b=001hLC474xrgDsaAWwZiFSJpzH4epFBrrEN6vpIWMuvb6xE0OW4TWCAzzawdADZ/vl K60uLmDxBmoc2L9iFDHA4AhTz/5qN+tYGqsY9TvlbWfleRToR0JVo+FlvITzBCJ5kepf OytfmLCU9earNQEhe7JJS4jO80UWLDXe1HRx8ROVKioyVjBXu4Buo5eFUMcszOzarVXv 2ezkTtZPyaqWP280R+GssyqmWRV3JZ9ylOpoouKQl4ORY7q3ULvtKJYCF+wDU0BikrTZ QG0vGJx2AUeCKZafMzcWDKXWegAiHfDm42ZMrfhsPJtbFEk+PCWZRGULRd/oXNXoxfgx /NSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=EKbPztoxjeiNq4g63ZA1guezritpHAMDsUH5CUnR8qs=; b=B9xzuWCcNDo5nKzLbs+5roLNjULRf/zmKDIXbdXC77rWZnJwtftE2chHfYhb5GcDW7 AvaiC6WG9QZ/6ZJ9QFGQLBvs4axXPriC0c3WHaQZqBqNsfg1KCkU+ruL5WGROZs2wwf3 8KXDVmQ5YqZKuqLMlcmZZMOWIQXePb5E3Zr9YEGRyRk1jZZRZ7ZV+e3M44S+LkyQ2C/W 88tdjCRf3pP/kFRUTMKm2ufEp8jvyRhfbJ2hFCSC6s289MsU7eHHdRl/QnGcaX7LWDAn TeuhSaStCL1InmGzMP6G+wkiP3FQ/NfcQoXjbsdWKqhB1MrDSdPge05KzM1BQWn9DTlM OBPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10-v6si11752092pgs.655.2018.05.31.21.01.29; Thu, 31 May 2018 21:01:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751085AbeFAEAI (ORCPT + 99 others); Fri, 1 Jun 2018 00:00:08 -0400 Received: from mga09.intel.com ([134.134.136.24]:64187 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbeFAD7y (ORCPT ); Thu, 31 May 2018 23:59:54 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 May 2018 20:59:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,464,1520924400"; d="scan'208";a="52540887" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.203]) by fmsmga002.fm.intel.com with ESMTP; 31 May 2018 20:59:51 -0700 Date: Fri, 1 Jun 2018 12:00:07 +0800 From: Tiwei Bie To: "Michael S. Tsirkin" , stefanha@redhat.com Cc: bhelgaas@google.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, virtio-dev@lists.oasis-open.org, linux-pci@vger.kernel.org, dan.daly@intel.com, mark.d.rustad@intel.com, alexander.h.duyck@intel.com, cunming.liang@intel.com, zhihong.wang@intel.com Subject: Re: [PATCH v2] virtio_pci: support enabling VFs Message-ID: <20180601040007.GA32070@debian> References: <20180601020921.30957-1-tiwei.bie@intel.com> <20180601063224-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180601063224-mutt-send-email-mst@kernel.org> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 01, 2018 at 06:47:01AM +0300, Michael S. Tsirkin wrote: > On Fri, Jun 01, 2018 at 10:09:21AM +0800, Tiwei Bie wrote: > > There is a new feature bit allocated in virtio spec to > > support SR-IOV (Single Root I/O Virtualization): > > > > https://github.com/oasis-tcs/virtio-spec/issues/11 > > > > This patch enables the support for this feature bit in > > virtio driver. > > > > Signed-off-by: Tiwei Bie > > Acked-by: Stefan Hajnoczi > > Acked-by: Michael S. Tsirkin > > --- > > Generally you aren't supposed to carry forward acks > when you make major changes. Got it! Thank you very much! > > In this case I'm fine with the patch, so never mind. Thank you so much! Anyway, it's my fault. I'll send a new version dropping all acks. > [...] > > > > +static int virtio_pci_sriov_configure(struct pci_dev *pci_dev, int num_vfs) > > +{ > > + struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); > > + struct virtio_device *vdev = &vp_dev->vdev; > > + int ret; > > + > > + if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK)) > > + return -EBUSY; > > + > > + if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV)) > > + return -EINVAL; > > + > > + if (pci_vfs_assigned(pci_dev)) > > + return -EPERM; > > Not a comment on this patch - existing code has the > same race - but generally > > 1. this seems racy since assigning vfs does not seem > to take device lock > 2. does this work correctly for kvm at all? > pci_set_dev_assigned seems to be only called by xen. > > Can you look at addressing this pls? Sure! I'll do it! Best regards, Tiwei Bie