xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "Kevin Tian" <kevin.tian@intel.com>,
	"Quan Xu" <quan.xu0@gmail.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	xen-devel@lists.xen.org, "Julien Grall" <julien.grall@arm.com>,
	"Jun Nakajima" <jun.nakajima@intel.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v2] x86/vpt: guarantee the return value of pt_update_irq() set in vIRR or PIR
Date: Mon, 16 Oct 2017 21:46:02 +0800	[thread overview]
Message-ID: <20171016134602.GB84642@op-computing> (raw)
In-Reply-To: <59E4DDA10200007800186C54@prv-mh.provo.novell.com>

On Mon, Oct 16, 2017 at 08:26:09AM -0600, Jan Beulich wrote:
>>>> On 16.10.17 at 15:13, <chao.gao@intel.com> wrote:
>> On Mon, Oct 16, 2017 at 07:15:16AM -0600, Jan Beulich wrote:
>>>>>> On 13.10.17 at 07:10, <chao.gao@intel.com> wrote:
>>>> --- a/xen/arch/x86/hvm/irq.c
>>>> +++ b/xen/arch/x86/hvm/irq.c
>>>> @@ -168,11 +168,13 @@ void hvm_gsi_deassert(struct domain *d, unsigned int gsi)
>>>>      spin_unlock(&d->arch.hvm_domain.irq_lock);
>>>>  }
>>>>  
>>>> -void hvm_isa_irq_assert(
>>>> -    struct domain *d, unsigned int isa_irq)
>>>> +int hvm_isa_irq_assert(struct domain *d, unsigned int isa_irq,
>>>> +                       int (*get_vector)(const struct domain *d,
>>>> +                                         unsigned int gsi))
>>>>  {
>>>>      struct hvm_irq *hvm_irq = hvm_domain_irq(d);
>>>>      unsigned int gsi = hvm_isa_irq_to_gsi(isa_irq);
>>>> +    int vector = 0;
>>>
>>>Why zero (which is valid aiui) instead of e.g. -1?
>> 
>> vector also serves as the return value. I want to return 0 if no
>> callback is set.  And the callback, get_vector, can override the return
>> value. Do you think it is reasonable?
>
>Why "also" - being the return value is the only purpose of "vector".
>And as said - zero is a valid vector, and I wouldn't like to see the
>function return a valid but meaningless vector number.

But if no callback is set, would it be a little weird to return -1 which
always means failure? Considering no caller would be confused by the
return value (since except the caller introduced by this patch, no one
would check the return value), I don't insist on this.

>
>>>> --- a/xen/include/asm-x86/hvm/vmx/vmx.h
>>>> +++ b/xen/include/asm-x86/hvm/vmx/vmx.h
>>>> @@ -109,6 +109,11 @@ static inline int pi_test_and_set_pir(int vector, struct pi_desc *pi_desc)
>>>>      return test_and_set_bit(vector, pi_desc->pir);
>>>>  }
>>>>  
>>>> +static inline int pi_test_pir(int vector, const struct pi_desc *pi_desc)
>>>
>>>This should not be a signed quantity - uint8_t or unsigned int
>>>please.
>> 
>> Yes.
>
>I.e. meaning you're fine with either variant, leaving it up to me
>which one to use?

Yes, both of them are ok to me.

Thanks
Chao

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-10-16 13:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  5:10 [PATCH v2] x86/vpt: guarantee the return value of pt_update_irq() set in vIRR or PIR Chao Gao
2017-10-16 13:15 ` Jan Beulich
2017-10-16 13:13   ` Chao Gao
2017-10-16 14:26     ` Jan Beulich
2017-10-16 13:46       ` Chao Gao [this message]
2017-10-16 14:51         ` Jan Beulich

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=20171016134602.GB84642@op-computing \
    --to=chao.gao@intel.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=quan.xu0@gmail.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).