Discussion of the implementations of VIRTIO specification
 help / color / mirror / Atom feed
From: "Liu, Jing2" <jing2.liu@linux.intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, qemu-devel@nongnu.org,
	Chao Peng <chao.p.peng@linux.intel.com>,
	Liu Jiang <gerry@linux.alibaba.com>,
	Zha Bin <zhabin@linux.alibaba.com>
Subject: Re: [virtio-dev] [PATCH v2 5/5] virtio-mmio: MSI vector and event mapping
Date: Tue, 11 Feb 2020 11:24:41 +0800	[thread overview]
Message-ID: <4f2e205a-3066-f917-fdc6-e110f1d3bf62@linux.intel.com> (raw)
In-Reply-To: <20200129051247-mutt-send-email-mst@kernel.org>

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


On 1/29/2020 6:14 PM, Michael S. Tsirkin wrote:
> On Tue, Jan 21, 2020 at 09:54:33PM +0800, Jing Liu wrote:
>> Bit 1 msi_sharing reported in the MsiState register indicates the mapping mode
>> device uses.
>>
>> Bit 1 is 0 - device uses MSI non-sharing mode. This indicates vector per event and
>> fixed static vectors and events relationship. This fits for devices with a high interrupt
>> rate and best performance;
>> Bit 1 is 1 - device uses MSI sharing mode. This indicates vectors and events
>> dynamic mapping and fits for devices not requiring a high interrupt rate.

Thanks for reviewing! Sorry for the late reply.

For msi sharing/non-sharing mode, we are trying to define a rule that,

simply using 1 bit to indicate what device wants and what driver should 
do. Let me try to explain details.

If it's sharing mode (bit=1), it means device doesn't want vector per 
queue or a high interrupt rate.

Driver should meet such request.

So define that, device should support at least 2 msi vectors and driver 
should use

VIRTIO_MMIO_MSI_CMD_MAP_CONFIG/VIRTIO_MMIO_MSI_CMD_MAP_QUEUE commands

to map the configuration change/selected queue events.

In implementation, driver will detect the bit=1, turn to !per_vq_vector 
and map 1 vector for config

and 1 for all queues to meet the request. (Maybe we need restrict this 
in spec too.)

> It seems that sharing mode is a superset of non-sharing mode.

I think sharing mode is not a superset, because driver should not map 
1:1 which will go against

the request from device that it doesn't want 1:1 (non-sharing mode).

In other words, device chooses the way it wants, a high interrupt rate 
with 1:1 or not.

> Isn't that right? E.g. with sharing mode drivers
> can still avoid sharing if they like.
Drivers should not avoid msi sharing if that bit is 1.
> Maybe it should just be a hint to drivers whether to share
> interrupts,
The sharing mode bit is the hint to indicate whether to share interrupts. :)
> instead of a completely different layout?

Except the bit, no other different register layout is there for such 
feature.

Thanks!

Jing

>> diff --git a/msi-state.c b/msi-state.c
>> index b1fa0c1..d470be4 100644
>> --- a/msi-state.c
>> +++ b/msi-state.c
>> @@ -1,4 +1,5 @@
>>   le32 {
>>       msi_enabled : 1;
>> -    reserved : 31;
>> +    msi_sharing: 1;
>> +    reserved : 30;
>>   };
>> -- 
>> 2.7.4
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
>> For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org

[-- Attachment #2: Type: text/html, Size: 4920 bytes --]

      reply	other threads:[~2020-02-11  3:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21 13:54 [virtio-dev] [PATCH v2 0/5] virtio-mmio enhancement Jing Liu
2020-01-21 13:54 ` [virtio-dev] [PATCH v2 1/5] virtio-mmio: Add feature bit for MMIO notification Jing Liu
2020-01-21 13:54 ` [virtio-dev] [PATCH v2 2/5] virtio-mmio: Enhance queue notification support Jing Liu
2020-01-21 13:54 ` [virtio-dev] [PATCH v2 3/5] virtio-mmio: Add feature bit for MMIO MSI Jing Liu
2020-01-21 13:54 ` [virtio-dev] [PATCH v2 4/5] virtio-mmio: Introduce MSI details Jing Liu
2020-01-29 10:12   ` Michael S. Tsirkin
2020-01-21 13:54 ` [virtio-dev] [PATCH v2 5/5] virtio-mmio: MSI vector and event mapping Jing Liu
2020-01-29 10:14   ` Michael S. Tsirkin
2020-02-11  3:24     ` Liu, Jing2 [this message]

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=4f2e205a-3066-f917-fdc6-e110f1d3bf62@linux.intel.com \
    --to=jing2.liu@linux.intel.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=gerry@linux.alibaba.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=zhabin@linux.alibaba.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