WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] xen: always handle VIRQ_TIMER first.

To: Ian Campbell <ian.campbell@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] xen: always handle VIRQ_TIMER first.
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Fri, 15 Oct 2010 10:18:07 -0700
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, keir@xxxxxxx
Delivery-date: Fri, 15 Oct 2010 10:18:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1287139966-19391-1-git-send-email-ian.campbell@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1287139966-19391-1-git-send-email-ian.campbell@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Lightning/1.0b3pre Thunderbird/3.1.4
 On 10/15/2010 03:52 AM, Ian Campbell wrote:
> This ensures that system is updated before calling any hard irq
> handlers after a long period of ticklessness. If we do not do this
> then hardirq will see a jiffies from before the period of ticklessness
> and make intcorrect decisions regarding timer expiry etc.
>
> This resolves issues e.g. with USB keyboard timer repeats.
>
> Based on a patch by Keir Fraser.

I talked about this with James, and it makes no sense to me at all.

    J

> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Cc: keir@xxxxxxx
> ---
>  drivers/xen/events.c |   22 +++++++++++++++++++++-
>  1 files changed, 21 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/xen/events.c b/drivers/xen/events.c
> index c9d1d4a..1496ba5 100644
> --- a/drivers/xen/events.c
> +++ b/drivers/xen/events.c
> @@ -1052,6 +1052,7 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
>  
>       do {
>               unsigned long pending_words;
> +             int irq;
>  
>               vcpu_info->evtchn_upcall_pending = 0;
>  
> @@ -1062,6 +1063,24 @@ static void __xen_evtchn_do_upcall(struct pt_regs 
> *regs)
>               /* Clear master flag /before/ clearing selector flag. */
>               wmb();
>  #endif
> +
> +             /*
> +              * Handle timer interrupts before all others, so that all
> +              * hardirq handlers see an up-to-date system time even if we
> +              * have just woken from a long idle period.
> +              */
> +             irq = percpu_read(virq_to_irq[VIRQ_TIMER]);
> +             if (irq != -1) {
> +                     int word_idx;
> +                     int bit_idx;
> +                     int port = evtchn_from_irq(irq);
> +                     word_idx = port / BITS_PER_LONG;
> +                     bit_idx = port % BITS_PER_LONG;
> +                     if (VALID_EVTCHN(port) &&
> +                         (active_evtchns(cpu, s, word_idx) & (1UL<<bit_idx)))
> +                             (void)handle_irq(irq, regs);
> +             }
> +
>               pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
>               while (pending_words != 0) {
>                       unsigned long pending_bits;
> @@ -1071,9 +1090,10 @@ static void __xen_evtchn_do_upcall(struct pt_regs 
> *regs)
>                       while ((pending_bits = active_evtchns(cpu, s, 
> word_idx)) != 0) {
>                               int bit_idx = __ffs(pending_bits);
>                               int port = (word_idx * BITS_PER_LONG) + bit_idx;
> -                             int irq = evtchn_to_irq[port];
>                               struct irq_desc *desc;
>  
> +                             irq = evtchn_to_irq[port];
> +
>                               mask_evtchn(port);
>                               clear_evtchn(port);
>  


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel