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

Re: [Xen-devel] [PATCH] constify vcpu_set_affinity()'s second parameter

To: Jan Beulich <JBeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] constify vcpu_set_affinity()'s second parameter
From: Keir Fraser <keir@xxxxxxx>
Date: Thu, 13 Oct 2011 08:45:39 +0100
Cc:
Delivery-date: Thu, 13 Oct 2011 00:46:31 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; bh=mkIKOt83aDIdFB/tQtm2ji/2cLiuG7pr4u1SXB3/Zm4=; b=U6CPXeQs/vakCgS8YSoc8rIGAPF6MXiaeELdVlXHusCeOH8nkHzSwF7XjmiXBI5rsa 3inPFL9jBFa9GLlQ27YKIrGG8iRC1R7CeYz4WEW/Wbc3tkku64Q6cN9sT+DJHf5msr5R 7SXlPKa6xNHqNYzCpO97FviDd7/3Z7/oTnr2Y=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4E96AC64020000780005B08A@xxxxxxxxxxxxxxxxxxxx>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcyJfBngSJV8xlxumEaTHeiaY38Mkw==
Thread-topic: [Xen-devel] [PATCH] constify vcpu_set_affinity()'s second parameter
User-agent: Microsoft-Entourage/12.30.0.110427
Acked-by: Keir Fraser <keir@xxxxxxx>

On 13/10/2011 08:16, "Jan Beulich" <JBeulich@xxxxxxxx> wrote:

> None of the callers actually make use of the function's returning of
> the old affinity through its second parameter, and eliminating this
> capability allows some callers to no longer use a local variable here,
> reducing their stack footprint significantly when building with large
> NR_CPUS.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> --- a/xen/arch/x86/cpu/mcheck/vmce.c
> +++ b/xen/arch/x86/cpu/mcheck/vmce.c
> @@ -304,7 +304,6 @@ int vmce_wrmsr(u32 msr, u64 val)
>  int inject_vmce(struct domain *d)
>  {
>      int cpu = smp_processor_id();
> -    cpumask_t affinity;
>  
>      /* PV guest and HVM guest have different vMCE# injection methods. */
>      if ( !test_and_set_bool(d->vcpu[0]->mce_pending) )
> @@ -323,11 +322,9 @@ int inject_vmce(struct domain *d)
>              {
>                  cpumask_copy(d->vcpu[0]->cpu_affinity_tmp,
>                               d->vcpu[0]->cpu_affinity);
> -                cpus_clear(affinity);
> -                cpu_set(cpu, affinity);
>                  mce_printk(MCE_VERBOSE, "MCE: CPU%d set affinity, old %d\n",
>                             cpu, d->vcpu[0]->processor);
> -                vcpu_set_affinity(d->vcpu[0], &affinity);
> +                vcpu_set_affinity(d->vcpu[0], cpumask_of(cpu));
>                  vcpu_kick(d->vcpu[0]);
>              }
>              else
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -3113,7 +3113,6 @@ static void nmi_mce_softirq(void)
>  {
>      int cpu = smp_processor_id();
>      struct softirq_trap *st = &per_cpu(softirq_trap, cpu);
> -    cpumask_t affinity;
>  
>      BUG_ON(st == NULL);
>      BUG_ON(st->vcpu == NULL);
> @@ -3129,9 +3128,7 @@ static void nmi_mce_softirq(void)
>           * Make sure to wakeup the vcpu on the
>           * specified processor.
>           */
> -        cpus_clear(affinity);
> -        cpu_set(st->processor, affinity);
> -        vcpu_set_affinity(st->vcpu, &affinity);
> +        vcpu_set_affinity(st->vcpu, cpumask_of(st->processor));
>  
>          /* Affinity is restored in the iret hypercall. */
>      }
> @@ -3201,14 +3198,11 @@ void async_exception_cleanup(struct vcpu
>                   !test_and_set_bool(curr->mce_pending) )
>              {
>                  int cpu = smp_processor_id();
> -                cpumask_t affinity;
>  
>                  cpumask_copy(curr->cpu_affinity_tmp, curr->cpu_affinity);
> -                cpus_clear(affinity);
> -                cpu_set(cpu, affinity);
>                  printk(XENLOG_DEBUG "MCE: CPU%d set affinity, old %d\n",
>                         cpu, curr->processor);
> -                vcpu_set_affinity(curr, &affinity);
> +                vcpu_set_affinity(curr, cpumask_of(cpu));
>              }
>          }
>      }
> --- a/xen/common/schedule.c
> +++ b/xen/common/schedule.c
> @@ -587,9 +587,9 @@ int cpu_disable_scheduler(unsigned int c
>      return ret;
>  }
>  
> -int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity)
> +int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity)
>  {
> -    cpumask_t online_affinity, old_affinity;
> +    cpumask_t online_affinity;
>      cpumask_t *online;
>  
>      if ( v->domain->is_pinned )
> @@ -601,9 +601,7 @@ int vcpu_set_affinity(struct vcpu *v, cp
>  
>      vcpu_schedule_lock_irq(v);
>  
> -    cpumask_copy(&old_affinity, v->cpu_affinity);
>      cpumask_copy(v->cpu_affinity, affinity);
> -    cpumask_copy(affinity, &old_affinity);
>      if ( !cpumask_test_cpu(v->processor, v->cpu_affinity) )
>          set_bit(_VPF_migrating, &v->pause_flags);
>  
> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -617,7 +617,7 @@ void scheduler_free(struct scheduler *sc
>  int schedule_cpu_switch(unsigned int cpu, struct cpupool *c);
>  void vcpu_force_reschedule(struct vcpu *v);
>  int cpu_disable_scheduler(unsigned int cpu);
> -int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity);
> +int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity);
>  
>  void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate);
>  uint64_t get_cpu_idle_time(unsigned int cpu);
> 
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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

<Prev in Thread] Current Thread [Next in Thread>