virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Si-Wei Liu <si-wei.liu@oracle.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org, netdev@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	xieyongji@bytedance.com, gautam.dawar@amd.com,
	Zhu Lingshan <lingshan.zhu@intel.com>
Subject: Re: [PATCH V5 4/6] vDPA: !FEATURES_OK should not block querying device config space
Date: Tue, 16 Aug 2022 15:09:37 -0700	[thread overview]
Message-ID: <a0675cf2-e711-9a2f-44fe-9bbd1ce27dba@oracle.com> (raw)
In-Reply-To: <20220816171106-mutt-send-email-mst@kernel.org>



On 8/16/2022 2:13 PM, Michael S. Tsirkin wrote:
> On Tue, Aug 16, 2022 at 12:41:21AM -0700, Si-Wei Liu wrote:
>> Hi Michael,
>>
>> I just noticed this patch got pulled to linux-next prematurely without
>> getting consensus on code review, am not sure why. Hope it was just an
>> oversight.
>>
>> Unfortunately this introduced functionality regression to at least two cases
>> so far as I see:
>>
>> 1. (bogus) VDPA_ATTR_DEV_NEGOTIATED_FEATURES are inadvertently exposed and
>> displayed in "vdpa dev config show" before feature negotiation is done.
>> Noted the corresponding features name shown in vdpa tool is called
>> "negotiated_features" rather than "driver_features". I see in no way the
>> intended change of the patch should break this user level expectation
>> regardless of any spec requirement. Do you agree on this point?
>>
>> 2. There was also another implicit assumption that is broken by this patch.
>> There could be a vdpa tool query of config via
>> vdpa_dev_net_config_fill()->vdpa_get_config_unlocked() that races with the
>> first vdpa_set_features() call from VMM e.g. QEMU. Since the S_FEATURES_OK
>> blocking condition is removed, if the vdpa tool query occurs earlier than
>> the first set_driver_features() call from VMM, the following code will treat
>> the guest as legacy and then trigger an erroneous
>> vdpa_set_features_unlocked(... , 0) call to the vdpa driver:
>>
>>   374         /*
>>   375          * Config accesses aren't supposed to trigger before features
>> are set.
>>   376          * If it does happen we assume a legacy guest.
>>   377          */
>>   378         if (!vdev->features_valid)
>>   379                 vdpa_set_features_unlocked(vdev, 0);
>>   380         ops->get_config(vdev, offset, buf, len);
>>
>> Depending on vendor driver's implementation, L380 may either return invalid
>> config data (or invalid endianness if on BE) or only config fields that are
>> valid in legacy layout. What's more severe is that, vdpa tool query in
>> theory shouldn't affect feature negotiation at all by making confusing calls
>> to the device, but now it is possible with the patch. Fixing this would
>> require more delicate work on the other paths involving the cf_lock
>> reader/write semaphore.
>>
>> Not sure what you plan to do next, post the fixes for both issues and get
>> the community review? Or simply revert the patch in question? Let us know.
>>
>> Thanks,
>> -Siwei
>>
> I'm not sure who you are asking. I didn't realize this is so
> controversial. If you feel it should be reverted I suggest
> you post a revert patch with a detailed motivation and this
> will get the discussion going.
Leave it around then, until the next person shout out aloud. I don't 
mind taking personal time to help, though my impression of the past 
conversation is that this is less productive way of cooperation and 
collaboration.

Please safely ignore me from now on.

-Siwei


> It will also help if you stress whether you describe theoretical
> issues or something observed in practice above
> discussion does not make this clear.
>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2022-08-16 22:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220812104500.163625-1-lingshan.zhu@intel.com>
2022-08-12 11:14 ` [PATCH V5 0/6] ifcvf/vDPA: support query device config space through netlink Michael S. Tsirkin
2022-08-12 11:17   ` Michael S. Tsirkin
     [not found] ` <20220812104500.163625-5-lingshan.zhu@intel.com>
2022-08-16  7:41   ` [PATCH V5 4/6] vDPA: !FEATURES_OK should not block querying device config space Si-Wei Liu
2022-08-16  8:23     ` Michael S. Tsirkin
2022-08-16 21:13     ` Michael S. Tsirkin
2022-08-16 22:09       ` Si-Wei Liu [this message]
     [not found]     ` <f2864c96-cddd-129e-7dd8-a3743fe7e0d0@intel.com>
2022-08-16  8:41       ` Michael S. Tsirkin
2022-08-16 22:48       ` Si-Wei Liu
     [not found]         ` <a488a17a-b716-52aa-cc31-2e51f8f972d2@intel.com>
2022-08-17  6:14           ` Michael S. Tsirkin
     [not found]             ` <b489413e-e933-e9b6-a719-45090a4e922c@intel.com>
2022-08-17 18:48               ` Si-Wei Liu
     [not found]                 ` <b2430d3b-4ca2-a19c-da39-da91da732c02@intel.com>
2022-08-19  0:04                   ` Si-Wei Liu

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=a0675cf2-e711-9a2f-44fe-9bbd1ce27dba@oracle.com \
    --to=si-wei.liu@oracle.com \
    --cc=gautam.dawar@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=lingshan.zhu@intel.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xieyongji@bytedance.com \
    /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).