All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 3/3] x86/HPET: cache MSI message last written
Date: Thu, 18 Oct 2012 17:42:00 +0100	[thread overview]
Message-ID: <CCA5EFE8.41F78%keir.xen@gmail.com> (raw)
In-Reply-To: <507FF88702000078000A24FE@nat28.tlf.novell.com>

On 18/10/2012 11:39, "Jan Beulich" <JBeulich@suse.com> wrote:

>>>> On 18.10.12 at 10:22, Keir Fraser <keir@xen.org> wrote:
>> On 16/10/2012 16:11, "Jan Beulich" <JBeulich@suse.com> wrote:
>> 
>>> Rather than spending measurable amounts of time reading back the most
>>> recently written message, cache it in space previously unused, and thus
>>> accelerate the CPU's entering of the intended C-state.
>>> 
>>> hpet_msi_read() ends up being unused after this change, but rather than
>>> removing the function, it's being marked "unused" in order - that way
>>> it can easily get used again should a new need for it arise.
>> 
>> Please use __attribute_used__
> 
> That wouldn't be correct: The function _is_ unused (and there's
> no issue if it was used afaik), and the __used__ attribute ought
> to tell the compiler to keep the function around despite not
> having (visible to it) callers.

Perhaps our __attribute_used__ definition should change, then?

 -- Keir

> Jan
> 
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> 
>> Acked-by: Keir Fraser <keir@xen.org>
>> 
>>> --- a/xen/arch/x86/hpet.c
>>> +++ b/xen/arch/x86/hpet.c
>>> @@ -253,17 +253,19 @@ static void hpet_msi_mask(struct irq_des
>>>  
>>>  static void hpet_msi_write(struct hpet_event_channel *ch, struct msi_msg
>>> *msg)
>>>  {
>>> +    ch->msi.msg = *msg;
>>>      if ( iommu_intremap )
>>>          iommu_update_ire_from_msi(&ch->msi, msg);
>>>      hpet_write32(msg->data, HPET_Tn_ROUTE(ch->idx));
>>>      hpet_write32(msg->address_lo, HPET_Tn_ROUTE(ch->idx) + 4);
>>>  }
>>>  
>>> -static void hpet_msi_read(struct hpet_event_channel *ch, struct msi_msg
>> *msg)
>>> +static void __attribute__((__unused__))
>>> +hpet_msi_read(struct hpet_event_channel *ch, struct msi_msg *msg)
>>>  {
>>>      msg->data = hpet_read32(HPET_Tn_ROUTE(ch->idx));
>>>      msg->address_lo = hpet_read32(HPET_Tn_ROUTE(ch->idx) + 4);
>>> -    msg->address_hi = 0;
>>> +    msg->address_hi = MSI_ADDR_BASE_HI;
>>>      if ( iommu_intremap )
>>>          iommu_read_msi_from_ire(&ch->msi, msg);
>>>  }
>>> @@ -285,20 +287,19 @@ static void hpet_msi_ack(struct irq_desc
>>>  
>>>  static void hpet_msi_set_affinity(struct irq_desc *desc, const cpumask_t
>>> *mask)
>>>  {
>>> -    struct msi_msg msg;
>>> -    unsigned int dest;
>>> +    struct hpet_event_channel *ch = desc->action->dev_id;
>>> +    struct msi_msg msg = ch->msi.msg;
>>>  
>>> -    dest = set_desc_affinity(desc, mask);
>>> -    if (dest == BAD_APICID)
>>> +    msg.dest32 = set_desc_affinity(desc, mask);
>>> +    if ( msg.dest32 == BAD_APICID )
>>>          return;
>>>  
>>> -    hpet_msi_read(desc->action->dev_id, &msg);
>>>      msg.data &= ~MSI_DATA_VECTOR_MASK;
>>>      msg.data |= MSI_DATA_VECTOR(desc->arch.vector);
>>>      msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
>>> -    msg.address_lo |= MSI_ADDR_DEST_ID(dest);
>>> -    msg.dest32 = dest;
>>> -    hpet_msi_write(desc->action->dev_id, &msg);
>>> +    msg.address_lo |= MSI_ADDR_DEST_ID(msg.dest32);
>>> +    if ( msg.data != ch->msi.msg.data || msg.dest32 != ch->msi.msg.dest32 )
>>> +        hpet_msi_write(ch, &msg);
>>>  }
>>>  
>>>  /*
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Xen-devel mailing list
>>> Xen-devel@lists.xen.org
>>> http://lists.xen.org/xen-devel
> 
> 
> 

  reply	other threads:[~2012-10-18 16:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-16 15:05 [PATCH 0/3] x86: HPET adjustments Jan Beulich
2012-10-16 15:09 ` [PATCH 1/3] x86/HPET: obtain proper lock for changing IRQ affinity Jan Beulich
2012-10-16 15:41   ` Keir Fraser
2012-10-16 16:11     ` Jan Beulich
2012-10-16 21:49       ` Keir Fraser
2012-10-17 11:45         ` [PATCH v2 " Jan Beulich
2012-10-17 11:58           ` Keir Fraser
2012-10-16 15:10 ` [PATCH 2/3] x86/HPET: allow use for broadcast when interrupt remapping is in effect Jan Beulich
2012-10-17 11:47   ` [PATCH v2 " Jan Beulich
2012-10-17 11:59     ` Keir Fraser
2012-10-18  0:31       ` Zhang, Xiantao
2012-10-18  8:11       ` Jan Beulich
2012-10-16 15:11 ` [PATCH 3/3] x86/HPET: cache MSI message last written Jan Beulich
2012-10-18  8:22   ` Keir Fraser
2012-10-18 10:39     ` Jan Beulich
2012-10-18 16:42       ` Keir Fraser [this message]
2012-10-19  7:57         ` Jan Beulich
2012-10-19  9:32           ` Keir Fraser
2012-10-19  9:40             ` Jan Beulich
2012-10-25 11:53             ` [PATCH v2] " Jan Beulich
2012-10-25 12:18               ` Keir Fraser

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=CCA5EFE8.41F78%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=JBeulich@suse.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 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.