From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] Add irqdevice interface + userint implementation
Date: Tue, 10 Apr 2007 19:08:22 +0300 [thread overview]
Message-ID: <461BB676.7010105@qumranet.com> (raw)
In-Reply-To: <461B7755.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Gregory Haskins wrote:
>
>> where - >pending() has to program a tpr exit if current tpr masks an
>> interrupt.
>>
>
> I wasn't planning on the irqdevice having this type of control because I assumed we would always have these exit types set, but you have highlighted an interesting point. If we want to selectively enable these different types of exits (and I agree that it's probably a good idea), we need more intelligence from the irqdevice. Now the question is how to handle/detect the different *types* of masking that can occur. My current API is really just designed to return a boolean: true = "there are injectable vectors", false = "there are no injectable vectors (but there may be masked vectors).
>
> I don't like the idea of this programming being handled directly by the irqdevice because I think its potentially the wrong layer. However, we do need to account for this somehow. We could change the API to handle the pending condition as a tri-level: no-interrupts, masked-interrupts, injectable-interrupts? For "no" and "injectable", the operation is as your psuedo-code indicates. For the masked case, we could enumerate different classes of reasons (e.g. TPR, etc) that could be used to drive the programming. So the pseudo-code would now be:
>
> spin_lock(vcpu- >irq_lock)
> nmi = !irq_window_open(vcpu)
> switch (vcpu- >irq- >pending(nmi, &mask_reasons)) {
> case NONE_PENDING:
> break;
> case MASKED_PENDING:
> if (mask_reasons & MASKREASON_TPR)
> vcpu->exit_reasons &= TPR;
> /* etc */
> break;
> case PENDING:
> inject(vcpu, vcpu- >irq- >read_vector(nmi))
> break;
> }
> spin_unlock(vcpu- >irq_lock)
>
> Thoughts?
>
>
>> The alternative I'm suggesting is to move all this mess into the
>> irqdevice code in a single callback. While this has less reuse
>> potential, in fact the hardware itself is messy and attempts to
>> generalize it may turn into a mess as well.
>>
>>
>
> I cant quite wrap my head around how I could work out all of the issues as I (think) have done with the current proposal, but I am open to suggestion. Can you elaborate more?
>
My suggestion is basically to give up on having well separated layers of
interrupts and vcpu but hack as necessary. While this may sound
heretical, it actually follows the hardware. Note how cr8 (a cpu
register) is aliased to the tpr (an irqdevice entity), and how VT and
SVM (which are supposed to virtualize the cpu) actually provide some
apic emulation capabilities.
My point is that the hardware is a tangled mess, and any attempt to
pretend otherwise in software will lead to a brittle model that breaks
often/is unnatural/is clumsy (like the switch above).
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
next prev parent reply other threads:[~2007-04-10 16:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-05 18:53 [PATCH] Add irqdevice interface + userint implementation Gregory Haskins
2007-04-05 21:38 ` Fwd: " Gregory Haskins
[not found] ` <4614FF5C.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-08 6:47 ` Avi Kivity
[not found] ` <46189005.2090609-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-09 18:36 ` Gregory Haskins
[not found] ` <461A415C.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-10 7:52 ` Avi Kivity
[not found] ` <461B4241.5030101-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-10 11:36 ` Gregory Haskins
[not found] ` <461B3E61.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-10 12:01 ` Avi Kivity
[not found] ` <461B7C81.7040102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-10 14:20 ` Gregory Haskins
[not found] ` <461B64E4.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-10 14:46 ` Avi Kivity
[not found] ` <461BA363.5080308-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-10 15:39 ` Gregory Haskins
2007-04-10 15:53 ` Fwd: " Gregory Haskins
[not found] ` <461B7AC6.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-10 16:11 ` Avi Kivity
[not found] ` <461BB738.7040206-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-10 17:58 ` Gregory Haskins
[not found] ` <461B7755.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-10 16:08 ` Avi Kivity [this message]
2007-04-08 9:58 ` Christoph Hellwig
[not found] ` <20070408095853.GA31284-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2007-04-08 10:23 ` Avi Kivity
[not found] ` <4618C293.8030902-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-08 10:33 ` Christoph Hellwig
2007-04-09 14:53 ` Gregory Haskins
-- strict thread matches above, loose matches on Subject: below --
2007-04-09 20:27 Gregory Haskins
[not found] ` <461A5B6C.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-10 7:33 ` Avi Kivity
2007-04-10 8:23 ` Christoph Hellwig
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=461BB676.7010105@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/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