From: James Sullivan <sullivan.james.f@gmail.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org, gleb@kernel.org, pbonzini@redhat.com,
"Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [Patch v5] x86: irq_comm: Add check for RH bit in kvm_set_msi_irq
Date: Wed, 18 Mar 2015 18:59:22 -0600 [thread overview]
Message-ID: <550A1F6A.6030602@gmail.com> (raw)
In-Reply-To: <20150318225225.GA8702@amt.cnet>
>
> The documentation states the following:
>
> * When RH is 0, the interrupt is directed to the processor listed in the
> Destination ID field.
>
> * If RH is 0, then the DM bit is ignored and the message is sent ahead
> independent of whether the physical or logical destination mode is used.
>
> However, from the POV of a device writing to memory to generate an MSI
> interrupt, there is no (or i can't see any) other information that
> can be used to infer logical or physical mode for the interrupt message.
>
> Before your patch:
>
> (dm, rh) = (0, 0) => irq->dest_mode = 0
> (dm, rh) = (0, 1) => irq->dest_mode = 0
> (dm, rh) = (1, 0) => irq->dest_mode = 1
> (dm, rh) = (1, 1) => irq->dest_mode = 1
>
> After your patch:
>
> (dm, rh) = (0, 0) => irq->dest_mode = 0
> (dm, rh) = (0, 1) => irq->dest_mode = 0
> (dm, rh) = (1, 0) => irq->dest_mode = 0
> (dm, rh) = (1, 1) => irq->dest_mode = 1
>
>
> Am i missing some explicit documentation that refers
> to (dm, rh) = (1, 0) => irq->dest_mode = 0 ?
>From the IA32 manual (Vol. 3, 10.11.2):
* When RH is 0, the interrupt is directed to the processor listed
in the Destination ID field.
* When RH is 1 and the physical destination mode is used, the Destination
ID field must not be set to FFH; it must point to a processor that is
present and enabled to receive the interrupt.
* When RH is 1 and the logical destination mode is active in a system using
a flat addressing model, the Destination ID field must be set so that bits
set to 1 identify processors that are present and enabled to receive the
interrupt.
* If RH is set to 1 and the logical destination mode is active in a system
using cluster addressing model, then Destination ID field must not be
set to FFH; the processors identified with this field must be present
and enabled to receive the interrupt.
My interpretation of this is that RH=0 indicates that the Dest. ID field
contains an APIC ID, and as such destination mode is physical. When RH=1,
depending on the value of DM, we either use physical or logical dest mode.
The result of this is that logical dest mode is set just when RH=1/DM=1,
as far as I understand.
>
> See native_compose_msi_msg:
>
> msg->address_lo =
> MSI_ADDR_BASE_LO |
> ((apic->irq_dest_mode == 0) ?
> MSI_ADDR_DEST_MODE_PHYSICAL :
> MSI_ADDR_DEST_MODE_LOGICAL) |
> ((apic->irq_delivery_mode != dest_LowestPrio) ?
> MSI_ADDR_REDIRECTION_CPU :
> MSI_ADDR_REDIRECTION_LOWPRI) |
> MSI_ADDR_DEST_ID(dest);
>
>
> So it does configure DM = MSI_ADDR_DEST_MODE_LOGICAL
> and RH = MSI_ADDR_REDIRECTION_LOWPRI.
>
...and yet this is a good counterexample against my argument :)
What I think I'll do is revert this particular change so that dest_mode is
set independently of RH. While I'm not entirely convinced that this is the
intended interpretation, I do think that consistency with the existing logic
is probably desirable for the time being. If I can get closure on the matter
I'll re-submit that change, but for the time being I will undo it.
-James
next prev parent reply other threads:[~2015-03-19 1:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-13 15:14 [Patch v5] x86: irq_comm: Add check for RH bit in kvm_set_msi_irq James Sullivan
2015-03-13 15:48 ` Radim Krčmář
2015-03-17 15:23 ` James Sullivan
2015-03-18 22:52 ` Marcelo Tosatti
2015-03-19 0:59 ` James Sullivan [this message]
2015-03-19 1:09 ` Marcelo Tosatti
2015-03-19 13:00 ` Radim Krčmář
2015-03-19 22:51 ` James Sullivan
2015-03-20 15:15 ` Radim Krčmář
2015-03-20 15:22 ` James Sullivan
2015-03-20 17:50 ` James Sullivan
2015-03-23 21:13 ` Radim Krčmář
2015-03-23 22:46 ` James Sullivan
2015-03-24 14:03 ` Radim Krčmář
2015-03-24 14:17 ` James Sullivan
2015-04-02 22:08 ` James Sullivan
2015-04-03 10:11 ` Radim Krčmář
2015-04-21 12:18 ` Paolo Bonzini
2015-04-21 12:44 ` Radim Krčmář
2015-03-19 1:11 ` Marcelo Tosatti
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=550A1F6A.6030602@gmail.com \
--to=sullivan.james.f@gmail.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.