All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: keir@xen.org, suravee.suthikulpanit@amd.com,
	andrew.cooper3@citrix.com, eddie.dong@intel.com,
	dietmar.hahn@ts.fujitsu.com, jun.nakajima@intel.com,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v3 12/16] x86/VPMU: Handle PMU interrupts for PV guests
Date: Thu, 16 Jan 2014 09:58:25 -0500	[thread overview]
Message-ID: <52D7F391.60500@oracle.com> (raw)
In-Reply-To: <52D7B158020000780011427E@nat28.tlf.novell.com>

On 01/16/2014 04:15 AM, Jan Beulich wrote:
>> @@ -82,7 +87,23 @@ int vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
>> ...
>> +        {
>> +            vpmu_set(vpmu, VPMU_CONTEXT_SAVE);
>> +            (void)vpmu->arch_vpmu_ops->arch_vpmu_save(current);
> What's this cast good for?

These routines return an int that indicates whether this was full 
context save or just that the counters have been stopped. Depending on 
where the routines are called from we may ignore the return value 
(having VPMU_CONTEXT_SAVE forces "full save").

I did it so that compiler won't complain about ignoring return value (I 
don't think it does now but I imagine some version still may).

>> +            vpmu_reset(vpmu, VPMU_CONTEXT_SAVE | VPMU_CONTEXT_LOADED);
>> +        }
>> +        return val;
>> +    }
>>       return 0;
>>   }
>>   
...
>> +    /* dom0 will handle this interrupt */
>> +    if ( v->domain->domain_id >= DOMID_FIRST_RESERVED )
>> +    {
>> +        if ( smp_processor_id() >= dom0->max_vcpus )
>> +            return 0;
>> +        v = dom0->vcpu[smp_processor_id()];
>> +    }
> Ugly new uses of "dom0". And the correlation between
> smp_processor_id() and dom0->max_vcpus doesn't look sane
> either.

Yes, this needs to be fixed. Maybe

     v = dom0->vcpu[smp_processor_id() % dom0->max_vcpus];

And drop the check. (And the same change in pmu_softnmi() in a later patch).

Not sure what to do about dom0. What else can I use instead? I need to 
choose dom0's vcpu.


Thanks.
-boris

  reply	other threads:[~2014-01-16 14:58 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 19:24 [PATCH v3 00/16] x86/PMU: Xen PMU PV support Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 01/16] common/symbols: Export hypervisor symbols to PV guest Boris Ostrovsky
2014-01-10 17:01   ` Jan Beulich
2014-01-13 15:00     ` Boris Ostrovsky
2014-01-13 15:07       ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 02/16] x86/VPMU: Stop AMD counters when called from vpmu_save_force() Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 03/16] x86/VPMU: Minor VPMU cleanup Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 04/16] intel/VPMU: Clean up Intel VPMU code Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 05/16] x86/VPMU: Handle APIC_LVTPC accesses Boris Ostrovsky
2014-01-13 13:28   ` Jan Beulich
2014-01-13 15:04     ` Boris Ostrovsky
2014-01-13 15:08       ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 06/16] intel/VPMU: MSR_CORE_PERF_GLOBAL_CTRL should be initialized to zero Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 07/16] x86/VPMU: Add public xenpmu.h Boris Ostrovsky
2014-01-13 13:39   ` Jan Beulich
2014-01-13 15:23     ` Boris Ostrovsky
2014-01-13 15:38       ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 08/16] x86/VPMU: Make vpmu not HVM-specific Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 09/16] x86/VPMU: Interface for setting PMU mode and flags Boris Ostrovsky
2014-01-13 14:02   ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 10/16] x86/VPMU: Initialize PMU for PV guests Boris Ostrovsky
2014-01-13 14:04   ` Jan Beulich
2014-01-13 15:25     ` Boris Ostrovsky
2014-01-13 14:05   ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 11/16] x86/VPMU: Add support for PMU register handling on " Boris Ostrovsky
2014-01-13 14:12   ` Jan Beulich
2014-01-13 15:44     ` Boris Ostrovsky
2014-01-13 15:58       ` Jan Beulich
2014-01-13 16:20         ` Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 12/16] x86/VPMU: Handle PMU interrupts for " Boris Ostrovsky
2014-01-16  9:15   ` Jan Beulich
2014-01-16 14:58     ` Boris Ostrovsky [this message]
2014-01-16 15:48       ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 13/16] x86/VPMU: Add privileged PMU mode Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 14/16] x86/VPMU: Save VPMU state for PV guests during context switch Boris Ostrovsky
2014-01-16  9:27   ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 15/16] x86/VPMU: NMI-based VPMU support Boris Ostrovsky
2014-01-16  9:35   ` Jan Beulich
2014-01-16 15:13     ` Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 16/16] x86/VPMU: Move VPMU files up from hvm/ directory Boris Ostrovsky

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=52D7F391.60500@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dietmar.hahn@ts.fujitsu.com \
    --cc=eddie.dong@intel.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xenproject.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.