Re: [Xen-devel] [RFC PATCH] x86/apicv: fix RTC periodic timer and apicv issue

2016-08-29 Thread Tian, Kevin
> From: Xuquan (Euler) [mailto:xuqu...@huawei.com]
> Sent: Friday, August 19, 2016 8:59 PM
> 
> When Xen apicv is enabled, wall clock time is faster on Windows7-32 guest
> with high payload (with 2vCPU, captured from xentrace, in high payload, the
> count of IPI interrupt increases rapidly between these vCPUs).
> 
> If IPI intrrupt (vector 0xe1) and periodic timer interrupt (vector 0xd1)
> are both pending (index of bit set in VIRR), unfortunately, the IPI intrrupt
> is high priority than periodic timer interrupt. Xen updates IPI interrupt bit
> set in VIRR to guest interrupt status (RVI) as a high priority and apicv
> (Virtual-Interrupt Delivery) delivers IPI interrupt within VMX non-root
> operation without a VM exit. Within VMX non-root operation, if periodic timer
> interrupt index of bit is set in VIRR and highest, the apicv delivers periodic
> timer interrupt within VMX non-root operation as well.
> 
> But in current code, if Xen doesn't update periodic timer interrupt bit set
> in VIRR to guest interrupt status (RVI) directly, Xen is not aware of this
> case to decrease the count (pending_intr_nr) of pending periodic timer 
> interrupt,
> then Xen will deliver a periodic timer interrupt again. The guest receives 
> more
> periodic timer interrupt.
> 
> If the periodic timer interrut is delivered and not the highest priority, make
> Xen be aware of this case to decrease the count of pending periodic timer
> interrupt.
> 
> Signed-off-by: Yifei Jiang 
> Signed-off-by: Rongguang He 
> Signed-off-by: Quan Xu 
> ---
> Why RFC:
> 1. I am not quite sure for other cases, such as nested case.
> 2. Within VMX non-root operation, an Asynchronous Enclave Exit (including 
> external
>interrupts, non-maskable interrupt system-management interrrupts, 
> exceptions
>and VM exit) may occur before delivery of a periodic timer interrupt, the 
> periodic
>timer interrupt may be lost when a coming periodic timer interrupt is 
> delivered.
>Actually, and so current code is.
> ---
>  xen/arch/x86/hvm/vmx/intr.c | 16 +++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
> index 8fca08c..d3a034e 100644
> --- a/xen/arch/x86/hvm/vmx/intr.c
> +++ b/xen/arch/x86/hvm/vmx/intr.c
> @@ -334,7 +334,21 @@ void vmx_intr_assist(void)
>  __vmwrite(EOI_EXIT_BITMAP(i), 
> v->arch.hvm_vmx.eoi_exit_bitmap[i]);
>  }
> 
> -pt_intr_post(v, intack);
> +   /*
> +* If the periodic timer interrut is delivered and not the highest 
> priority,
> +* make Xen be aware of this case to decrease the count of pending 
> periodic
> +* timer interrupt.
> +*/
> +if ( pt_vector != -1 && intack.vector > pt_vector )
> +{
> +struct hvm_intack pt_intack;
> +
> +pt_intack.vector = pt_vector;
> +pt_intack.source = hvm_intsrc_lapic;
> +pt_intr_post(v, pt_intack);
> +}
> +else
> +pt_intr_post(v, intack);
>  }

Here is my thought. w/o above patch one pending pt interrupt may 
result in multiple injections of guest timer interrupt, as you identified, 
when pt_vector happens to be not the highest pending vector. Then
w/ your patch, multiple pending pt interrupt instances may be combined
as one injection of guest timer interrupt. Especially intack.vector
>pt_vector doesn't mean pt_intr is eligible for injection, which might
be blocked due to other reasons. As Jan pointed out, this path is very 
fragile, so better we can have a fix to sustain the original behavior
with one pending pt instance causing one actual injection.

What about doing pt_intr_post in EOI-induced VM-exit instead? EOI exit
bit for pt_intr is already set to 1 which means every injection would incur
an EOI-induced VM-exit:

   /*
* Set eoi_exit_bitmap for periodic timer interrup to cause EOI-induced 
VM
* exit, then pending periodic time interrups have the chance to be 
injected
* for compensation
*/
if (pt_vector != -1)
vmx_set_eoi_exit_bitmap(v, pt_vector);

I don't think delaying post makes much difference here. Even we do
post earlier like your patch, further pending instances have to wait
until current instance is completed. So as long as post happens before
EOI is completed, it should be fine.

Thanks
Kevin

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


Re: [Xen-devel] Questions about Using Perf at Dom0

2016-08-29 Thread Sanghyun Hong
Yes, this will allow the hypervisor to collect samples from multiple
guests. However, the tool (perf) probably won't be able to properly
process these samples. But you can try.

I understand, thus, I applied the patches and set the pmu_mode to all. However, 
I’m really curious what you mean by the tool (perf) probably won’t be able to 
properly process these samples. Is there any things I have to have in mind 
while collecting the counters, or will it have incorrect values of the counters?

You will want to run dom0 on all physical processors (i.e. no
dom0_max_vcpus boot option) and pin all VCPUs for both dom0 and the guest.

Sure, thanks! My machine has four physical cores, and I’ve set the 
dom0_max_vcpus=4. I think it will have the same effect in removing the 
dom0_max_vcpus option.

Best,
Sanghyun.


On Aug 29, 2016, at 4:59 PM, Boris Ostrovsky 
> wrote:

On 08/29/2016 02:42 PM, Sanghyun Hong wrote:
Hi Boris,

I’ve found the
documentations(https://github.com/torvalds/linux/blob/master/Documentation/ABI/testing/sysfs-hypervisor-pmu)
in the kernel source code, and it seems like if we change the mode
from *self* to *all* then we can collect counters for all the domains,
right?

Yes, this will allow the hypervisor to collect samples from multiple
guests. However, the tool (perf) probably won't be able to properly
process these samples. But you can try.

You will want to run dom0 on all physical processors (i.e. no
dom0_max_vcpus boot option) and pin all VCPUs for both dom0 and the guest.


-boris


All the best,
Sanghyun.


On Aug 29, 2016, at 12:36 PM, Boris Ostrovsky
 
> wrote:

On 08/29/2016 09:18 AM, Sanghyun Hong wrote:
Dear Xen-Devel Community:

I’m a grad student working on measuring performance counters at the
Xen domains. I read this
thread(https://wiki.xenproject.org/wiki/Xen_Profiling:_oprofile_and_perf)
in
web, and it says using Linux perf command will let us collecting
performance counters in both dom0 and domU. Does it mean that we can
collect both of them at once if we run perf command on the dom0? (If
not, does it mean we can collect counters for each domain separately
once we run the perf command in each domain?

Profiling both guest and dom0 (and the hypervisor) requires changes to
perf and those are not there yet.

But you can run perf in each guest (including dom0) separately. Make
sure you have vpmu=true boot option.

-boris









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


Re: [Xen-devel] Questions about Using Perf at Dom0

2016-08-29 Thread Sanghyun Hong
Hi Boris,

[Appreciate for your support, and I have one last question]

Since we’re using the Xen hypervisor (not the KVM that is type-II), I think we 
cannot use the perf kvm command. Here are the outputs:


# perf kvm --host --guest record -C 1 sleep 1
[ perf record: Woken up 1 times to write data ]
Warning:
1 unprocessable samples recorded.
Do you have a KVM guest running and not using 'perf kvm'?
[ perf record: Captured and wrote 0.242 MB perf.data.kvm ]

# perf kvm --guest --host report --stdio
Warning:
1 unprocessable samples recorded.
Do you have a KVM guest running and not using 'perf kvm'?
Error:
The perf.data.kvm file has no samples!
# To display the perf.data header info, please use --header/--header-only 
options.
#


In addition, we used perf to collect hardware performance counters, not the 
symbols, kernel functions, or other stuffs. Thus, what we really need is that 
we need to separate the hardware counters by each domain if it’s possible (i.e. 
we want to verify some counters are from Dom0, other counters are from Dom1, 
and the others come from Dom2, etc.)

I’m pretty much sure that the code you used to distinguish each domain from 
samples will work. I wonder if you can agree with that.

Best,
Sanghyun.


On Aug 29, 2016, at 6:37 PM, Boris Ostrovsky 
> wrote:

On 08/29/2016 05:48 PM, Sanghyun Hong wrote:
I really appreciate for your answers. Last but not the least, I want to make it 
more clear:

The hypervisor will provide dom0 with a raw sample (guest's, dom0's or
hypervisor's) and then it's the job of dom0 kernel to properly tag and
format it and make it available to the userland (i.e. perf itself).
Does this mean if I run the perf command on Dom0 while other domains are 
running, we can collect the performance counter values without distinguishing 
each domain, right?

With 'self' mode each domain collects samples only for itself.

And for 'all' mode apparently this kind of works. With perf build from
Linux 4.7 tree:

root@haswell> xl vcpu-list
NameID  VCPU   CPU State   Time(s)
Affinity (Hard / Soft)
Domain-0 0 00   -b-  55.0  0 / all
Domain-0 0 11   r--  35.9  1 / all
Domain-0 0 22   -b-  36.9  2 / all
Domain-0 0 33   -b-  36.2  3 / all
fedora   1 01   -b- 183.7  1 / all
root@haswell> ./perf kvm --guest --host --guestkallsyms=/tmp/kallsyms
record -C 1 sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.139 MB perf.data.kvm (60 samples) ]
root@haswell> ./perf kvm --guest --host --guestkallsyms=/tmp/kallsyms
report --stdio
...
# Overhead  Command  Shared Object
Symbol
#   ...  ...
.
#
   14.48%  swapper  [unknown][k] 0x82d0801c7a37
6.06%  swapper  [kernel.kallsyms][k]
update_blocked_averages
4.38%  swapper  [unknown][k] 0x82d08013690f
2.75%  swapper  [kernel.kallsyms][k] update_rq_clock
2.34%  swapper  [kernel.kallsyms][k] irq_enter
2.33%  [guest/0][guest.kernel.kallsyms]  [g]
fb_pad_aligned_buffer
2.24%  1.hda-0  [kernel.kallsyms][k]
_raw_spin_unlock_irqrestore
2.11%  [guest/0][guest.kernel.kallsyms]  [g] native_safe_halt
2.05%  [guest/0][guest.kernel.kallsyms]  [g]
update_blocked_averages
...

"unknown" samples are from hypervisor.



The tool will then look at the tag and display the event as belonging to
host (dom0, really) or guest. This is supported for KVM, with 'perf kvm'
commands.

So if you can run perf kvm commands then you may be able to
differentiate dom0's and guest's samples (you will also see hypervisor
samples but they won't get resolved to symbols). I am just not sure per
kvm will run on a non-KVM host. I had a private copy where it did but
this was based on a fairly old version of Linux.

(Also, stack profiling is not supported at all).

I wonder if you can share the private copy of your code. I’m looking into the 
source code of the patches, and it seems there’s a way to do it. Even if your 
codes are outdated, I think I can manage to port it. I will promise once I 
finish the porting, I will share my adjustment of your code as well.

Looks like you may not need it.

-boris


Best,
Sanghyun.


On Aug 29, 2016, at 5:24 PM, Boris Ostrovsky 
> wrote:

On 08/29/2016 05:08 PM, Sanghyun Hong wrote:
Yes, this will allow the hypervisor to collect samples from multiple
guests. However, the tool (perf) probably won't be able to properly
process these samples. But you can try.
I understand, thus, I applied 

Re: [Xen-devel] Questions about Using Perf at Dom0

2016-08-29 Thread Sanghyun Hong
I really appreciate for your answers. Last but not the least, I want to make it 
more clear:

> The hypervisor will provide dom0 with a raw sample (guest's, dom0's or
> hypervisor's) and then it's the job of dom0 kernel to properly tag and
> format it and make it available to the userland (i.e. perf itself).

Does this mean if I run the perf command on Dom0 while other domains are 
running, we can collect the performance counter values without distinguishing 
each domain, right?

> The tool will then look at the tag and display the event as belonging to
> host (dom0, really) or guest. This is supported for KVM, with 'perf kvm'
> commands.
> 
> So if you can run perf kvm commands then you may be able to
> differentiate dom0's and guest's samples (you will also see hypervisor
> samples but they won't get resolved to symbols). I am just not sure per
> kvm will run on a non-KVM host. I had a private copy where it did but
> this was based on a fairly old version of Linux.
> 
> (Also, stack profiling is not supported at all).


I wonder if you can share the private copy of your code. I’m looking into the 
source code of the patches, and it seems there’s a way to do it. Even if your 
codes are outdated, I think I can manage to port it. I will promise once I 
finish the porting, I will share my adjustment of your code as well.

Best,
Sanghyun.


> On Aug 29, 2016, at 5:24 PM, Boris Ostrovsky  
> wrote:
> 
> On 08/29/2016 05:08 PM, Sanghyun Hong wrote:
>>> Yes, this will allow the hypervisor to collect samples from multiple
>>> guests. However, the tool (perf) probably won't be able to properly
>>> process these samples. But you can try.
>> 
>> I understand, thus, I applied the patches and set
>> the /pmu_mode/ to *all*. However, I’m really curious what you mean by
>> the tool (*perf*) probably won’t be able to properly process these
>> samples. Is there any things I have to have in mind while collecting
>> the counters, or will it have incorrect values of the counters?
> 
> The hypervisor will provide dom0 with a raw sample (guest's, dom0's or
> hypervisor's) and then it's the job of dom0 kernel to properly tag and
> format it and make it available to the userland (i.e. perf itself). The
> tool will then look at the tag and display the event as belonging to
> host (dom0, really) or guest. This is supported for KVM, with 'perf kvm'
> commands.
> 
> So if you can run perf kvm commands then you may be able to
> differentiate dom0's and guest's samples (you will also see hypervisor
> samples but they won't get resolved to symbols). I am just not sure per
> kvm will run on a non-KVM host. I had a private copy where it did but
> this was based on a fairly old version of Linux.
> 
> (Also, stack profiling is not supported at all).
> 
>> 
>>> You will want to run dom0 on all physical processors (i.e. no
>>> dom0_max_vcpus boot option) and pin all VCPUs for both dom0 and the
>>> guest.
>> 
>> Sure, thanks! My machine has four physical cores, and I’ve set
>> the /dom0_max_vcpus=4/. I think it will have the same effect in
>> removing the /dom0_max_vcpus/ option.
> 
> Yes.
> 
> -boris
> 
>> 
>> Best,
>> Sanghyun.
>> 
>> 
>>> On Aug 29, 2016, at 4:59 PM, Boris Ostrovsky
>>> > wrote:
>>> 
>>> On 08/29/2016 02:42 PM, Sanghyun Hong wrote:
 Hi Boris,
 
 I’ve found the
 documentations(https://github.com/torvalds/linux/blob/master/Documentation/ABI/testing/sysfs-hypervisor-pmu)
 in the kernel source code, and it seems like if we change the mode
 from *self* to *all* then we can collect counters for all the domains,
 right?
>>> 
>>> Yes, this will allow the hypervisor to collect samples from multiple
>>> guests. However, the tool (perf) probably won't be able to properly
>>> process these samples. But you can try.
>>> 
>>> You will want to run dom0 on all physical processors (i.e. no
>>> dom0_max_vcpus boot option) and pin all VCPUs for both dom0 and the
>>> guest.
>>> 
>>> 
>>> -boris
>>> 
 
 All the best,
 Sanghyun.
 
 
> On Aug 29, 2016, at 12:36 PM, Boris Ostrovsky
> 
> > wrote:
> 
> On 08/29/2016 09:18 AM, Sanghyun Hong wrote:
>> Dear Xen-Devel Community:
>> 
>> I’m a grad student working on measuring performance counters at the
>> Xen domains. I read this
>> thread(https://wiki.xenproject.org/wiki/Xen_Profiling:_oprofile_and_perf)
>> in
>> web, and it says using Linux perf command will let us collecting
>> performance counters in both dom0 and domU. Does it mean that we can
>> collect both of them at once if we run perf command on the dom0? (If
>> not, does it mean we can collect counters for each domain separately
>> once we run the perf command in each domain?
> 
> Profiling both guest and dom0 (and the hypervisor) 

Re: [Xen-devel] Questions about Using Perf at Dom0

2016-08-29 Thread Sanghyun Hong
Hi Boris,

I’ve found the 
documentations(https://github.com/torvalds/linux/blob/master/Documentation/ABI/testing/sysfs-hypervisor-pmu)
 in the kernel source code, and it seems like if we change the mode from self 
to all then we can collect counters for all the domains, right?

All the best,
Sanghyun.


On Aug 29, 2016, at 12:36 PM, Boris Ostrovsky 
> wrote:

On 08/29/2016 09:18 AM, Sanghyun Hong wrote:
Dear Xen-Devel Community:

I’m a grad student working on measuring performance counters at the
Xen domains. I read this
thread(https://wiki.xenproject.org/wiki/Xen_Profiling:_oprofile_and_perf) in
web, and it says using Linux perf command will let us collecting
performance counters in both dom0 and domU. Does it mean that we can
collect both of them at once if we run perf command on the dom0? (If
not, does it mean we can collect counters for each domain separately
once we run the perf command in each domain?

Profiling both guest and dom0 (and the hypervisor) requires changes to
perf and those are not there yet.

But you can run perf in each guest (including dom0) separately. Make
sure you have vpmu=true boot option.

-boris






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


[Xen-devel] [ovmf test] 100656: all pass - PUSHED

2016-08-29 Thread osstest service owner
flight 100656 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/100656/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf e53f1e253e01026029f5ce7474a9d8421c8a0fbb
baseline version:
 ovmf 37136e069dc0a0b8a47098d80d8f6f742db88c04

Last test of basis   100653  2016-08-29 07:45:04 Z0 days
Testing same since   100656  2016-08-30 01:45:45 Z0 days1 attempts


People who touched revisions under test:
  Giri P Mudusuru 
  Jiewen Yao 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

+ branch=ovmf
+ revision=e53f1e253e01026029f5ce7474a9d8421c8a0fbb
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x '!=' x/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock
++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push ovmf 
e53f1e253e01026029f5ce7474a9d8421c8a0fbb
+ branch=ovmf
+ revision=e53f1e253e01026029f5ce7474a9d8421c8a0fbb
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']'
+ . ./cri-common
++ . ./cri-getconfig
++ umask 002
+ select_xenbranch
+ case "$branch" in
+ tree=ovmf
+ xenbranch=xen-unstable
+ '[' xovmf = xlinux ']'
+ linuxbranch=
+ '[' x = x ']'
+ qemuubranch=qemu-upstream-unstable
+ select_prevxenbranch
++ ./cri-getprevxenbranch xen-unstable
+ prevxenbranch=xen-4.7-testing
+ '[' xe53f1e253e01026029f5ce7474a9d8421c8a0fbb = x ']'
+ : tested/2.6.39.x
+ . ./ap-common
++ : osst...@xenbits.xen.org
+++ getconfig OsstestUpstream
+++ perl -e '
use Osstest;
readglobalconfig();
print $c{"OsstestUpstream"} or die $!;
'
++ :
++ : git://xenbits.xen.org/xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/xen.git
++ : git://xenbits.xen.org/qemu-xen-traditional.git
++ : git://git.kernel.org
++ : git://git.kernel.org/pub/scm/linux/kernel/git
++ : git
++ : git://xenbits.xen.org/libvirt.git
++ : osst...@xenbits.xen.org:/home/xen/git/libvirt.git
++ : git://xenbits.xen.org/libvirt.git
++ : git://xenbits.xen.org/rumpuser-xen.git
++ : git
++ : git://xenbits.xen.org/rumpuser-xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/rumpuser-xen.git
+++ besteffort_repo https://github.com/rumpkernel/rumpkernel-netbsd-src
+++ local repo=https://github.com/rumpkernel/rumpkernel-netbsd-src
+++ cached_repo https://github.com/rumpkernel/rumpkernel-netbsd-src 
'[fetch=try]'
+++ local repo=https://github.com/rumpkernel/rumpkernel-netbsd-src
+++ local 'options=[fetch=try]'
 getconfig GitCacheProxy
 perl -e '
use Osstest;
readglobalconfig();
print $c{"GitCacheProxy"} or die $!;
'
+++ local cache=git://cache:9419/
+++ '[' xgit://cache:9419/ '!=' x ']'
+++ echo 

Re: [Xen-devel] [PATCH v4 07/16] libxl/arm: Construct ACPI GTDT table

2016-08-29 Thread Shannon Zhao


On 2016/8/30 2:16, Julien Grall wrote:
> On 16/08/2016 06:25, Shannon Zhao wrote:
>> From: Shannon Zhao 
>>
>> Construct GTDT table with the interrupt information of timers.
>>
>> Signed-off-by: Shannon Zhao 
>> ---
>>  tools/libxl/libxl_arm_acpi.c | 29 +
>>  1 file changed, 29 insertions(+)
>>
>> diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
>> index 8cd1d9b..28fb6fe 100644
>> --- a/tools/libxl/libxl_arm_acpi.c
>> +++ b/tools/libxl/libxl_arm_acpi.c
>> @@ -24,10 +24,18 @@ typedef uint8_t u8;
>>  typedef uint16_t u16;
>>  typedef uint32_t u32;
>>  typedef uint64_t u64;
>> +typedef int64_t s64;
>>
>>  #include 
>>  #include 
>>
>> +#include 
>> +#define ACPI_MACHINE_WIDTH __BITS_PER_LONG
>> +#define COMPILER_DEPENDENT_INT64 int64_t
>> +#define COMPILER_DEPENDENT_UINT64 uint64_t
>> +
>> +#include 
>> +
>>  _hidden
>>  extern const unsigned char dsdt_anycpu_arm[];
>>  _hidden
>> @@ -175,6 +183,26 @@ static void make_acpi_xsdt(libxl__gc *gc, struct
>> xc_dom_image *dom,
>> acpitables[XSDT].size);
>>  }
>>
>> +static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom,
>> +   struct acpitable acpitables[])
>> +{
>> +uint64_t offset = acpitables[GTDT].addr - GUEST_ACPI_BASE;
>> +struct acpi_table_gtdt *gtdt = (void *)dom->acpi_modules[0].data
>> + offset;
>> +
>> +gtdt->non_secure_el1_interrupt = GUEST_TIMER_PHYS_NS_PPI;
>> +gtdt->non_secure_el1_flags =
>> + (ACPI_LEVEL_SENSITIVE <<
>> ACPI_GTDT_INTERRUPT_MODE)
>> + |(ACPI_ACTIVE_LOW <<
>> ACPI_GTDT_INTERRUPT_POLARITY);
>> +gtdt->virtual_timer_interrupt = GUEST_TIMER_VIRT_PPI;
>> +gtdt->virtual_timer_flags =
>> + (ACPI_LEVEL_SENSITIVE <<
>> ACPI_GTDT_INTERRUPT_MODE)
>> + |(ACPI_ACTIVE_LOW <<
>> ACPI_GTDT_INTERRUPT_POLARITY);
>> +
> 
> I don't see any setting for the field counter_block_address. From the
> ACPI spec, the field should be 0x when the counter
> control block is not available
Oops, will add. Thanks.

-- 
Shannon


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


Re: [Xen-devel] [PATCH v4 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI

2016-08-29 Thread Shannon Zhao


On 2016/8/30 3:00, Julien Grall wrote:
> Hi Shannon,
> 
> On 16/08/2016 06:25, Shannon Zhao wrote:
>> From: Shannon Zhao 
>>
>> Add macros for HVM_PARAM_CALLBACK_TYPE_PPI operation values and update
>> them in evtchn_fixup().
>>
>> Signed-off-by: Shannon Zhao 
>> ---
>>  xen/arch/arm/domain_build.c | 8 +---
>>  xen/include/public/hvm/params.h | 4 
>>  2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> index 60db9e4..94cd3ce 100644
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c
>> @@ -2019,9 +2019,11 @@ static void evtchn_fixup(struct domain *d,
>> struct kernel_info *kinfo)
>> d->arch.evtchn_irq);
>>
>>  /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ */
>> -val = (u64)HVM_PARAM_CALLBACK_TYPE_PPI << 56;
>> -val |= (2 << 8); /* Active-low level-sensitive  */
>> -val |= d->arch.evtchn_irq & 0xff;
>> +val = (u64)HVM_PARAM_CALLBACK_TYPE_PPI <<
>> HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT;
>> +/* Active-low level-sensitive  */
>> +val |= (HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL <<
>> +HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT);
>> +val |= d->arch.evtchn_irq & HVM_PARAM_CALLBACK_TYPE_PPI_MASK;
> 
> The mask is pointless and a call to make things much worse if evtchn_irq
> is not a PPI (which will never happen).
> 
>>  d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ] = val;
>>
>>  /*
>> diff --git a/xen/include/public/hvm/params.h
>> b/xen/include/public/hvm/params.h
>> index f7338a3..8a0327d 100644
>> --- a/xen/include/public/hvm/params.h
>> +++ b/xen/include/public/hvm/params.h
>> @@ -30,6 +30,7 @@
>>   */
>>
>>  #define HVM_PARAM_CALLBACK_IRQ 0
>> +#define HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT 56
>>  /*
>>   * How should CPU0 event-channel notifications be delivered?
>>   *
>> @@ -66,6 +67,9 @@
>>   * This is only used by ARM/ARM64 and masking/eoi the interrupt
>> associated to
>>   * the notification is handled by the interrupt controller.
>>   */
>> +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT 8
>> +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL 2
>> +#define HVM_PARAM_CALLBACK_TYPE_PPI_MASK   0xff
> 
> Please drop the PPI_MASK, it is not correctly defined (there is only 16
> PPI going from 16 - 32) and pointless.
> 
Sure. Thanks.

-- 
Shannon


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


Re: [Xen-devel] [PATCH v4 16/16] libxl/arm: Add the size of ACPI tables to maxmem

2016-08-29 Thread Shannon Zhao


On 2016/8/30 3:07, Julien Grall wrote:
> Hi Shannon,
> 
> On 16/08/2016 06:25, Shannon Zhao wrote:
>> From: Shannon Zhao 
>>
>> While it defines the maximum size of guest ACPI tables in guest
>> memory layout, here it adds the size to set the target maxmem
>> to avoid providing less available memory for guest.
>>
>> Signed-off-by: Shannon Zhao 
>> ---
>>  tools/libxl/libxl_arm.c | 11 +++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
>> index d436167..75b2589 100644
>> --- a/tools/libxl/libxl_arm.c
>> +++ b/tools/libxl/libxl_arm.c
>> @@ -103,6 +103,17 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
>>  int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config
>> *d_config,
>>uint32_t domid)
>>  {
>> +libxl_domain_build_info *const info = _config->b_info;
>> +libxl_ctx *ctx = libxl__gc_owner(gc);
>> +
>> +/* Add the size of ACPI tables to maxmem if ACPI is enabled for
>> guest. */
>> +if (libxl_defbool_val(info->acpi) &&
>> +xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
>> +LIBXL_MAXMEM_CONSTANT + GUEST_ACPI_SIZE / 1024) < 0) {
> 
> Why can't we use the estimate size here? It would be better than
> increasing by a constant again the max size (I doubt the ACPI tables
> will be 2MB every time).
> 
The estimate action happens after libxl__arch_domain_create(), I think.
So it can't get the estimate size here.

Also, it's better to add the max size so that it doesn't have to change
here when it adds other contents to the ACPI tables.

Thanks,
-- 
Shannon


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


Re: [Xen-devel] [PATCH v4 05/16] libxl/arm: Construct ACPI RSDP table

2016-08-29 Thread Shannon Zhao


On 2016/8/30 2:05, Julien Grall wrote:
> Hi Shannon,
> 
> On 25/08/2016 04:05, Shannon Zhao wrote:
>>
>>
>> On 2016/8/24 20:52, Wei Liu wrote:
>>> On Tue, Aug 16, 2016 at 06:25:02PM +0800, Shannon Zhao wrote:
> From: Shannon Zhao 
>
> Construct ACPI RSDP table and add a helper to calculate the ACPI table
> checksum.
>
> Signed-off-by: Shannon Zhao 
> ---
>  tools/libxl/libxl_arm_acpi.c | 38
> ++
>  1 file changed, 38 insertions(+)
>
> diff --git a/tools/libxl/libxl_arm_acpi.c
> b/tools/libxl/libxl_arm_acpi.c
> index 6be9eb0..9432e44 100644
> --- a/tools/libxl/libxl_arm_acpi.c
> +++ b/tools/libxl/libxl_arm_acpi.c
> @@ -33,6 +33,9 @@ extern const unsigned char dsdt_anycpu_arm[];
>  _hidden
>  extern const int dsdt_anycpu_arm_len;
>
> +#define ACPI_BUILD_APPNAME6 "XenARM"
> +#define ACPI_BUILD_APPNAME4 "Xen "
> +
>>> Where do these come from? If they are from a spec, could you please add
>>> a comment here?
>>>
>> Not from some spec. Just fake a OEM for these tables like the
>> ACPI_OEM_ID, ACPI_CREATOR_ID used by x86.
> 
> In this case, why don't we re-use the one from x86?
> 
While the ACPI_OEM_TABLE_ID and ACPI_CREATOR_ID of x86 are HVM specific,
I don't think it's proper for ARM.

Thanks,
-- 
Shannon


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


Re: [Xen-devel] [PATCH v4 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI

2016-08-29 Thread Julien Grall

Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

Add macros for HVM_PARAM_CALLBACK_TYPE_PPI operation values and update
them in evtchn_fixup().

Signed-off-by: Shannon Zhao 
---
 xen/arch/arm/domain_build.c | 8 +---
 xen/include/public/hvm/params.h | 4 
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 60db9e4..94cd3ce 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2019,9 +2019,11 @@ static void evtchn_fixup(struct domain *d, struct 
kernel_info *kinfo)
d->arch.evtchn_irq);

 /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ */
-val = (u64)HVM_PARAM_CALLBACK_TYPE_PPI << 56;
-val |= (2 << 8); /* Active-low level-sensitive  */
-val |= d->arch.evtchn_irq & 0xff;
+val = (u64)HVM_PARAM_CALLBACK_TYPE_PPI << 
HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT;
+/* Active-low level-sensitive  */
+val |= (HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL <<
+HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT);
+val |= d->arch.evtchn_irq & HVM_PARAM_CALLBACK_TYPE_PPI_MASK;


The mask is pointless and a call to make things much worse if evtchn_irq 
is not a PPI (which will never happen).



 d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ] = val;

 /*
diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h
index f7338a3..8a0327d 100644
--- a/xen/include/public/hvm/params.h
+++ b/xen/include/public/hvm/params.h
@@ -30,6 +30,7 @@
  */

 #define HVM_PARAM_CALLBACK_IRQ 0
+#define HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT 56
 /*
  * How should CPU0 event-channel notifications be delivered?
  *
@@ -66,6 +67,9 @@
  * This is only used by ARM/ARM64 and masking/eoi the interrupt associated to
  * the notification is handled by the interrupt controller.
  */
+#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT 8
+#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL 2
+#define HVM_PARAM_CALLBACK_TYPE_PPI_MASK   0xff


Please drop the PPI_MASK, it is not correctly defined (there is only 16 
PPI going from 16 - 32) and pointless.



 #endif

 /*



Regards,

--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 12/16] libxl/arm: Factor finalise_one_memory_node as a gerneric function

2016-08-29 Thread Julien Grall

Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

Rename finalise_one_memory_node to finalise_one_node and pass the node
name via function parameter.

This is useful for adding ACPI module which will be added by a later
patch.

Signed-off-by: Shannon Zhao 


Acked-by: Julien Grall 

Regards,


---
 tools/libxl/libxl_arm.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index fa0497c..b95fdf5 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -904,11 +904,11 @@ out:
 return rc;
 }

-static void finalise_one_memory_node(libxl__gc *gc, void *fdt,
- uint64_t base, uint64_t size)
+static void finalise_one_node(libxl__gc *gc, void *fdt, const char *uname,
+  uint64_t base, uint64_t size)
 {
 int node, res;
-const char *name = GCSPRINTF("/memory@%"PRIx64, base);
+const char *name = GCSPRINTF("%s@%"PRIx64, uname, base);

 node = fdt_path_offset(fdt, name);
 assert(node > 0);
@@ -971,7 +971,7 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc 
*gc,
 for (i = 0; i < GUEST_RAM_BANKS; i++) {
 const uint64_t size = (uint64_t)dom->rambank_size[i] << XC_PAGE_SHIFT;

-finalise_one_memory_node(gc, fdt, bankbase[i], size);
+finalise_one_node(gc, fdt, "/memory", bankbase[i], size);
 }

 debug_dump_fdt(gc, fdt);



--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 09/16] libxl/arm: Construct ACPI MADT table

2016-08-29 Thread Julien Grall



On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

According to the GIC version, construct the MADT table.

Signed-off-by: Shannon Zhao 
---
 tools/libxl/libxl_arm_acpi.c | 84 
 1 file changed, 84 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 28fb6fe..75dfcc2 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -203,6 +203,89 @@ static void make_acpi_gtdt(libxl__gc *gc, struct 
xc_dom_image *dom,
acpitables[GTDT].size);
 }

+static void make_acpi_madt_gicc(void *table, int nr_cpus, uint64_t gicc_base)
+{
+uint32_t i;


Please don't mix the type. Either i should be int or nr_cpus uint32_t.


+struct acpi_madt_generic_interrupt *gicc = table;
+
+for (i = 0; i < nr_cpus; i++) {
+gicc->header.type = ACPI_MADT_TYPE_GENERIC_INTERRUPT;
+gicc->header.length = sizeof(*gicc);
+gicc->base_address = gicc_base;
+gicc->cpu_interface_number = i;
+gicc->arm_mpidr = libxl__compute_mpdir(i);
+gicc->uid = i;
+gicc->flags = ACPI_MADT_ENABLED;
+gicc++;
+}
+}


Regards,

--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 16/16] libxl/arm: Add the size of ACPI tables to maxmem

2016-08-29 Thread Julien Grall

Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

While it defines the maximum size of guest ACPI tables in guest
memory layout, here it adds the size to set the target maxmem
to avoid providing less available memory for guest.

Signed-off-by: Shannon Zhao 
---
 tools/libxl/libxl_arm.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index d436167..75b2589 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -103,6 +103,17 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
 int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
   uint32_t domid)
 {
+libxl_domain_build_info *const info = _config->b_info;
+libxl_ctx *ctx = libxl__gc_owner(gc);
+
+/* Add the size of ACPI tables to maxmem if ACPI is enabled for guest. */
+if (libxl_defbool_val(info->acpi) &&
+xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
+LIBXL_MAXMEM_CONSTANT + GUEST_ACPI_SIZE / 1024) < 0) {


Why can't we use the estimate size here? It would be better than 
increasing by a constant again the max size (I doubt the ACPI tables 
will be 2MB every time).


Also, this looks like quite unsafe. If someone decides to change the 
default size, (s)he would have to replicate the new algo here.


Wei, Ian, do you have any suggestion to avoid duplication?


+LOGE(ERROR, "Couldn't set max memory");
+return ERROR_FAIL;
+}
+
 return 0;
 }




Regards,

--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 00/16] Xen ARM DomU ACPI support

2016-08-29 Thread Julien Grall

Hi Wei,

On 24/08/2016 08:58, Wei Liu wrote:

On Tue, Aug 16, 2016 at 06:24:57PM +0800, Shannon Zhao wrote:

From: Shannon Zhao 

The design of this feature is described as below.
Firstly, the toolstack (libxl) generates the ACPI tables according the
number of vcpus and gic controller.

Then, it copies these ACPI tables to DomU non-RAM memory map space and
passes them to UEFI firmware through the "ARM multiboot" protocol.

At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
and installs these tables like the usual way and passes both ACPI and DT
information to the Xen DomU.

Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT tables
since it's enough now.

This has been tested using guest kernel with the Dom0 ACPI support
patches which could be fetched from linux master or:
https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen

The UEFI binary could be fetched from or built from edk2 master branch:
http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd

This series can be fetched from:
https://git.linaro.org/people/shannon.zhao/xen.git  domu_acpi_v4



Thanks for posting this version and sorry for the late review.

I've skimmed the whole series and pointed out things I think should be
improved. I will leave reviewing all the table building code to ARM
maintainers.


I looked at the tables, they look good to me. Although, I made few 
comments on various place.


Cheers,

--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 05/16] libxl/arm: Construct ACPI RSDP table

2016-08-29 Thread Julien Grall

Hi Shannon,

On 25/08/2016 04:05, Shannon Zhao wrote:



On 2016/8/24 20:52, Wei Liu wrote:

On Tue, Aug 16, 2016 at 06:25:02PM +0800, Shannon Zhao wrote:

From: Shannon Zhao 

Construct ACPI RSDP table and add a helper to calculate the ACPI table
checksum.

Signed-off-by: Shannon Zhao 
---
 tools/libxl/libxl_arm_acpi.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 6be9eb0..9432e44 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -33,6 +33,9 @@ extern const unsigned char dsdt_anycpu_arm[];
 _hidden
 extern const int dsdt_anycpu_arm_len;

+#define ACPI_BUILD_APPNAME6 "XenARM"
+#define ACPI_BUILD_APPNAME4 "Xen "
+

Where do these come from? If they are from a spec, could you please add
a comment here?


Not from some spec. Just fake a OEM for these tables like the
ACPI_OEM_ID, ACPI_CREATOR_ID used by x86.


In this case, why don't we re-use the one from x86?

Regards,

--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 13/16] libxl/arm: Add ACPI module

2016-08-29 Thread Julien Grall

Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

Add the ARM Multiboot module for ACPI, so UEFI or DomU can get the base
address of ACPI tables from it.

Signed-off-by: Shannon Zhao 


Acked-by: Julien Grall 


---
 docs/misc/arm/device-tree/acpi.txt | 24 
 tools/libxl/libxl_arm.c| 24 
 2 files changed, 48 insertions(+)
 create mode 100644 docs/misc/arm/device-tree/acpi.txt

diff --git a/docs/misc/arm/device-tree/acpi.txt 
b/docs/misc/arm/device-tree/acpi.txt
new file mode 100644
index 000..3e70157
--- /dev/null
+++ b/docs/misc/arm/device-tree/acpi.txt
@@ -0,0 +1,24 @@
+DomU ACPI module
+
+
+Xen toolstack passes the domU ACPI tables via a reference in the /chosen node 
of
+the device tree.
+
+Each node contains the following properties:
+
+- compatible
+
+   "xen,guest-acpi", "multiboot,module"
+
+- reg
+
+   Specifies the physical address and the length of the module.
+   RSDP table is always located at the beginning of this region.
+
+Examples
+
+
+   module@0x2000 {
+   compatible = "xen,guest-acpi", "multiboot,module";
+   reg = <0x2000 0x1234>;
+   };
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index b95fdf5..11a6f6e 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -285,6 +285,25 @@ static int make_chosen_node(libxl__gc *gc, void *fdt, bool 
ramdisk,
 if (res) return res;
 }

+if (libxl_defbool_val(info->acpi)) {
+const uint64_t acpi_base = GUEST_ACPI_BASE;
+const char *name = GCSPRINTF("module@%"PRIx64, acpi_base);
+
+res = fdt_begin_node(fdt, name);
+if (res) return res;
+
+res = fdt_property_compat(gc, fdt, 2, "xen,guest-acpi",
+  "multiboot,module");
+if (res) return res;
+
+res = fdt_property_regs(gc, fdt, ROOT_ADDRESS_CELLS, ROOT_SIZE_CELLS,
+1, 0, 0);
+if (res) return res;
+
+res = fdt_end_node(fdt);
+if (res) return res;
+}
+
 res = fdt_end_node(fdt);
 if (res) return res;

@@ -974,6 +993,11 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc 
*gc,
 finalise_one_node(gc, fdt, "/memory", bankbase[i], size);
 }

+if (dom->acpi_modules[0].data) {
+finalise_one_node(gc, fdt, "/chosen/module", GUEST_ACPI_BASE,
+  dom->acpi_modules[0].length);
+}
+
 debug_dump_fdt(gc, fdt);

 return 0;



Regards,

--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 10/16] libxl/arm: Construct ACPI FADT table

2016-08-29 Thread Julien Grall

Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

Signed-off-by: Shannon Zhao 
---
 tools/libxl/libxl_arm_acpi.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 75dfcc2..cb1c9df 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -286,6 +286,25 @@ out:
 return rc;
 }

+static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom,
+   struct acpitable acpitables[])
+{
+uint64_t offset = acpitables[FADT].addr - GUEST_ACPI_BASE;
+struct acpi_table_fadt *fadt = (void *)dom->acpi_modules[0].data + offset;
+
+/* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */
+fadt->flags = ACPI_FADT_HW_REDUCED;
+fadt->arm_boot_flags = (ACPI_FADT_PSCI_COMPLIANT) | ACPI_FADT_PSCI_USE_HVC;


NIT: The () are not necessary for ACPI_FADT_PSCI_COMPLIANT


+
+/* ACPI v5.1 (fadt->revision.fadt->minor_revision) */
+fadt->minor_revision = 0x1;
+fadt->dsdt = acpitables[DSDT].addr;
+
+make_acpi_header(>header, "FACP", acpitables[FADT].size, 5);
+calculate_checksum(fadt, offsetof(struct acpi_table_header, checksum),
+   acpitables[FADT].size);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
 libxl__domain_build_state *state,
 struct xc_dom_image *dom)
@@ -318,6 +337,10 @@ int libxl__prepare_acpi(libxl__gc *gc, 
libxl_domain_build_info *info,
 make_acpi_xsdt(gc, dom, acpitables);
 make_acpi_gtdt(gc, dom, acpitables);
 rc = make_acpi_madt(gc, dom, info->max_vcpus, xc_config, acpitables);
+if (rc)
+goto out;
+
+make_acpi_fadt(gc, dom, acpitables);

 out:
 return rc;



Regards,

--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 08/16] libxl/arm: Factor MPIDR computing codes out as a helper

2016-08-29 Thread Julien Grall

Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

Factor MPIDR computing codes out as a helper, so it could be shared
between DT and ACPI.

Signed-off-by: Shannon Zhao 


Acked-by: Julien Grall 

Regards,


---
 tools/libxl/libxl_arm.c |  8 +---
 tools/libxl/libxl_arm.h | 11 +++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 8c7fc09..fa0497c 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -309,13 +309,7 @@ static int make_cpus_node(libxl__gc *gc, void *fdt, int 
nr_cpus,
 for (i = 0; i < nr_cpus; i++) {
 const char *name;

-/*
- * According to ARM CPUs bindings, the reg field should match
- * the MPIDR's affinity bits. We will use AFF0 and AFF1 when
- * constructing the reg value of the guest at the moment, for it
- * is enough for the current max vcpu number.
- */
-mpidr_aff = (i & 0x0f) | (((i >> 4) & 0xff) << 8);
+mpidr_aff = libxl__compute_mpdir(i);
 name = GCSPRINTF("cpu@%"PRIx64, mpidr_aff);

 res = fdt_begin_node(fdt, name);
diff --git a/tools/libxl/libxl_arm.h b/tools/libxl/libxl_arm.h
index fe1c05f..5c8fbc6 100644
--- a/tools/libxl/libxl_arm.h
+++ b/tools/libxl/libxl_arm.h
@@ -35,6 +35,17 @@ static inline int libxl__prepare_acpi(libxl__gc *gc,
 }
 #endif

+static inline uint64_t libxl__compute_mpdir(unsigned int cpuid)
+{
+/*
+ * According to ARM CPUs bindings, the reg field should match
+ * the MPIDR's affinity bits. We will use AFF0 and AFF1 when
+ * constructing the reg value of the guest at the moment, for it
+ * is enough for the current max vcpu number.
+ */
+return (cpuid & 0x0f) | (((cpuid >> 4) & 0xff) << 8);
+}
+
 /*
  * Local variables:
  * mode: C



--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 06/16] libxl/arm: Construct ACPI XSDT table

2016-08-29 Thread Julien Grall

Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

Signed-off-by: Shannon Zhao 
---
 tools/libxl/libxl_arm_acpi.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 9432e44..8cd1d9b 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -146,6 +146,35 @@ static void make_acpi_rsdp(libxl__gc *gc, struct 
xc_dom_image *dom,
acpitables[RSDP].size);
 }

+static void make_acpi_header(struct acpi_table_header *h, const char *sig,
+ int len, uint8_t rev)


len should be size_t.


+{
+memcpy(h->signature, sig, 4);
+h->length = len;
+h->revision = rev;
+memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6);
+memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4);
+memcpy(h->oem_table_id + 4, sig, 4);
+h->oem_revision = 1;
+memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4);
+h->asl_compiler_revision = 1;
+h->checksum = 0;
+}
+
+static void make_acpi_xsdt(libxl__gc *gc, struct xc_dom_image *dom,
+   struct acpitable acpitables[])
+{
+uint64_t offset = acpitables[XSDT].addr - GUEST_ACPI_BASE;
+struct acpi_table_xsdt *xsdt = (void *)dom->acpi_modules[0].data + offset;
+
+xsdt->table_offset_entry[0] = acpitables[MADT].addr;
+xsdt->table_offset_entry[1] = acpitables[GTDT].addr;
+xsdt->table_offset_entry[2] = acpitables[FADT].addr;
+make_acpi_header(>header, "XSDT", acpitables[XSDT].size, 1);
+calculate_checksum(xsdt, offsetof(struct acpi_table_header, checksum),
+   acpitables[XSDT].size);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
 libxl__domain_build_state *state,
 struct xc_dom_image *dom)
@@ -175,6 +204,7 @@ int libxl__prepare_acpi(libxl__gc *gc, 
libxl_domain_build_info *info,
 goto out;

 make_acpi_rsdp(gc, dom, acpitables);
+make_acpi_xsdt(gc, dom, acpitables);

 out:
 return rc;



Regards,

--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 05/16] libxl/arm: Construct ACPI RSDP table

2016-08-29 Thread Julien Grall

Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

Construct ACPI RSDP table and add a helper to calculate the ACPI table
checksum.

Signed-off-by: Shannon Zhao 
---
 tools/libxl/libxl_arm_acpi.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 6be9eb0..9432e44 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -33,6 +33,9 @@ extern const unsigned char dsdt_anycpu_arm[];
 _hidden
 extern const int dsdt_anycpu_arm_len;

+#define ACPI_BUILD_APPNAME6 "XenARM"
+#define ACPI_BUILD_APPNAME4 "Xen "
+
 enum {
 RSDP,
 XSDT,
@@ -112,6 +115,37 @@ out:
 return rc;
 }

+static void calculate_checksum(void *table, uint32_t checksum_offset,
+   uint32_t length)
+{
+uint8_t *p, sum = 0;
+
+p = table;
+p[checksum_offset] = 0;
+
+while ( length-- )
+sum = sum + *p++;
+
+p = table;
+p[checksum_offset] = -sum;
+}
+
+static void make_acpi_rsdp(libxl__gc *gc, struct xc_dom_image *dom,
+   struct acpitable acpitables[])
+{
+uint64_t offset = acpitables[RSDP].addr - GUEST_ACPI_BASE;
+struct acpi_table_rsdp *rsdp = (void *)dom->acpi_modules[0].data + offset;


Why do you cast to (void *)?


+
+memcpy(rsdp->signature, "RSD PTR ", sizeof(rsdp->signature));
+memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id));
+rsdp->length = acpitables[RSDP].size;
+rsdp->revision = 0x02;
+rsdp->xsdt_physical_address = acpitables[XSDT].addr;
+calculate_checksum(rsdp,
+   offsetof(struct acpi_table_rsdp, extended_checksum),
+   acpitables[RSDP].size);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
 libxl__domain_build_state *state,
 struct xc_dom_image *dom)
@@ -137,6 +171,10 @@ int libxl__prepare_acpi(libxl__gc *gc, 
libxl_domain_build_info *info,
 dom->acpi_modules[0].guest_addr_out = GUEST_ACPI_BASE;

 rc = libxl__estimate_acpi_size(gc, info, dom, xc_config, acpitables);
+if (rc)
+goto out;
+
+make_acpi_rsdp(gc, dom, acpitables);

 out:
 return rc;



--
Julien Grall

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


Re: [Xen-devel] [PATCH v4 07/16] libxl/arm: Construct ACPI GTDT table

2016-08-29 Thread Julien Grall

Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

Construct GTDT table with the interrupt information of timers.

Signed-off-by: Shannon Zhao 
---
 tools/libxl/libxl_arm_acpi.c | 29 +
 1 file changed, 29 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 8cd1d9b..28fb6fe 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -24,10 +24,18 @@ typedef uint8_t u8;
 typedef uint16_t u16;
 typedef uint32_t u32;
 typedef uint64_t u64;
+typedef int64_t s64;

 #include 
 #include 

+#include 
+#define ACPI_MACHINE_WIDTH __BITS_PER_LONG
+#define COMPILER_DEPENDENT_INT64 int64_t
+#define COMPILER_DEPENDENT_UINT64 uint64_t
+
+#include 
+
 _hidden
 extern const unsigned char dsdt_anycpu_arm[];
 _hidden
@@ -175,6 +183,26 @@ static void make_acpi_xsdt(libxl__gc *gc, struct 
xc_dom_image *dom,
acpitables[XSDT].size);
 }

+static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom,
+   struct acpitable acpitables[])
+{
+uint64_t offset = acpitables[GTDT].addr - GUEST_ACPI_BASE;
+struct acpi_table_gtdt *gtdt = (void *)dom->acpi_modules[0].data + offset;
+
+gtdt->non_secure_el1_interrupt = GUEST_TIMER_PHYS_NS_PPI;
+gtdt->non_secure_el1_flags =
+ (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE)
+ |(ACPI_ACTIVE_LOW << 
ACPI_GTDT_INTERRUPT_POLARITY);
+gtdt->virtual_timer_interrupt = GUEST_TIMER_VIRT_PPI;
+gtdt->virtual_timer_flags =
+ (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE)
+ |(ACPI_ACTIVE_LOW << 
ACPI_GTDT_INTERRUPT_POLARITY);
+


I don't see any setting for the field counter_block_address. From the 
ACPI spec, the field should be 0x when the counter 
control block is not available.



+make_acpi_header(>header, "GTDT", acpitables[GTDT].size, 2);
+calculate_checksum(gtdt, offsetof(struct acpi_table_header, checksum),
+   acpitables[GTDT].size);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
 libxl__domain_build_state *state,
 struct xc_dom_image *dom)
@@ -205,6 +233,7 @@ int libxl__prepare_acpi(libxl__gc *gc, 
libxl_domain_build_info *info,

 make_acpi_rsdp(gc, dom, acpitables);
 make_acpi_xsdt(gc, dom, acpitables);
+make_acpi_gtdt(gc, dom, acpitables);

 out:
 return rc;



Regards,

--
Julien Grall

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


[Xen-devel] [xen-unstable test] 100655: tolerable FAIL - PUSHED

2016-08-29 Thread osstest service owner
flight 100655 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/100655/

Failures :-/ but no regressions.

Regressions which are regarded as allowable (not blocking):
 test-amd64-amd64-xl-rtds  6 xen-boot fail  like 100627
 build-amd64-rumpuserxen   6 xen-buildfail  like 100650
 build-i386-rumpuserxen6 xen-buildfail  like 100650
 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail like 100650
 test-amd64-i386-xl-qemut-win7-amd64 16 guest-stop fail like 100650
 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-stopfail like 100650
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stopfail like 100650

Tests which did not succeed, but are not blocking:
 test-amd64-i386-rumpuserxen-i386  1 build-check(1)   blocked  n/a
 test-amd64-amd64-rumpuserxen-amd64  1 build-check(1)   blocked n/a
 test-amd64-amd64-xl-pvh-intel 11 guest-start  fail  never pass
 test-amd64-amd64-xl-pvh-amd  11 guest-start  fail   never pass
 test-amd64-i386-libvirt  12 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt 12 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 12 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-armhf-armhf-libvirt 12 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt 14 guest-saverestorefail   never pass
 test-amd64-amd64-libvirt-vhd 11 migrate-support-checkfail   never pass
 test-amd64-amd64-qemuu-nested-amd 16 debian-hvm-install/l1/l2  fail never pass
 test-armhf-armhf-xl-xsm  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 12 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 13 saverestore-support-checkfail never pass
 test-amd64-i386-libvirt-xsm  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  11 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  12 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 12 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 13 saverestore-support-checkfail  never pass
 test-armhf-armhf-libvirt-xsm 12 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 14 guest-saverestorefail   never pass
 test-armhf-armhf-libvirt-raw 11 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 13 guest-saverestorefail   never pass
 test-armhf-armhf-libvirt-qcow2 11 migrate-support-checkfail never pass
 test-armhf-armhf-libvirt-qcow2 13 guest-saverestorefail never pass

version targeted for testing:
 xen  81caac0cd0f56b0052a7884e6bd99e3a652ddd59
baseline version:
 xen  8bc02b47e5833c374b35618729d147d2980d4e05

Last test of basis   100650  2016-08-29 01:59:44 Z0 days
Testing same since   100655  2016-08-29 17:14:42 Z0 days1 attempts


People who touched revisions under test:
  Jan Beulich 
  Suravee Suthikulpanit 

jobs:
 build-amd64-xsm  pass
 build-armhf-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-armhf  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-armhf-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-oldkern  pass
 build-i386-oldkern   pass  

Re: [Xen-devel] [PATCH v4 03/16] libxl/arm: Generate static ACPI DSDT table

2016-08-29 Thread Julien Grall

Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:

From: Shannon Zhao 

It uses static DSDT table like the way x86 uses. Currently the DSDT
table only contains processor device objects and it generates the
maximal objects which so far is 128.

Also only check iasl for aarch64 in configure since ACPI on ARM32 is not
supported.

Signed-off-by: Shannon Zhao 
---
 tools/configure   |  2 +-


The file tools/configure should not be modified manually. Instead you 
have to modify tools/configure.ac.


You can regenerate tools/configure, you can call ./autegen.sh. However, 
I would recommend you to not include the changes of configure and ask 
the committer to regenerate. This is because we use always use the same 
version of autotools to do generation in order to avoid spurious change.



 tools/libacpi/Makefile| 15 -
 tools/libacpi/mk_dsdt.c   | 51 ---
 tools/libxl/Makefile  |  5 -
 tools/libxl/libxl_arm_acpi.c  |  5 +
 xen/include/public/arch-arm.h |  3 +++
 6 files changed, 65 insertions(+), 16 deletions(-)

diff --git a/tools/configure b/tools/configure
index 5b5dcce..48239c0 100755
--- a/tools/configure
+++ b/tools/configure
@@ -7458,7 +7458,7 @@ then
 as_fn_error $? "Unable to find xgettext, please install xgettext" 
"$LINENO" 5
 fi
 case "$host_cpu" in
-i[3456]86|x86_64)
+i[3456]86|x86_64|aarch64)
 # Extract the first word of "iasl", so it can be a program name with args.
 set dummy iasl; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index d741ac5..7f50a33 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -19,6 +19,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt

 # Sources to be generated
 C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, dsdt_anycpu.c dsdt_15cpu.c  
dsdt_anycpu_qemu_xen.c dsdt_pvh.c)
+C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c


Do we really want to generate dsdt_anycpu_arm.c even for x86? Similarly, 
do we want to generate x86 dsdt for ARM?



 H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h 
ssdt_tpm.h)

 vpath iasl $(PATH)
@@ -32,7 +33,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
cd $(CURDIR)

 $(MK_DSDT): mk_dsdt.c
-   $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
+   $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ 
mk_dsdt.c


It would be useful to mention either in the code or in the commit 
message why you added __XEN_TOOLS__ here.




 $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl 
$(MK_DSDT)
awk 'NR > 1 {print s} {s=$$0}' $< > $@
@@ -62,6 +63,18 @@ $(ACPI_BUILD_DIR)/dsdt_pvh.c: iasl 
$(ACPI_BUILD_DIR)/dsdt_pvh.asl
echo "int dsdt_pvh_len=sizeof(dsdt_pvh);" >>$@
rm -f $(ACPI_BUILD_DIR)/$*.aml $(ACPI_BUILD_DIR)/$*.hex

+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl: $(MK_DSDT)
+   printf "DefinitionBlock (\"DSDT.aml\", \"DSDT\", 3, \"XenARM\", \"Xen DSDT\", 
1)\n{" > $@
+   $(MK_DSDT) --debug=$(debug) --arch arm >> $@
+
+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c: iasl $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl
+   cd $(ACPI_BUILD_DIR)
+   iasl -vs -p $* -tc $(ACPI_BUILD_DIR)/$*.asl
+   sed -e 's/AmlCode/$*/g' $*.hex >$@
+   echo "int $*_len=sizeof($*);" >>$@
+   rm -f $*.aml $*.hex
+   cd $(CURDIR)
+
 iasl:
@echo
@echo "ACPI ASL compiler (iasl) is needed"
diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 7d76784..f3ab28f 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 


arch-arm.h defines a lot of ARM specific constant. This is a call to 
misused them when built for x86.


Similarly, xen/hvm/hvm_info_table.h should not be included for ARM.



 static unsigned int indent_level;
 static bool debug = false;
@@ -99,6 +100,7 @@ static struct option options[] = {
 { "dm-version", 1, 0, 'q' },
 { "debug", 1, 0, 'd' },
 { "no-dm", 0, 0, 'n' },
+{ "arch", 1, 0, 'a' },
 { 0, 0, 0, 0 }
 };

@@ -106,7 +108,7 @@ int main(int argc, char **argv)
 {
 unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS;


Here an example why we should avoid to include x86 header for ARM. 
HVM_MAX_VCPUS is x86 specific.



 dm_version dm_version = QEMU_XEN_TRADITIONAL;
-bool no_dm = 0;
+bool no_dm = 0, arch_is_arm = false;

 for ( ; ; )
 {
@@ -145,6 +147,10 @@ int main(int argc, char **argv)
 case 'n':
 no_dm = 1;
 break;
+case 'a':
+if (strcmp(optarg, "arm") == 0)
+arch_is_arm = true;
+break;
 case 'd':
 if (*optarg == 'y')
 debug = true;
@@ -154,6 +160,9 @@ int main(int argc, char **argv)
 }
 }

+if (arch_is_arm)
+

Re: [Xen-devel] [PATCH] Fix a BUG_ON issue

2016-08-29 Thread Wu, Feng


> -Original Message-
> From: Jan Beulich [mailto:jbeul...@suse.com]
> Sent: Monday, August 29, 2016 7:51 PM
> To: Wu, Feng 
> Cc: xen-devel@lists.xen.org
> Subject: Re: [PATCH] Fix a BUG_ON issue
> 
> >>> On 29.08.16 at 11:14,  wrote:
> > --- a/xen/drivers/passthrough/io.c
> > +++ b/xen/drivers/passthrough/io.c
> > @@ -243,7 +243,7 @@ static struct vcpu *vector_hashing_dest(const struct
> domain *d,
> >  for ( i = 0; i <= mod; i++ )
> >  {
> >  idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx) + 1;
> > -BUG_ON(idx >= d->max_vcpus);
> > +BUG_ON(idx > d->max_vcpus);
> >  }
> >
> >  dest = d->vcpu[idx - 1];
> 
> Wouldn't it be better to change the code to
> 
> unsigned int idx = -1;
> 
> for ( i = 0; i <= mod; i++ )
> {
> idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx + 1);
> BUG_ON(idx >= d->max_vcpus);
> }
> 
> dest = d->vcpu[idx];

Thanks for the comments, both are good to me, but I slightly prefer this
one. Do I need to send another version?

Thanks,
Feng

> 
> or, not utilizing wrapping
> 
> unsigned int idx = find_first_bit(dest_vcpu_bitmap, d->max_vcpus);
> 
> for ( i = 0; i < mod; i++ )
> idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx + 1);
> 
> BUG_ON(idx >= d->max_vcpus);
> 
> dest = d->vcpu[idx];
> 
> Jan


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


Re: [Xen-devel] Questions about Using Perf at Dom0

2016-08-29 Thread Boris Ostrovsky
On 08/29/2016 05:48 PM, Sanghyun Hong wrote:
> I really appreciate for your answers. Last but not the least, I want to make 
> it more clear:
>
>> The hypervisor will provide dom0 with a raw sample (guest's, dom0's or
>> hypervisor's) and then it's the job of dom0 kernel to properly tag and
>> format it and make it available to the userland (i.e. perf itself).
> Does this mean if I run the perf command on Dom0 while other domains are 
> running, we can collect the performance counter values without distinguishing 
> each domain, right?

With 'self' mode each domain collects samples only for itself.

And for 'all' mode apparently this kind of works. With perf build from
Linux 4.7 tree:

root@haswell> xl vcpu-list
NameID  VCPU   CPU State   Time(s)
Affinity (Hard / Soft)
Domain-0 0 00   -b-  55.0  0 / all
Domain-0 0 11   r--  35.9  1 / all
Domain-0 0 22   -b-  36.9  2 / all
Domain-0 0 33   -b-  36.2  3 / all
fedora   1 01   -b- 183.7  1 / all
root@haswell> ./perf kvm --guest --host --guestkallsyms=/tmp/kallsyms
record -C 1 sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.139 MB perf.data.kvm (60 samples) ]
root@haswell> ./perf kvm --guest --host --guestkallsyms=/tmp/kallsyms
report --stdio
...
# Overhead  Command  Shared Object   
Symbol  
#   ...  ... 
.
#
14.48%  swapper  [unknown][k] 0x82d0801c7a37
 6.06%  swapper  [kernel.kallsyms][k]
update_blocked_averages
 4.38%  swapper  [unknown][k] 0x82d08013690f
 2.75%  swapper  [kernel.kallsyms][k] update_rq_clock
 2.34%  swapper  [kernel.kallsyms][k] irq_enter
 2.33%  [guest/0][guest.kernel.kallsyms]  [g]
fb_pad_aligned_buffer
 2.24%  1.hda-0  [kernel.kallsyms][k]
_raw_spin_unlock_irqrestore
 2.11%  [guest/0][guest.kernel.kallsyms]  [g] native_safe_halt
 2.05%  [guest/0][guest.kernel.kallsyms]  [g]
update_blocked_averages
...

"unknown" samples are from hypervisor.


>
>> The tool will then look at the tag and display the event as belonging to
>> host (dom0, really) or guest. This is supported for KVM, with 'perf kvm'
>> commands.
>>
>> So if you can run perf kvm commands then you may be able to
>> differentiate dom0's and guest's samples (you will also see hypervisor
>> samples but they won't get resolved to symbols). I am just not sure per
>> kvm will run on a non-KVM host. I had a private copy where it did but
>> this was based on a fairly old version of Linux.
>>
>> (Also, stack profiling is not supported at all).
>
> I wonder if you can share the private copy of your code. I’m looking into the 
> source code of the patches, and it seems there’s a way to do it. Even if your 
> codes are outdated, I think I can manage to port it. I will promise once I 
> finish the porting, I will share my adjustment of your code as well.

Looks like you may not need it.

-boris

>
> Best,
> Sanghyun.
>
>
>> On Aug 29, 2016, at 5:24 PM, Boris Ostrovsky  
>> wrote:
>>
>> On 08/29/2016 05:08 PM, Sanghyun Hong wrote:
 Yes, this will allow the hypervisor to collect samples from multiple
 guests. However, the tool (perf) probably won't be able to properly
 process these samples. But you can try.
>>> I understand, thus, I applied the patches and set
>>> the /pmu_mode/ to *all*. However, I’m really curious what you mean by
>>> the tool (*perf*) probably won’t be able to properly process these
>>> samples. Is there any things I have to have in mind while collecting
>>> the counters, or will it have incorrect values of the counters?
>> The hypervisor will provide dom0 with a raw sample (guest's, dom0's or
>> hypervisor's) and then it's the job of dom0 kernel to properly tag and
>> format it and make it available to the userland (i.e. perf itself). The
>> tool will then look at the tag and display the event as belonging to
>> host (dom0, really) or guest. This is supported for KVM, with 'perf kvm'
>> commands.
>>
>> So if you can run perf kvm commands then you may be able to
>> differentiate dom0's and guest's samples (you will also see hypervisor
>> samples but they won't get resolved to symbols). I am just not sure per
>> kvm will run on a non-KVM host. I had a private copy where it did but
>> this was based on a fairly old version of Linux.
>>
>> (Also, stack profiling is not supported at all).
>>
 You will want to run dom0 on all physical processors (i.e. no
 dom0_max_vcpus boot option) and pin all VCPUs for both dom0 and the
 guest.
>>> Sure, 

Re: [Xen-devel] Questions about Using Perf at Dom0

2016-08-29 Thread Boris Ostrovsky
On 08/29/2016 05:08 PM, Sanghyun Hong wrote:
>> Yes, this will allow the hypervisor to collect samples from multiple
>> guests. However, the tool (perf) probably won't be able to properly
>> process these samples. But you can try.
>
> I understand, thus, I applied the patches and set
> the /pmu_mode/ to *all*. However, I’m really curious what you mean by
> the tool (*perf*) probably won’t be able to properly process these
> samples. Is there any things I have to have in mind while collecting
> the counters, or will it have incorrect values of the counters?

The hypervisor will provide dom0 with a raw sample (guest's, dom0's or
hypervisor's) and then it's the job of dom0 kernel to properly tag and
format it and make it available to the userland (i.e. perf itself). The
tool will then look at the tag and display the event as belonging to
host (dom0, really) or guest. This is supported for KVM, with 'perf kvm'
commands.

So if you can run perf kvm commands then you may be able to
differentiate dom0's and guest's samples (you will also see hypervisor
samples but they won't get resolved to symbols). I am just not sure per
kvm will run on a non-KVM host. I had a private copy where it did but
this was based on a fairly old version of Linux.

(Also, stack profiling is not supported at all).

>
>> You will want to run dom0 on all physical processors (i.e. no
>> dom0_max_vcpus boot option) and pin all VCPUs for both dom0 and the
>> guest.
>
> Sure, thanks! My machine has four physical cores, and I’ve set
> the /dom0_max_vcpus=4/. I think it will have the same effect in
> removing the /dom0_max_vcpus/ option.

Yes.

-boris

>
> Best,
> Sanghyun.
>
>
>> On Aug 29, 2016, at 4:59 PM, Boris Ostrovsky
>> > wrote:
>>
>> On 08/29/2016 02:42 PM, Sanghyun Hong wrote:
>>> Hi Boris,
>>>
>>> I’ve found the
>>> documentations(https://github.com/torvalds/linux/blob/master/Documentation/ABI/testing/sysfs-hypervisor-pmu)
>>> in the kernel source code, and it seems like if we change the mode
>>> from *self* to *all* then we can collect counters for all the domains,
>>> right?
>>
>> Yes, this will allow the hypervisor to collect samples from multiple
>> guests. However, the tool (perf) probably won't be able to properly
>> process these samples. But you can try.
>>
>> You will want to run dom0 on all physical processors (i.e. no
>> dom0_max_vcpus boot option) and pin all VCPUs for both dom0 and the
>> guest.
>>
>>
>> -boris
>>
>>>
>>> All the best,
>>> Sanghyun.
>>>
>>>
 On Aug 29, 2016, at 12:36 PM, Boris Ostrovsky
 
 > wrote:

 On 08/29/2016 09:18 AM, Sanghyun Hong wrote:
> Dear Xen-Devel Community:
>
> I’m a grad student working on measuring performance counters at the
> Xen domains. I read this
> thread(https://wiki.xenproject.org/wiki/Xen_Profiling:_oprofile_and_perf)
> in
> web, and it says using Linux perf command will let us collecting
> performance counters in both dom0 and domU. Does it mean that we can
> collect both of them at once if we run perf command on the dom0? (If
> not, does it mean we can collect counters for each domain separately
> once we run the perf command in each domain?

 Profiling both guest and dom0 (and the hypervisor) requires changes to
 perf and those are not there yet.

 But you can run perf in each guest (including dom0) separately. Make
 sure you have vpmu=true boot option.

 -boris





>>>
>>
>>
>



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


Re: [Xen-devel] Questions about Using Perf at Dom0

2016-08-29 Thread Boris Ostrovsky
On 08/29/2016 02:42 PM, Sanghyun Hong wrote:
> Hi Boris, 
>
> I’ve found the
> documentations(https://github.com/torvalds/linux/blob/master/Documentation/ABI/testing/sysfs-hypervisor-pmu)
> in the kernel source code, and it seems like if we change the mode
> from *self* to *all* then we can collect counters for all the domains,
> right?

Yes, this will allow the hypervisor to collect samples from multiple
guests. However, the tool (perf) probably won't be able to properly
process these samples. But you can try.

You will want to run dom0 on all physical processors (i.e. no
dom0_max_vcpus boot option) and pin all VCPUs for both dom0 and the guest.


-boris

>
> All the best,
> Sanghyun.
>
>
>> On Aug 29, 2016, at 12:36 PM, Boris Ostrovsky
>> > wrote:
>>
>> On 08/29/2016 09:18 AM, Sanghyun Hong wrote:
>>> Dear Xen-Devel Community:
>>>
>>> I’m a grad student working on measuring performance counters at the
>>> Xen domains. I read this
>>> thread(https://wiki.xenproject.org/wiki/Xen_Profiling:_oprofile_and_perf)
>>> in
>>> web, and it says using Linux perf command will let us collecting
>>> performance counters in both dom0 and domU. Does it mean that we can
>>> collect both of them at once if we run perf command on the dom0? (If
>>> not, does it mean we can collect counters for each domain separately
>>> once we run the perf command in each domain?
>>
>> Profiling both guest and dom0 (and the hypervisor) requires changes to
>> perf and those are not there yet.
>>
>> But you can run perf in each guest (including dom0) separately. Make
>> sure you have vpmu=true boot option.
>>
>> -boris
>>
>>
>>
>>
>>
>



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


Re: [Xen-devel] [PATCH v2 1/2] mini-os: partially revert "remove using start_info ..."

2016-08-29 Thread Samuel Thibault
Juergen Gross, on Mon 29 Aug 2016 16:18:26 +0200, wrote:
> Commit e33452c4f5547ed14defe6382b3b53664ac5bd8a ("remove using
> start_info in architecture independent code") removed the start_info
> variable completely. grub stubdom needs the start_info structure.
> 
> Readd the start_info structure, but make it dependent on
> CONFIG_PARAVIRT.
> 
> Signed-off-by: Juergen Gross 

Reviewed-by: Samuel Thibault 

> ---
>  arch/x86/setup.c | 12 
>  include/hypervisor.h | 13 -
>  2 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/setup.c b/arch/x86/setup.c
> index 86955cf..5278227 100644
> --- a/arch/x86/setup.c
> +++ b/arch/x86/setup.c
> @@ -33,6 +33,14 @@
>  #include 
>  #include 
>  
> +#ifdef CONFIG_PARAVIRT
> +/*
> + * This structure contains start-of-day info, such as pagetable base pointer,
> + * address of the shared_info structure, and things like that.
> + */
> +union start_info_union start_info_union;
> +#endif
> +
>  /*
>   * Shared page for communicating with the hypervisor.
>   * Events flags go here, for example.
> @@ -189,6 +197,10 @@ arch_init(void *par)
>   /* print out some useful information  */
>   print_start_of_day(par);
>  
> +#ifdef CONFIG_PARAVIRT
> + memcpy(_info, par, sizeof(start_info));
> +#endif
> +
>   start_kernel();
>  }
>  
> diff --git a/include/hypervisor.h b/include/hypervisor.h
> index 3073a8a..f3b1f3c 100644
> --- a/include/hypervisor.h
> +++ b/include/hypervisor.h
> @@ -27,7 +27,18 @@
>  #include 
>  
>  /* hypervisor.c */
> -#ifndef CONFIG_PARAVIRT
> +#ifdef CONFIG_PARAVIRT
> +/*
> + * a placeholder for the start of day information passed up from the 
> hypervisor
> + */
> +union start_info_union
> +{
> +start_info_t start_info;
> +char padding[512];
> +};
> +extern union start_info_union start_info_union;
> +#define start_info (start_info_union.start_info)
> +#else
>  int hvm_get_parameter(int idx, uint64_t *value);
>  int hvm_set_parameter(int idx, uint64_t value);
>  #endif
> -- 
> 2.6.6
> 

-- 
Samuel
 FYLG> Tiens, vlà une URL qui va bien :
 FYLG> ftp://127.0.0.1/WaReZ/NiouZeS/WinDoZe/NeWSMoNGeR/SuPeR
 c'est gentil sauf que l'adresse ne fonctionne pas sa me fais une erreur
 -+- Furtif in Guide du Neuneu Usenet :  -+-

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


Re: [Xen-devel] [PATCH v2 1/2] mini-os: partially revert "remove using start_info ..."

2016-08-29 Thread Samuel Thibault
Samuel Thibault, on Mon 29 Aug 2016 22:49:07 +0200, wrote:
> Juergen Gross, on Mon 29 Aug 2016 16:18:26 +0200, wrote:
> > +union start_info_union
> > +{
> > +start_info_t start_info;
> > +char padding[512];
> > +};
> 
> Why defining a union? 512 is actually not enough for start_info_t.

Ah, sorry, that was already there :)

Samuel

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


Re: [Xen-devel] [PATCH v2 1/2] mini-os: partially revert "remove using start_info ..."

2016-08-29 Thread Samuel Thibault
Hello,

Juergen Gross, on Mon 29 Aug 2016 16:18:26 +0200, wrote:
> +union start_info_union
> +{
> +start_info_t start_info;
> +char padding[512];
> +};

Why defining a union? 512 is actually not enough for start_info_t.

Samuel

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


Re: [Xen-devel] [PATCH 2/2] mini-os: don't get xenbus parameters if xenbus is disabled

2016-08-29 Thread Samuel Thibault
Wei Liu, on Mon 29 Aug 2016 12:11:21 +0100, wrote:
> On Mon, Aug 29, 2016 at 01:01:09PM +0200, Juergen Gross wrote:
> > get_xenbus() should be called only if CONFIG_XENBUS is set.
> > 
> > Signed-off-by: Juergen Gross 
> 
> Reviewed-by: Wei Liu 

Acked-by: Samuel Thibault 

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


Re: [Xen-devel] [MINIOS PATCH 1/3] Makefile: simplify all_sources macro

2016-08-29 Thread Samuel Thibault
Juergen Gross, on Mon 29 Aug 2016 15:07:20 +0200, wrote:
> On 29/08/16 15:01, Wei Liu wrote:
> > There is no SCCS file.
> > 
> > Signed-off-by: Wei Liu 
> 
> Reviewed-by: Juergen Gross 

Acked-by: Samuel Thibault 

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


Re: [Xen-devel] [MINIOS PATCH 3/3] gitignore: ignore files generated by various indexing software

2016-08-29 Thread Samuel Thibault
Juergen Gross, on Mon 29 Aug 2016 15:07:55 +0200, wrote:
> On 29/08/16 15:01, Wei Liu wrote:
> > Signed-off-by: Wei Liu 
> 
> Reviewed-by: Juergen Gross 

Acked-by: Samuel Thibault 

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


Re: [Xen-devel] [MINIOS PATCH 2/3] Makefile: add gtags target

2016-08-29 Thread Samuel Thibault
Juergen Gross, on Mon 29 Aug 2016 15:07:39 +0200, wrote:
> On 29/08/16 15:01, Wei Liu wrote:
> > Use GNU Global to generate source code index.
> > 
> > Signed-off-by: Wei Liu 
> 
> Reviewed-by: Juergen Gross 

Acked-by: Samuel Thibault 

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


[Xen-devel] Xen EFI build system and gcov

2016-08-29 Thread Wei Liu
Hi Jan

Today I had some free cycles so I spent some time looking at gcov
support in the hypervisor and tried to write a patch to fix the
currently broken gcov build. But my patch alone is not enough to fix
that.

There seems to be a problem with the EFI Makefile. With my patch
applied, efi/boot.init.o still gets all gcov options _and_
-DINIT_SECTIONS_ONLY. See output and patch for more context.

If I force efi to be disabled by putting in a hack into efi/Makefile,
Xen builds fine. It suggests for all other files my patch works.

I am confused why efi/boot.init.o gets both set of options and I'm not
sure what is the best approach to fix it.

Do you have any suggestion on fixing that?

Thanks
Wei.

gcc ... -fprofile-arcs -ftest-coverage -DTEST_COVERAGE -DINIT_SECTIONS_ONLY -c 
boot.c -o boot.o
objdump -h boot.o | sed -n '/[0-9]/{s,00*,0,g;p;}' | while read idx name sz 
rest; do \
case "$name" in \
.*.local) ;; \
.text|.text.*|.data|.data.*|.bss) \
test $sz != 0 || continue; \
echo "Error: size of boot.o:$name is 0x$sz" >&2; \
exit $(expr $idx + 1);; \
esac; \
done
Error: size of boot.o:.text is 0x012
/local/work/xen.git/xen/Rules.mk:184: recipe for target 'boot.init.o' failed

---8<---
From 36c9fe8274187c6f8a4caa6f6b9c354ca9db2866 Mon Sep 17 00:00:00 2001
From: Wei Liu 
Date: Mon, 29 Aug 2016 19:11:59 +0100
Subject: [PATCH] xen: fix gcov compilation

Currently enabling gcov in hypervisor won't build because although
26c9d03d ("gcov: Adding support for coverage information") claimed that
%.init.o files were excluded from applying compilation options, it was
in fact not true.

Fix that by filtering out the options correctly.

Signed-off-by: Wei Liu 
---
 xen/Rules.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index a190ff0..e49566c 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -115,7 +115,9 @@ subdir-all := $(subdir-y) $(subdir-n)
 
 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += 
-DINIT_SECTIONS_ONLY
 
-$(obj-$(coverage)): CFLAGS += -fprofile-arcs -ftest-coverage -DTEST_COVERAGE
+ifeq ($(coverage),y)
+$(filter-out %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += 
-fprofile-arcs -ftest-coverage -DTEST_COVERAGE
+endif
 
 ifeq ($(lto),y)
 # Would like to handle all object files as bitcode, but objects made from
-- 
2.1.4


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


Re: [Xen-devel] [PATCH] xen: Remove event channel notification through Xen PCI platform device

2016-08-29 Thread Boris Ostrovsky
On 08/26/2016 05:55 PM, KarimAllah Ahmed wrote:
> Ever since commit 254d1a3f02eb ("xen/pv-on-hvm kexec: shutdown watches
> from old kernel") using the INTx interrupt from Xen PCI platform device for
> event channel notification would just lockup the guest during bootup.
> postcore_initcall now calls xs_reset_watches which will eventually try to read
> a value from XenStore and will get stuck on read_reply at XenBus forever since
> the platform driver is not probed yet and its INTx interrupt handler is not
> registered yet. That means that the guest can not be notified at this moment 
> of
> any pending event channels and none of the per-event handlers will ever be
> invoked (including the XenStore one) and the reply will never be picked up by
> the kernel.
>
> The exact stack where things get stuck during xenbus_init:
>
> -xenbus_init
>  -xs_init
>   -xs_reset_watches
>-xenbus_scanf
> -xenbus_read
>  -xs_single
>   -xs_single
>-xs_talkv
>
> Vector callbacks have always been the favourite event notification mechanism
> since their introduction in commit 38e20b07efd5 ("x86/xen: event channels
> delivery on HVM.") and the vector callback feature has always been advertised
> for quite some time by Xen that's why INTx was broken for several years now
> without impacting anyone.
>
> Luckily this also means that event channel notification through INTx is
> basically dead-code which can be safely removed without impacting anybody 
> since
> it has been effectively disabled for more than 4 years with nobody complaining
> about it (at least as far as I'm aware of).
>
> This commit removes event channel notification through Xen PCI platform 
> device.
>
> Cc: Boris Ostrovsky 
> Cc: David Vrabel 
> Cc: Juergen Gross 
> Cc: Thomas Gleixner 
> Cc: Ingo Molnar 
> Cc: "H. Peter Anvin" 
> Cc: x...@kernel.org
> Cc: Konrad Rzeszutek Wilk 
> Cc: Bjorn Helgaas 
> Cc: Stefano Stabellini 
> Cc: Julien Grall 
> Cc: Vitaly Kuznetsov 
> Cc: Paul Gortmaker 
> Cc: Ross Lagerwall 
> Cc: xen-de...@lists.xenproject.org
> Cc: linux-ker...@vger.kernel.org
> Cc: linux-...@vger.kernel.org
> Cc: Anthony Liguori 
> Signed-off-by: KarimAllah Ahmed 

Reviewed-by: Boris Ostrovsky 





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


Re: [Xen-devel] [PATCH RFC] tools/libxc, xen/x86: Added xc_set_mem_access_sparse()

2016-08-29 Thread Razvan Cojocaru
On 08/29/16 19:20, Jan Beulich wrote:
 On 29.08.16 at 18:02,  wrote:
>> On 08/29/16 18:42, Jan Beulich wrote:
>> On 29.08.16 at 17:29,  wrote:
 On 08/26/2016 11:14 AM, Jan Beulich wrote:
 On 26.08.16 at 09:40,  wrote:
>> On 08/26/16 10:18, Jan Beulich wrote:
>> On 26.08.16 at 08:11,  wrote:
 @@ -76,6 +76,17 @@ int mem_access_memop(unsigned long cmd,
  }
  break;
  
 +case XENMEM_access_op_set_access_sparse:
 +{
 +xen_pfn_t *arr = xmalloc_bytes(sizeof(xen_pfn_t) * mao.nr);
 +
 +// copy_from_guest(arr, mao.pfn_list, mao.nr);
>>>
>>> What is this (wrongly C++ style) comment about? I think this really
>>> wasn't meant to be a comment, so RFC or not - how do things work
>>> with this commented out? And where is the error checking for the
>>> allocation (which btw should be xmalloc_array(), but the need for
>>> an allocation here is questionable - the called function would better
>>> retrieve the GFNs one by one).
>>
>> They don't work, I forgot that comment in (the line should not have been
>> commented). I first wrote the patch on Xen 4.6 and there there was no
>> CHECK_mem_access_op, so I was just trying to figure out what went wrong
>> when I first saw the compile errors and tried this, then left it in
>> accidentally.
>>
>> Indeed, there should also be a check for allocation failure.
>>
>> Do you mean that I would do better to just copy_from_guest(,
>> mao.pfn_list + index, 1) in a for loop that sets mem_access restrictions?
>
> Yes, albeit it is copy_from_guest_offset(, mao.pfn_list, index, 1).

 Avoiding translation, to the best of my understanding (and tested with
 the latest version of the patch I'm working on) would then require
 replacing copy_from_guest() with copy_from_user(), which does not have a
 copy_from_user_offset() alternative.
>>>
>>> I don't follow - where did you see copy_from_user() used in such a
>>> case? If you go through the existing examples, you'll find that with
>>> some #define-s (re-vectoring to copy_from_compat_offset()) this
>>> can easily be taken care of.
>>
>> I was looking at xc_mem_paging_memop(), where the buffer parameter is
>> being sent via mpo.buffer, which is an uint64_aligned_t, which I thought
>> was what you meant. On the HV side, it's being copied_from_user().
>>
>> In the interest of preventing furher misunderstanding, could you please
>> point out a specific example you have in mind?
> 
> Actually, having looked again more closely, I'm not sure you need
> to use the compat version of the copying routine; you may need a
> thin handler in compat/memory.c. Before going to further search
> for a suitable example, would you mind pointing out what it is that
> does not work with copy_from_guest_offset()?

With this change:

@@ -452,6 +453,11 @@ struct xen_mem_access_op {
  * ~0ull is used to set and get the default access for pages
  */
 uint64_aligned_t pfn;
+/*
+ * List of pfns to set access for
+ * Used only with XENMEM_access_op_set_access_multi
+ */
+uint64_aligned_t pfn_list;
 };

combined with this change:

@@ -76,6 +76,17 @@ int mem_access_memop(unsigned long cmd,
 }
 break;

+case XENMEM_access_op_set_access_multi:
+{
+xen_pfn_t *arr = xmalloc_bytes(sizeof(xen_pfn_t) * mao.nr);
+
+copy_from_guest(arr, (void *)mao.pfn_list, mao.nr *
sizeof(xen_pfn_t));
+rc = p2m_set_mem_access(d, INVALID_GFN, arr, mao.nr, start_iter,
+MEMOP_CMD_MASK, mao.access, 0);
+xfree(arr);
+break;
+}

I get this compile-time error:

In file included from
/home/red/work/xen.git/xen/include/xen/guest_access.h:10:0,
 from mem_access.c:24:
mem_access.c: In function ‘mem_access_memop’:
/home/red/work/xen.git/xen/include/asm/guest_access.h:99:37: error:
request for member ‘p’ in something not a structure or union
 const typeof(*(ptr)) *_s = (hnd).p; \
 ^
/home/red/work/xen.git/xen/include/xen/guest_access.h:18:5: note: in
expansion of macro ‘copy_from_guest_offset’
 copy_from_guest_offset(ptr, hnd, 0, nr)
 ^
mem_access.c:83:9: note: in expansion of macro ‘copy_from_guest’
 copy_from_guest(arr, (void *)mao.pfn_list, mao.nr *
sizeof(xen_pfn_t));
 ^

In order for this to work, I need to either change from copy_to_guest()
to copy_from_user(), or change from uint64_aligned_t pfn_list; to
XEN_GUEST_HANDLE(xen_pfn_t) pfn_list;.


Thanks,
Razvan

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


[Xen-devel] [xen-unstable-smoke test] 100654: tolerable all pass - PUSHED

2016-08-29 Thread osstest service owner
flight 100654 xen-unstable-smoke real [real]
http://logs.test-lab.xenproject.org/osstest/logs/100654/

Failures :-/ but no regressions.

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-libvirt 12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  13 saverestore-support-checkfail   never pass

version targeted for testing:
 xen  81caac0cd0f56b0052a7884e6bd99e3a652ddd59
baseline version:
 xen  8bc02b47e5833c374b35618729d147d2980d4e05

Last test of basis   100621  2016-08-25 13:04:15 Z4 days
Testing same since   100654  2016-08-29 15:01:51 Z0 days1 attempts


People who touched revisions under test:
  Jan Beulich 
  Suravee Suthikulpanit 

jobs:
 build-amd64  pass
 build-armhf  pass
 build-amd64-libvirt  pass
 test-armhf-armhf-xl  pass
 test-amd64-amd64-xl-qemuu-debianhvm-i386 pass
 test-amd64-amd64-libvirt pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

+ branch=xen-unstable-smoke
+ revision=81caac0cd0f56b0052a7884e6bd99e3a652ddd59
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x '!=' x/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock
++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push xen-unstable-smoke 
81caac0cd0f56b0052a7884e6bd99e3a652ddd59
+ branch=xen-unstable-smoke
+ revision=81caac0cd0f56b0052a7884e6bd99e3a652ddd59
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']'
+ . ./cri-common
++ . ./cri-getconfig
++ umask 002
+ select_xenbranch
+ case "$branch" in
+ tree=xen
+ xenbranch=xen-unstable-smoke
+ qemuubranch=qemu-upstream-unstable
+ '[' xxen = xlinux ']'
+ linuxbranch=
+ '[' xqemu-upstream-unstable = x ']'
+ select_prevxenbranch
++ ./cri-getprevxenbranch xen-unstable-smoke
+ prevxenbranch=xen-4.7-testing
+ '[' x81caac0cd0f56b0052a7884e6bd99e3a652ddd59 = x ']'
+ : tested/2.6.39.x
+ . ./ap-common
++ : osst...@xenbits.xen.org
+++ getconfig OsstestUpstream
+++ perl -e '
use Osstest;
readglobalconfig();
print $c{"OsstestUpstream"} or die $!;
'
++ :
++ : git://xenbits.xen.org/xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/xen.git
++ : git://xenbits.xen.org/qemu-xen-traditional.git
++ : git://git.kernel.org
++ : git://git.kernel.org/pub/scm/linux/kernel/git
++ : git
++ : git://xenbits.xen.org/libvirt.git
++ : osst...@xenbits.xen.org:/home/xen/git/libvirt.git
++ : git://xenbits.xen.org/libvirt.git
++ : git://xenbits.xen.org/rumpuser-xen.git
++ : git
++ : git://xenbits.xen.org/rumpuser-xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/rumpuser-xen.git
+++ besteffort_repo https://github.com/rumpkernel/rumpkernel-netbsd-src
+++ local repo=https://github.com/rumpkernel/rumpkernel-netbsd-src
+++ cached_repo https://github.com/rumpkernel/rumpkernel-netbsd-src 
'[fetch=try]'
+++ local repo=https://github.com/rumpkernel/rumpkernel-netbsd-src
+++ local 'options=[fetch=try]'
 getconfig GitCacheProxy
 perl -e '
use Osstest;
readglobalconfig();
print $c{"GitCacheProxy"} or die $!;
'
+++ local cache=git://cache:9419/
+++ 

Re: [Xen-devel] Questions about Using Perf at Dom0

2016-08-29 Thread Boris Ostrovsky
On 08/29/2016 09:18 AM, Sanghyun Hong wrote:
> Dear Xen-Devel Community:
>
> I’m a grad student working on measuring performance counters at the
> Xen domains. I read this
> thread(https://wiki.xenproject.org/wiki/Xen_Profiling:_oprofile_and_perf) in
> web, and it says using Linux perf command will let us collecting
> performance counters in both dom0 and domU. Does it mean that we can
> collect both of them at once if we run perf command on the dom0? (If
> not, does it mean we can collect counters for each domain separately
> once we run the perf command in each domain?

Profiling both guest and dom0 (and the hypervisor) requires changes to
perf and those are not there yet.

But you can run perf in each guest (including dom0) separately. Make
sure you have vpmu=true boot option.

-boris






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


Re: [Xen-devel] [PATCH RFC] tools/libxc, xen/x86: Added xc_set_mem_access_sparse()

2016-08-29 Thread Jan Beulich
>>> On 29.08.16 at 18:02,  wrote:
> On 08/29/16 18:42, Jan Beulich wrote:
> On 29.08.16 at 17:29,  wrote:
>>> On 08/26/2016 11:14 AM, Jan Beulich wrote:
>>> On 26.08.16 at 09:40,  wrote:
> On 08/26/16 10:18, Jan Beulich wrote:
> On 26.08.16 at 08:11,  wrote:
>>> @@ -76,6 +76,17 @@ int mem_access_memop(unsigned long cmd,
>>>  }
>>>  break;
>>>  
>>> +case XENMEM_access_op_set_access_sparse:
>>> +{
>>> +xen_pfn_t *arr = xmalloc_bytes(sizeof(xen_pfn_t) * mao.nr);
>>> +
>>> +// copy_from_guest(arr, mao.pfn_list, mao.nr);
>>
>> What is this (wrongly C++ style) comment about? I think this really
>> wasn't meant to be a comment, so RFC or not - how do things work
>> with this commented out? And where is the error checking for the
>> allocation (which btw should be xmalloc_array(), but the need for
>> an allocation here is questionable - the called function would better
>> retrieve the GFNs one by one).
>
> They don't work, I forgot that comment in (the line should not have been
> commented). I first wrote the patch on Xen 4.6 and there there was no
> CHECK_mem_access_op, so I was just trying to figure out what went wrong
> when I first saw the compile errors and tried this, then left it in
> accidentally.
>
> Indeed, there should also be a check for allocation failure.
>
> Do you mean that I would do better to just copy_from_guest(,
> mao.pfn_list + index, 1) in a for loop that sets mem_access restrictions?

 Yes, albeit it is copy_from_guest_offset(, mao.pfn_list, index, 1).
>>>
>>> Avoiding translation, to the best of my understanding (and tested with
>>> the latest version of the patch I'm working on) would then require
>>> replacing copy_from_guest() with copy_from_user(), which does not have a
>>> copy_from_user_offset() alternative.
>> 
>> I don't follow - where did you see copy_from_user() used in such a
>> case? If you go through the existing examples, you'll find that with
>> some #define-s (re-vectoring to copy_from_compat_offset()) this
>> can easily be taken care of.
> 
> I was looking at xc_mem_paging_memop(), where the buffer parameter is
> being sent via mpo.buffer, which is an uint64_aligned_t, which I thought
> was what you meant. On the HV side, it's being copied_from_user().
> 
> In the interest of preventing furher misunderstanding, could you please
> point out a specific example you have in mind?

Actually, having looked again more closely, I'm not sure you need
to use the compat version of the copying routine; you may need a
thin handler in compat/memory.c. Before going to further search
for a suitable example, would you mind pointing out what it is that
does not work with copy_from_guest_offset()?

Jan


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


Re: [Xen-devel] [PATCH] x86/PV: make PMU MSR handling consistent

2016-08-29 Thread Boris Ostrovsky
On 08/29/2016 11:37 AM, Jan Beulich wrote:
> So far accesses to Intel MSRs on an AMD system fall through to the
> default case, while accesses to AMD MSRs on an Intel system bail (in
> the RDMSR case without updating EAX and EDX). Make the "AMD MSRs on
> Intel" case match the "Intel MSR on AMD" one.
>
> Signed-off-by: Jan Beulich 

Reviewed-by: Boris Ostrovsky 

>
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -2909,8 +2909,8 @@ static int emulate_privileged_op(struct
>  
>  if ( vpmu_do_wrmsr(regs->ecx, msr_content, 0) )
>  goto fail;
> +break;
>  }
> -break;
>  }
>  /*FALLTHROUGH*/
>  
> @@ -3045,8 +3045,8 @@ static int emulate_privileged_op(struct
>  
>  regs->eax = (uint32_t)val;
>  regs->edx = (uint32_t)(val >> 32);
> +break;
>  }
> -break;
>  }
>  /*FALLTHROUGH*/
>  
>
>
>


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


Re: [Xen-devel] [PATCH RFC] tools/libxc, xen/x86: Added xc_set_mem_access_sparse()

2016-08-29 Thread Razvan Cojocaru
On 08/29/16 18:42, Jan Beulich wrote:
 On 29.08.16 at 17:29,  wrote:
>> On 08/26/2016 11:14 AM, Jan Beulich wrote:
>> On 26.08.16 at 09:40,  wrote:
 On 08/26/16 10:18, Jan Beulich wrote:
 On 26.08.16 at 08:11,  wrote:
>> @@ -76,6 +76,17 @@ int mem_access_memop(unsigned long cmd,
>>  }
>>  break;
>>  
>> +case XENMEM_access_op_set_access_sparse:
>> +{
>> +xen_pfn_t *arr = xmalloc_bytes(sizeof(xen_pfn_t) * mao.nr);
>> +
>> +// copy_from_guest(arr, mao.pfn_list, mao.nr);
>
> What is this (wrongly C++ style) comment about? I think this really
> wasn't meant to be a comment, so RFC or not - how do things work
> with this commented out? And where is the error checking for the
> allocation (which btw should be xmalloc_array(), but the need for
> an allocation here is questionable - the called function would better
> retrieve the GFNs one by one).

 They don't work, I forgot that comment in (the line should not have been
 commented). I first wrote the patch on Xen 4.6 and there there was no
 CHECK_mem_access_op, so I was just trying to figure out what went wrong
 when I first saw the compile errors and tried this, then left it in
 accidentally.

 Indeed, there should also be a check for allocation failure.

 Do you mean that I would do better to just copy_from_guest(,
 mao.pfn_list + index, 1) in a for loop that sets mem_access restrictions?
>>>
>>> Yes, albeit it is copy_from_guest_offset(, mao.pfn_list, index, 1).
>>
>> Avoiding translation, to the best of my understanding (and tested with
>> the latest version of the patch I'm working on) would then require
>> replacing copy_from_guest() with copy_from_user(), which does not have a
>> copy_from_user_offset() alternative.
> 
> I don't follow - where did you see copy_from_user() used in such a
> case? If you go through the existing examples, you'll find that with
> some #define-s (re-vectoring to copy_from_compat_offset()) this
> can easily be taken care of.

I was looking at xc_mem_paging_memop(), where the buffer parameter is
being sent via mpo.buffer, which is an uint64_aligned_t, which I thought
was what you meant. On the HV side, it's being copied_from_user().

In the interest of preventing furher misunderstanding, could you please
point out a specific example you have in mind?


Thanks,
Razvan

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


Re: [Xen-devel] [PATCH RFC] tools/libxc, xen/x86: Added xc_set_mem_access_sparse()

2016-08-29 Thread Jan Beulich
>>> On 29.08.16 at 17:29,  wrote:
> On 08/26/2016 11:14 AM, Jan Beulich wrote:
> On 26.08.16 at 09:40,  wrote:
>>> On 08/26/16 10:18, Jan Beulich wrote:
>>> On 26.08.16 at 08:11,  wrote:
> @@ -76,6 +76,17 @@ int mem_access_memop(unsigned long cmd,
>  }
>  break;
>  
> +case XENMEM_access_op_set_access_sparse:
> +{
> +xen_pfn_t *arr = xmalloc_bytes(sizeof(xen_pfn_t) * mao.nr);
> +
> +// copy_from_guest(arr, mao.pfn_list, mao.nr);

 What is this (wrongly C++ style) comment about? I think this really
 wasn't meant to be a comment, so RFC or not - how do things work
 with this commented out? And where is the error checking for the
 allocation (which btw should be xmalloc_array(), but the need for
 an allocation here is questionable - the called function would better
 retrieve the GFNs one by one).
>>>
>>> They don't work, I forgot that comment in (the line should not have been
>>> commented). I first wrote the patch on Xen 4.6 and there there was no
>>> CHECK_mem_access_op, so I was just trying to figure out what went wrong
>>> when I first saw the compile errors and tried this, then left it in
>>> accidentally.
>>>
>>> Indeed, there should also be a check for allocation failure.
>>>
>>> Do you mean that I would do better to just copy_from_guest(,
>>> mao.pfn_list + index, 1) in a for loop that sets mem_access restrictions?
>> 
>> Yes, albeit it is copy_from_guest_offset(, mao.pfn_list, index, 1).
> 
> Avoiding translation, to the best of my understanding (and tested with
> the latest version of the patch I'm working on) would then require
> replacing copy_from_guest() with copy_from_user(), which does not have a
> copy_from_user_offset() alternative.

I don't follow - where did you see copy_from_user() used in such a
case? If you go through the existing examples, you'll find that with
some #define-s (re-vectoring to copy_from_compat_offset()) this
can easily be taken care of.

Jan


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


[Xen-devel] [PATCH] x86/PV: make PMU MSR handling consistent

2016-08-29 Thread Jan Beulich
So far accesses to Intel MSRs on an AMD system fall through to the
default case, while accesses to AMD MSRs on an Intel system bail (in
the RDMSR case without updating EAX and EDX). Make the "AMD MSRs on
Intel" case match the "Intel MSR on AMD" one.

Signed-off-by: Jan Beulich 

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2909,8 +2909,8 @@ static int emulate_privileged_op(struct
 
 if ( vpmu_do_wrmsr(regs->ecx, msr_content, 0) )
 goto fail;
+break;
 }
-break;
 }
 /*FALLTHROUGH*/
 
@@ -3045,8 +3045,8 @@ static int emulate_privileged_op(struct
 
 regs->eax = (uint32_t)val;
 regs->edx = (uint32_t)(val >> 32);
+break;
 }
-break;
 }
 /*FALLTHROUGH*/
 



x86/PV: make PMU MSR handling consistent

So far accesses to Intel MSRs on an AMD system fall through to the
default case, while accesses to AMD MSRs on an Intel system bail (in
the RDMSR case without updating EAX and EDX). Make the "AMD MSRs on
Intel" case match the "Intel MSR on AMD" one.

Signed-off-by: Jan Beulich 

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2909,8 +2909,8 @@ static int emulate_privileged_op(struct
 
 if ( vpmu_do_wrmsr(regs->ecx, msr_content, 0) )
 goto fail;
+break;
 }
-break;
 }
 /*FALLTHROUGH*/
 
@@ -3045,8 +3045,8 @@ static int emulate_privileged_op(struct
 
 regs->eax = (uint32_t)val;
 regs->edx = (uint32_t)(val >> 32);
+break;
 }
-break;
 }
 /*FALLTHROUGH*/
 
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] linux-4.7.* under xen-4.6.* gives "unhandled page fault (ec=0000)" at boot. -- Root cause found.

2016-08-29 Thread Håkon Alstadheim
Den 29. aug. 2016 13:04, skrev Jan Beulich:
 On 29.08.16 at 01:14,  wrote:
> Den 17. aug. 2016 21:56, I wrote (to xen-users, as I am no developer):
>>> I'm on gentoo, running gentoo-sources kernel for dom0.
>>>
>>> I am unable to run gentoo-sources-4.7.{0,1}. I'm running under xen,
>>> currently at 4.6.3-r1
>> I am now on linux gentoo-sources-4.7.2, and the bug is stil present.
>>
>> I have done some digging on my own, and found that protecting two instances 
>> of " for_each_efi_memory_desc(md) {" with something like "if( efi.memmap.map 
>> != NULL) {" will allow my dom0 to boot and run.
> Which is basically the equivalent of e.g.
>
> http://lkml.iu.edu/hypermail/linux/kernel/1608.2/03448.html
>
> (this first one that a quick search found)
Thanks :-) . I only googled my problem, not my  half-assed solution.
> My line-numbers may be a bit off due to copious use of pr_info.
>
> The locations are:
> - linux/arch/x86/platform/efi/efi.c line 121 in function efi_find_mirror()
> - /usr/src/linux/arch/x86/platform/efi/quirks.c line 253 in function
> efi_free_boot_services(void)
>
> Searching the web lead me first to a solution which I believe to be
> wrong, changing the comparison operator in for_each_efi_memory_desc. It
> also lead me to someone mentioning that efi.memmap.map is not used when
> running under xen. That info may also be bogus for all I know.
>
> Not sure which part the "bogus" here is meant to apply to: Do you
> mean the statement is bogus (in which case I wonder why), or do
> you mean the data pointed to would be bogus (in which case I
> wonder what data you think about when the pointer is NULL)?
I just mean that I found something on the net and forgot where it came
from, and it should not be taken for truth without independent
verification, i.e. my "solution" might just be nonsense. I'll shut up
now :-) , and go back to lurking.




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


Re: [Xen-devel] [PATCH RFC] tools/libxc, xen/x86: Added xc_set_mem_access_sparse()

2016-08-29 Thread Razvan Cojocaru
On 08/26/2016 11:14 AM, Jan Beulich wrote:
 On 26.08.16 at 09:40,  wrote:
>> On 08/26/16 10:18, Jan Beulich wrote:
>> On 26.08.16 at 08:11,  wrote:
 --- a/xen/common/compat/memory.c
 +++ b/xen/common/compat/memory.c
 @@ -15,7 +15,6 @@ CHECK_TYPE(domid);
  #undef compat_domid_t
  #undef xen_domid_t
  
 -CHECK_mem_access_op;
  CHECK_vmemrange;
>>>
>>> You can't just delete this line. Some form of replacement is needed:
>>> Either you need to introduce compat mode translation, or you need
>>> to keep the line and suitably adjust the interface structure (which
>>> might be possible considering there's a [tools interface only] use of
>>> uint64_aligned_t already).
>>
>> I'll look into this. I'm not sure how to go about introducing compat
>> mode translation, could you please tell me where to look for an example
>> of doing that? Thanks!
> 
> Well, the first option to consider should be avoiding translation (and
> hence keeping the check macro invocation in place), the more that
> this is a tools only interface (you're certainly aware that e.g domctl
> and sysctl also avoid translation). Examples of translation can be
> found (you could have guessed that) in xen/common/compat/memory.c.
> 
 @@ -76,6 +76,17 @@ int mem_access_memop(unsigned long cmd,
  }
  break;
  
 +case XENMEM_access_op_set_access_sparse:
 +{
 +xen_pfn_t *arr = xmalloc_bytes(sizeof(xen_pfn_t) * mao.nr);
 +
 +// copy_from_guest(arr, mao.pfn_list, mao.nr);
>>>
>>> What is this (wrongly C++ style) comment about? I think this really
>>> wasn't meant to be a comment, so RFC or not - how do things work
>>> with this commented out? And where is the error checking for the
>>> allocation (which btw should be xmalloc_array(), but the need for
>>> an allocation here is questionable - the called function would better
>>> retrieve the GFNs one by one).
>>
>> They don't work, I forgot that comment in (the line should not have been
>> commented). I first wrote the patch on Xen 4.6 and there there was no
>> CHECK_mem_access_op, so I was just trying to figure out what went wrong
>> when I first saw the compile errors and tried this, then left it in
>> accidentally.
>>
>> Indeed, there should also be a check for allocation failure.
>>
>> Do you mean that I would do better to just copy_from_guest(,
>> mao.pfn_list + index, 1) in a for loop that sets mem_access restrictions?
> 
> Yes, albeit it is copy_from_guest_offset(, mao.pfn_list, index, 1).

Avoiding translation, to the best of my understanding (and tested with
the latest version of the patch I'm working on) would then require
replacing copy_from_guest() with copy_from_user(), which does not have a
copy_from_user_offset() alternative. Would keeping the dynamic GFNs
buffer allocation be acceptable in this case?


Thanks,
Razvan

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


[Xen-devel] [PATCH] xenbus: Use proc_create_mount_point() to create /proc/xen

2016-08-29 Thread Seth Forshee
Mounting proc in user namespace containers fails if the xenbus
filesystem is mounted on /proc/xen because this directory fails
the "permanently empty" test. proc_create_mount_point() exists
specifically to create such mountpoints in proc but is currently
proc-internal. Export this interface to modules, then use it in
xenbus when creating /proc/xen.

Signed-off-by: Seth Forshee 
---
 drivers/xen/xenbus/xenbus_probe.c | 2 +-
 fs/proc/generic.c | 1 +
 fs/proc/internal.h| 1 -
 include/linux/proc_fs.h   | 2 ++
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c 
b/drivers/xen/xenbus/xenbus_probe.c
index 33a31cfef55d..b5c1dec4a7c2 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -826,7 +826,7 @@ static int __init xenbus_init(void)
 * Create xenfs mountpoint in /proc for compatibility with
 * utilities that expect to find "xenbus" under "/proc/xen".
 */
-   proc_mkdir("xen", NULL);
+   proc_create_mount_point("xen");
 #endif
 
 out_error:
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index c633476616e0..be014c544d50 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -477,6 +477,7 @@ struct proc_dir_entry *proc_create_mount_point(const char 
*name)
}
return ent;
 }
+EXPORT_SYMBOL(proc_create_mount_point);
 
 struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
struct proc_dir_entry *parent,
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 7931c558c192..ff7259559d70 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -195,7 +195,6 @@ static inline bool is_empty_pde(const struct proc_dir_entry 
*pde)
 {
return S_ISDIR(pde->mode) && !pde->proc_iops;
 }
-struct proc_dir_entry *proc_create_mount_point(const char *name);
 
 /*
  * inode.c
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index b97bf2ef996e..8bd2f726436a 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -21,6 +21,7 @@ extern struct proc_dir_entry *proc_mkdir_data(const char *, 
umode_t,
  struct proc_dir_entry *, void *);
 extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t,
  struct proc_dir_entry *);
+struct proc_dir_entry *proc_create_mount_point(const char *name);
  
 extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
   struct proc_dir_entry *,
@@ -56,6 +57,7 @@ static inline struct proc_dir_entry *proc_symlink(const char 
*name,
struct proc_dir_entry *parent,const char *dest) { return NULL;}
 static inline struct proc_dir_entry *proc_mkdir(const char *name,
struct proc_dir_entry *parent) {return NULL;}
+static inline struct proc_dir_entry *proc_create_mount_point(const char *name) 
{ return NULL; }
 static inline struct proc_dir_entry *proc_mkdir_data(const char *name,
umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; 
}
 static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
-- 
2.7.4


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


Re: [Xen-devel] linux-4.7.* under xen-4.6.* gives "unhandled page fault (ec=0000)" at boot. -- Root cause found.

2016-08-29 Thread Jan Beulich
>>> On 29.08.16 at 16:26,  wrote:
> On Mon, Aug 29, 2016 at 05:04:05AM -0600, Jan Beulich wrote:
>> >>> On 29.08.16 at 01:14,  wrote:
>> 
>> First of all - please don't cross post.
>> 
>> > Den 17. aug. 2016 21:56, I wrote (to xen-users, as I am no developer):
>> >> I'm on gentoo, running gentoo-sources kernel for dom0.
>> >>
>> >> I am unable to run gentoo-sources-4.7.{0,1}. I'm running under xen,
>> >> currently at 4.6.3-r1
>> > 
>> > I am now on linux gentoo-sources-4.7.2, and the bug is stil present.
>> > 
>> > I have done some digging on my own, and found that protecting two 
>> > instances 
> 
>> > of " for_each_efi_memory_desc(md) {" with something like "if( 
> efi.memmap.map 
>> > != NULL) {" will allow my dom0 to boot and run.
>> 
>> Which is basically the equivalent of e.g.
>> 
>> http://lkml.iu.edu/hypermail/linux/kernel/1608.2/03448.html 
> 
> It does not look like it was ever applied?

Afaik it's on its (admittedly slow) way to Linus.

Jan


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


Re: [Xen-devel] [PATCH] xen/HVM: Add guarding logic for VMX specific code

2016-08-29 Thread Konrad Rzeszutek Wilk
On Mon, Aug 29, 2016 at 07:01:23AM -0500, Suravee Suthikulpanit wrote:
> The struct hvm_domain.vmx is defined in a union along with the svm.
> This can causes issue for SVM since this code is used in the common

You scared me with the 'can causes'!

Digging in the pahole output - it It can't cause any issues right now
as the 'struct svm_domain' is zero size (so no AMD code making changes)
so the value at offset 16 is always zero (alloc_domain_struct clears it).

> scheduling code for x86. The logic must check for cpu_has_vmx before
> accessing the hvm_domain.vmx sturcture.

structure.

> 
> Signed-off-by: Suravee Suthikulpanit 

Reviewed-by: Konrad Rzeszutek Wilk 

> Cc: Wei Liu 
> Cc: Jan Beulich 
> ---
> Note: I ran into an issue while working on the upcoming patch series for
> AMD Advance Virtual Interrupt Controller patch series, which will use
> the hvm_domain.svm structure.
> 
>  xen/include/asm-x86/hvm/hvm.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
> index 314881a..5d463e0 100644
> --- a/xen/include/asm-x86/hvm/hvm.h
> +++ b/xen/include/asm-x86/hvm/hvm.h
> @@ -611,7 +611,7 @@ unsigned long hvm_cr4_guest_reserved_bits(const struct 
> vcpu *v, bool_t restore);
>  struct vcpu *v_ = (v);  \
>  struct domain *d_ = v_->domain; \
>  if ( has_hvm_container_domain(d_) &&\
> - d_->arch.hvm_domain.vmx.vcpu_block )   \
> + (cpu_has_vmx && d_->arch.hvm_domain.vmx.vcpu_block) )  \
>  d_->arch.hvm_domain.vmx.vcpu_block(v_); \
>  })
>  
> -- 
> 1.9.1
> 
> 
> ___
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel

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


[Xen-devel] [PATCH v2 0/2] mini-os: repair stubdom build

2016-08-29 Thread Juergen Gross
The patch series adding HVMlite support for Mini-OS unfortunately
broke building Xen's stubdoms. This small series repairs the broken
bits again.

V2: patch 1: remove CONFIG_KEEP_STARTINFO

Juergen Gross (2):
  mini-os: partially revert "remove using start_info ..."
  mini-os: don't get xenbus parameters if xenbus is disabled

 arch/x86/setup.c | 12 
 include/hypervisor.h | 13 -
 include/xenbus.h |  5 -
 3 files changed, 28 insertions(+), 2 deletions(-)

-- 
2.6.6


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


Re: [Xen-devel] linux-4.7.* under xen-4.6.* gives "unhandled page fault (ec=0000)" at boot. -- Root cause found.

2016-08-29 Thread Konrad Rzeszutek Wilk
On Mon, Aug 29, 2016 at 05:04:05AM -0600, Jan Beulich wrote:
> >>> On 29.08.16 at 01:14,  wrote:
> 
> First of all - please don't cross post.
> 
> > Den 17. aug. 2016 21:56, I wrote (to xen-users, as I am no developer):
> >> I'm on gentoo, running gentoo-sources kernel for dom0.
> >>
> >> I am unable to run gentoo-sources-4.7.{0,1}. I'm running under xen,
> >> currently at 4.6.3-r1
> > 
> > I am now on linux gentoo-sources-4.7.2, and the bug is stil present.
> > 
> > I have done some digging on my own, and found that protecting two instances 
> > of " for_each_efi_memory_desc(md) {" with something like "if( 
> > efi.memmap.map 
> > != NULL) {" will allow my dom0 to boot and run.
> 
> Which is basically the equivalent of e.g.
> 
> http://lkml.iu.edu/hypermail/linux/kernel/1608.2/03448.html

It does not look like it was ever applied?

> 
> (this first one that a quick search found)
> 
> > My line-numbers may be a bit off due to copious use of pr_info.
> > 
> > The locations are:
> > - linux/arch/x86/platform/efi/efi.c line 121 in function efi_find_mirror()
> > - /usr/src/linux/arch/x86/platform/efi/quirks.c line 253 in function
> > efi_free_boot_services(void)
> > 
> > Searching the web lead me first to a solution which I believe to be
> > wrong, changing the comparison operator in for_each_efi_memory_desc. It
> > also lead me to someone mentioning that efi.memmap.map is not used when
> > running under xen. That info may also be bogus for all I know.
> 
> Not sure which part the "bogus" here is meant to apply to: Do you
> mean the statement is bogus (in which case I wonder why), or do
> you mean the data pointed to would be bogus (in which case I
> wonder what data you think about when the pointer is NULL)?
> 
> Jan
> 
> 
> ___
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel

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


[Xen-devel] [PATCH v2 2/2] mini-os: don't get xenbus parameters if xenbus is disabled

2016-08-29 Thread Juergen Gross
get_xenbus() should be called only if CONFIG_XENBUS is set.

Signed-off-by: Juergen Gross 
---
 include/xenbus.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/xenbus.h b/include/xenbus.h
index 5646a25..c254652 100644
--- a/include/xenbus.h
+++ b/include/xenbus.h
@@ -9,10 +9,14 @@ typedef unsigned long xenbus_transaction_t;
 #ifdef CONFIG_XENBUS
 /* Initialize the XenBus system. */
 void init_xenbus(void);
+void get_xenbus(void *p);
 #else
 static inline void init_xenbus(void)
 {
 }
+static inline void get_xenbus(void *p)
+{
+}
 #endif
 
 /* Read the value associated with a path.  Returns a malloc'd error
@@ -31,7 +35,6 @@ typedef struct xenbus_event *xenbus_event_queue;
 
 extern uint32_t xenbus_evtchn;
 
-void get_xenbus(void *p);
 char *xenbus_watch_path_token(xenbus_transaction_t xbt, const char *path, 
const char *token, xenbus_event_queue *events);
 char *xenbus_unwatch_path_token(xenbus_transaction_t xbt, const char *path, 
const char *token);
 extern struct wait_queue_head xenbus_watch_queue;
-- 
2.6.6


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


[Xen-devel] [PATCH v2 1/2] mini-os: partially revert "remove using start_info ..."

2016-08-29 Thread Juergen Gross
Commit e33452c4f5547ed14defe6382b3b53664ac5bd8a ("remove using
start_info in architecture independent code") removed the start_info
variable completely. grub stubdom needs the start_info structure.

Readd the start_info structure, but make it dependent on
CONFIG_PARAVIRT.

Signed-off-by: Juergen Gross 
---
 arch/x86/setup.c | 12 
 include/hypervisor.h | 13 -
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/x86/setup.c b/arch/x86/setup.c
index 86955cf..5278227 100644
--- a/arch/x86/setup.c
+++ b/arch/x86/setup.c
@@ -33,6 +33,14 @@
 #include 
 #include 
 
+#ifdef CONFIG_PARAVIRT
+/*
+ * This structure contains start-of-day info, such as pagetable base pointer,
+ * address of the shared_info structure, and things like that.
+ */
+union start_info_union start_info_union;
+#endif
+
 /*
  * Shared page for communicating with the hypervisor.
  * Events flags go here, for example.
@@ -189,6 +197,10 @@ arch_init(void *par)
/* print out some useful information  */
print_start_of_day(par);
 
+#ifdef CONFIG_PARAVIRT
+   memcpy(_info, par, sizeof(start_info));
+#endif
+
start_kernel();
 }
 
diff --git a/include/hypervisor.h b/include/hypervisor.h
index 3073a8a..f3b1f3c 100644
--- a/include/hypervisor.h
+++ b/include/hypervisor.h
@@ -27,7 +27,18 @@
 #include 
 
 /* hypervisor.c */
-#ifndef CONFIG_PARAVIRT
+#ifdef CONFIG_PARAVIRT
+/*
+ * a placeholder for the start of day information passed up from the hypervisor
+ */
+union start_info_union
+{
+start_info_t start_info;
+char padding[512];
+};
+extern union start_info_union start_info_union;
+#define start_info (start_info_union.start_info)
+#else
 int hvm_get_parameter(int idx, uint64_t *value);
 int hvm_set_parameter(int idx, uint64_t value);
 #endif
-- 
2.6.6


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


Re: [Xen-devel] [PATCH] stubdom: add CONFIG_KEEP_STARTINFO for stubdoms which reference start_info

2016-08-29 Thread Juergen Gross
On 29/08/16 13:01, Juergen Gross wrote:
> grub-stubdom and ioemu-stubdom rely on Mini-OS exporting the start_info
> structure via a global variable. To use this feature in future we must
> specify CONFIG_KEEP_STARTINFO in the Mini-OS config file.
> 
> Signed-off-by: Juergen Gross 

Please ignore: start_info in Mini-OS will depend on CONFIG_PARAVIRT
only.


Juergen

> ---
>  stubdom/grub/minios.cfg  | 1 +
>  stubdom/ioemu-minios.cfg | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/stubdom/grub/minios.cfg b/stubdom/grub/minios.cfg
> index 8df4909..0e81f0a 100644
> --- a/stubdom/grub/minios.cfg
> +++ b/stubdom/grub/minios.cfg
> @@ -1,3 +1,4 @@
>  CONFIG_START_NETWORK=n
>  CONFIG_SPARSE_BSS=n
>  CONFIG_TPMFRONT=y
> +CONFIG_KEEP_STARTINFO=y
> diff --git a/stubdom/ioemu-minios.cfg b/stubdom/ioemu-minios.cfg
> index d690553..9e9ea99 100644
> --- a/stubdom/ioemu-minios.cfg
> +++ b/stubdom/ioemu-minios.cfg
> @@ -1,3 +1,4 @@
>  CONFIG_START_NETWORK=n
>  CONFIG_QEMU_XS_ARGS=y
>  CONFIG_PCIFRONT=y
> +CONFIG_KEEP_STARTINFO=y
> 


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


[Xen-devel] [distros-debian-sid test] 67603: tolerable FAIL

2016-08-29 Thread Platform Team regression test user
flight 67603 distros-debian-sid real [real]
http://osstest.xs.citrite.net/~osstest/testlogs/logs/67603/

Failures :-/ but no regressions.

Regressions which are regarded as allowable (not blocking):
 test-amd64-i386-amd64-sid-netboot-pygrub  9 debian-di-install  fail like 67575
 test-amd64-i386-i386-sid-netboot-pvgrub  9 debian-di-install   fail like 67575
 test-amd64-amd64-i386-sid-netboot-pygrub  9 debian-di-install  fail like 67575
 test-armhf-armhf-armhf-sid-netboot-pygrub  9 debian-di-install fail like 67575
 test-amd64-amd64-amd64-sid-netboot-pvgrub  9 debian-di-install fail like 67575

baseline version:
 flight   67575

jobs:
 build-amd64  pass
 build-armhf  pass
 build-i386   pass
 build-amd64-pvopspass
 build-armhf-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-amd64-sid-netboot-pvgrubfail
 test-amd64-i386-i386-sid-netboot-pvgrub  fail
 test-amd64-i386-amd64-sid-netboot-pygrub fail
 test-armhf-armhf-armhf-sid-netboot-pygrubfail
 test-amd64-amd64-i386-sid-netboot-pygrub fail



sg-report-flight on osstest.xs.citrite.net
logs: /home/osstest/logs
images: /home/osstest/images

Logs, config files, etc. are available at
http://osstest.xs.citrite.net/~osstest/testlogs/logs

Test harness code can be found at
http://xenbits.xensource.com/gitweb?p=osstest.git;a=summary


Push not applicable.


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


Re: [Xen-devel] [PATCH v4 14/16] kprobes: move kprobe declarations to asm-generic/kprobes.h

2016-08-29 Thread Masami Hiramatsu
On Tue, 23 Aug 2016 18:31:05 +0200
"Luis R. Rodriguez"  wrote:

> On Tue, Aug 23, 2016 at 12:11:40AM +0900, Masami Hiramatsu wrote:
> > On Fri, 19 Aug 2016 14:34:12 -0700
> > mcg...@kernel.org wrote:
> > 
> > > From: "Luis R. Rodriguez" 
> > > 
> > > Often all is needed is these small helpers, instead of compiler.h
> > > or a full kprobes.h. This is important for asm helpers, in fact even
> > > some asm/kprobes.h make use of these helpers... instead just keep a
> > > generic asm file with helpers useful for asm code with the least amount
> > > of clutter as possible.
> > > 
> > > Likewise we need now to also address what to do about this file for both
> > > when architectures have CONFIG_HAVE_KPROBES, and when they do not. Then
> > > for when architectures have CONFIG_HAVE_KPROBES but have disabled
> > > CONFIG_KPROBES.
> > > 
> > > Right now most asm/kprobes.h do not have guards against CONFIG_KPROBES,
> > > this means most architecture code cannot include asm/kprobes.h safely.
> > > Correct this and add guards for architectures missing them. Additionally
> > > provide architectures that not have kprobes support with the default
> > > asm-generic solution. This lets us force asm/kprobes.h on the header
> > > include/linux/kprobes.h always, but most importantly we can now safely
> > > include just asm/kprobes.h on architecture code without bringing
> > > the full kitchen sink of header files.
> > > 
> > > Two architectures already provided a guard against CONFIG_KPROBES on
> > > its kprobes.h: sh, arch. The rest of the architectures needed gaurds
> > > added. We avoid including any not-needed headers on asm/kprobes.h
> > > unless kprobes have been enabled.
> > > 
> > > In a subsequent atomic change we can try now to remove compiler.h from
> > > include/linux/kprobes.h.
> > 
> > Hmm, this looks a bit overkill... I rather like move it into linux/table.h.
> 
> That's the thing, we can't reasonably expect every table to add an entry into
> table.h, this should be up to each user. Moving it to tables.h just prolongs
> what needs to be done. In this case the change is justifiable given kprobe
> annotations are required for some architectures early in architecture code, 
> and
> including compiler.h on early architecture code blows up. There is no easy fix
> to this, and this this was *actually* the cleanest solution I could devise
> without much changes.

Aah, I misread your patch, it is asm-generic/kprobes.h, not asm/kprobes.h.
I think it is OK now.

Acked-by: Masami Hiramatsu 

Thanks!

> 
>   Luis


-- 
Masami Hiramatsu 

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


[Xen-devel] Ping: [PATCH] replace bogus -ENOSYS uses

2016-08-29 Thread Jan Beulich
>>> On 09.08.16 at 12:40,  wrote:
> This doesn't cover all of them, just the ones that I think would most
> obviously better be -EINVAL or -EOPNOTSUPP.

Ping? There was a little bit of feedback, but non that really resulted in
a need to change something (so far at least).

Jan

> Signed-off-by: Jan Beulich 
> 
> --- a/xen/arch/x86/cpu/mcheck/vmce.c
> +++ b/xen/arch/x86/cpu/mcheck/vmce.c
> @@ -440,7 +440,7 @@ int unmmap_broken_page(struct domain *d,
>  return -EINVAL;
>  
>  if ( !has_hvm_container_domain(d) || !paging_mode_hap(d) )
> -return -ENOSYS;
> +return -EOPNOTSUPP;
>  
>  rc = -1;
>  r_mfn = get_gfn_query(d, gfn, );
> --- a/xen/arch/x86/cpu/mtrr/main.c
> +++ b/xen/arch/x86/cpu/mtrr/main.c
> @@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
>   if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
>   printk(KERN_WARNING
>  "mtrr: your processor doesn't support 
> write-combining\n");
> - return -ENOSYS;
> + return -EOPNOTSUPP;
>   }
>  
>   if (!size) {
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -5592,7 +5592,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
>  break;
>  
>  case HVMOP_flush_tlbs:
> -rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -ENOSYS;
> +rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -EINVAL;
>  break;
>  
>  case HVMOP_track_dirty_vram:
> @@ -5832,7 +5832,7 @@ int hvm_debug_op(struct vcpu *v, int32_t
>  {
>  case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON:
>  case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF:
> -rc = -ENOSYS;
> +rc = -EOPNOTSUPP;
>  if ( !cpu_has_monitor_trap_flag )
>  break;
>  rc = 0;
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -3565,7 +3565,7 @@ long do_mmuext_op(
>  if ( !opt_allow_superpage )
>  {
>  MEM_LOG("Superpages disallowed");
> -rc = -ENOSYS;
> +rc = -EOPNOTSUPP;
>  }
>  else if ( unlikely(d != pg_owner) )
>  rc = -EPERM;
> --- a/xen/common/compat/memory.c
> +++ b/xen/common/compat/memory.c
> @@ -353,7 +353,7 @@ int compat_memory_op(unsigned int cmd, X
>  struct get_reserved_device_memory grdm;
>  
>  if ( unlikely(start_extent) )
> -return -ENOSYS;
> +return -EINVAL;
>  
>  if ( copy_from_guest(, compat, 1) ||
>   !compat_handle_okay(grdm.map.buffer, grdm.map.nr_entries) 
> )
> --- a/xen/common/event_fifo.c
> +++ b/xen/common/event_fifo.c
> @@ -621,7 +621,7 @@ int evtchn_fifo_expand_array(const struc
>  int rc;
>  
>  if ( !d->evtchn_fifo )
> -return -ENOSYS;
> +return -EOPNOTSUPP;
>  
>  spin_lock(>event_lock);
>  rc = add_page_to_event_array(d, expand_array->array_gfn);
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -3025,7 +3025,7 @@ do_grant_table_op(
>  return -EINVAL;
>  
>  if ( (cmd &= GNTTABOP_CMD_MASK) != GNTTABOP_cache_flush && opaque_in )
> -return -ENOSYS;
> +return -EINVAL;
>  
>  rc = -EFAULT;
>  switch ( cmd )
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -937,14 +937,14 @@ long do_memory_op(unsigned long cmd, XEN
>  
>  case XENMEM_exchange:
>  if ( unlikely(start_extent) )
> -return -ENOSYS;
> +return -EINVAL;
>  
>  rc = memory_exchange(guest_handle_cast(arg, 
> xen_memory_exchange_t));
>  break;
>  
>  case XENMEM_maximum_ram_page:
>  if ( unlikely(start_extent) )
> -return -ENOSYS;
> +return -EINVAL;
>  
>  rc = max_page;
>  break;
> @@ -953,7 +953,7 @@ long do_memory_op(unsigned long cmd, XEN
>  case XENMEM_maximum_reservation:
>  case XENMEM_maximum_gpfn:
>  if ( unlikely(start_extent) )
> -return -ENOSYS;
> +return -EINVAL;
>  
>  if ( copy_from_guest(, arg, 1) )
>  return -EFAULT;
> @@ -1077,7 +1077,7 @@ long do_memory_op(unsigned long cmd, XEN
>  struct page_info *page;
>  
>  if ( unlikely(start_extent) )
> -return -ENOSYS;
> +return -EINVAL;
>  
>  if ( copy_from_guest(, arg, 1) )
>  return -EFAULT;
> @@ -1114,7 +1114,7 @@ long do_memory_op(unsigned long cmd, XEN
>  
>  case XENMEM_claim_pages:
>  if ( unlikely(start_extent) )
> -return -ENOSYS;
> +return -EINVAL;
>  
>  if ( copy_from_guest(, arg, 1) )
>  return -EFAULT;
> @@ -1148,7 +1148,7 @@ long do_memory_op(unsigned long cmd, XEN
>  struct vnuma_info tmp;
>  
>  if ( unlikely(start_extent) )
> -return -ENOSYS;
> +return -EINVAL;
>  
> 

[Xen-devel] [PATCH RFC] x86/32on64: don't modify guest descriptors without need

2016-08-29 Thread Jan Beulich
There are two cases: The obvious one is that system gates with type 0
shouldn't have what might be their DPL altered - such descriptors can't
be used anyway without incurring a #GP, and hence adjusting its DPL is
only risking to confuse the guest.

The less obvious (and potentially controversial) part is that of a call
gate with DPL < selector.RPL: Such gates can't be used either without
the hardware raising #GP, but the specific case of DPL=0 gets handled
in emulate_gate_op(). The purpose of the change is to avoid adjusting
a gate a second time when it did get adjusted already here, on the
assumption that guest OSes wouldn't normally install unusable gates
(i.e. we'd normally see DPL >= selector.RPL) and still have a way of
installing an unusable gate (by specifying a non-zero DPL right away).

Aforementioned second time adjustments of gates are a problem for
environments where
- per-CPU GDTs get cloned from the boot CPU's after the boot CPU had
  already installed its GDT (e.g. Linux),
- individual descriptors get installed via hypercall prior to actually
  making the respective page a descriptor one (this could alternatively
  be taken care of by making do_update_descriptor() call
  check_descriptor() only when modifying a PGT_seg_desc page),
i.e. the hypervisor gets presented an already adjusted descriptor a
second time.

Signed-off-by: Jan Beulich 
---
RFC reason: As mentioned above the change in behavior here might be
controversial. The main question here appears to be whether
this is viewed as having the potential for undermining
guest OS security.

--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -1085,12 +1085,11 @@ int check_descriptor(const struct domain
 
 /* A not-present descriptor will always fault, so is safe. */
 if ( !(b & _SEGMENT_P) ) 
-goto good;
+return 1;
 
 /* Check and fix up the DPL. */
 dpl = (b >> 13) & 3;
 __fixup_guest_selector(dom, dpl);
-b = (b & ~_SEGMENT_DPL) | (dpl << 13);
 
 /* All code and data segments are okay. No base/limit checking. */
 if ( (b & _SEGMENT_S) )
@@ -1127,14 +1126,23 @@ int check_descriptor(const struct domain
 
 /* Invalid type 0 is harmless. It is used for 2nd half of a call gate. */
 if ( (b & _SEGMENT_TYPE) == 0x000 )
-goto good;
+return 1;
 
 /* Everything but a call gate is discarded here. */
 if ( (b & _SEGMENT_TYPE) != 0xc00 )
 goto bad;
 
-/* Validate the target code selector. */
+/*
+ * The gate's DPL being less than the gate selector's RPL is harmless too,
+ * as any access to such a gate will cause #GP. This in particular avoids
+ * modifying (see below) a gate a second time after it had its DPL forced
+ * to zero for emulation.
+ */
 cs = a >> 16;
+if ( ((b >> 13) & 3) < (cs & 3) )
+return 1;
+
+/* Validate the target code selector. */
 if ( !guest_gate_selector_okay(dom, cs) )
 goto bad;
 /*
@@ -1147,8 +1155,8 @@ int check_descriptor(const struct domain
  * there are only 64-bit ones.
  * Store the original DPL in the selector's RPL field.
  */
-b &= ~_SEGMENT_DPL;
 cs = (cs & ~3) | dpl;
+dpl = 0;
 a = (a & 0xU) | (cs << 16);
 
 /* Reserved bits must be zero. */
@@ -1157,7 +1165,7 @@ int check_descriptor(const struct domain
 
  good:
 d->a = a;
-d->b = b;
+d->b = (b & ~_SEGMENT_DPL) | (dpl << 13);
 return 1;
  bad:
 return 0;



x86/32on64: don't modify guest descriptors without need

There are two cases: The obvious one is that system gates with type 0
shouldn't have what might be their DPL altered - such descriptors can't
be used anyway without incurring a #GP, and hence adjusting its DPL is
only risking to confuse the guest.

The less obvious (and potentially controversial) part is that of a call
gate with DPL < selector.RPL: Such gates can't be used either without
the hardware raising #GP, but the specific case of DPL=0 gets handled
in emulate_gate_op(). The purpose of the change is to avoid adjusting
a gate a second time when it did get adjusted already here, on the
assumption that guest OSes wouldn't normally install unusable gates
(i.e. we'd normally see DPL >= selector.RPL) and still have a way of
installing an unusable gate (by specifying a non-zero DPL right away).

Aforementioned second time adjustments of gates are a problem for
environments where
- per-CPU GDTs get cloned from the boot CPU's after the boot CPU had
  already installed its GDT (e.g. Linux),
- individual descriptors get installed via hypercall prior to actually
  making the respective page a descriptor one (this could alternatively
  be taken care of by making do_update_descriptor() call
  check_descriptor() only when modifying a PGT_seg_desc page),
i.e. the hypervisor gets presented an already adjusted descriptor a
second time.

Signed-off-by: Jan Beulich 
---

[Xen-devel] [PATCH] x86/32on64: misc adjustments to call gate emulation

2016-08-29 Thread Jan Beulich
- There's no 32-bit displacement in 16-bit addressing mode.
- It is wrong to ASSERT() anything on parts of an instruction fetched
  from guest memory.
- The two scaling bits of a SIB byte don't affect whether there is no
  scaled index register.

Signed-off-by: Jan Beulich 

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -3214,7 +3214,7 @@ static void emulate_gate_op(struct cpu_u
 sib = insn_fetch(u8, base, eip, limit);
 
 modrm = (modrm & ~7) | (sib & 7);
-if ( (sib >>= 3) != 4 )
+if ( ((sib >>= 3) & 7) != 4 )
 opnd_off = *(unsigned long *)
 decode_register(sib & 7, regs, 0);
 opnd_off <<= sib >> 3;
@@ -3274,7 +3274,10 @@ static void emulate_gate_op(struct cpu_u
 opnd_off += insn_fetch(s8, base, eip, limit);
 break;
 case 0x80:
-opnd_off += insn_fetch(s32, base, eip, limit);
+if ( ad_bytes > 2 )
+opnd_off += insn_fetch(s32, base, eip, limit);
+else
+opnd_off += insn_fetch(s16, base, eip, limit);
 break;
 }
 if ( ad_bytes == 4 )
@@ -3311,8 +3314,7 @@ static void emulate_gate_op(struct cpu_u
 #define ad_default ad_bytes
 opnd_sel = insn_fetch(u16, base, opnd_off, limit);
 #undef ad_default
-ASSERT((opnd_sel & ~3) == regs->error_code);
-if ( dpl < (opnd_sel & 3) )
+if ( (opnd_sel & ~3) != regs->error_code || dpl < (opnd_sel & 3) )
 {
 do_guest_trap(TRAP_gp_fault, regs);
 return;



x86/32on64: misc adjustments to call gate emulation

- There's no 32-bit displacement in 16-bit addressing mode.
- It is wrong to ASSERT() anything on parts of an instruction fetched
  from guest memory.
- The two scaling bits of a SIB byte don't affect whether there is no
  scaled index register.

Signed-off-by: Jan Beulich 

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -3214,7 +3214,7 @@ static void emulate_gate_op(struct cpu_u
 sib = insn_fetch(u8, base, eip, limit);
 
 modrm = (modrm & ~7) | (sib & 7);
-if ( (sib >>= 3) != 4 )
+if ( ((sib >>= 3) & 7) != 4 )
 opnd_off = *(unsigned long *)
 decode_register(sib & 7, regs, 0);
 opnd_off <<= sib >> 3;
@@ -3274,7 +3274,10 @@ static void emulate_gate_op(struct cpu_u
 opnd_off += insn_fetch(s8, base, eip, limit);
 break;
 case 0x80:
-opnd_off += insn_fetch(s32, base, eip, limit);
+if ( ad_bytes > 2 )
+opnd_off += insn_fetch(s32, base, eip, limit);
+else
+opnd_off += insn_fetch(s16, base, eip, limit);
 break;
 }
 if ( ad_bytes == 4 )
@@ -3311,8 +3314,7 @@ static void emulate_gate_op(struct cpu_u
 #define ad_default ad_bytes
 opnd_sel = insn_fetch(u16, base, opnd_off, limit);
 #undef ad_default
-ASSERT((opnd_sel & ~3) == regs->error_code);
-if ( dpl < (opnd_sel & 3) )
+if ( (opnd_sel & ~3) != regs->error_code || dpl < (opnd_sel & 3) )
 {
 do_guest_trap(TRAP_gp_fault, regs);
 return;
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [ovmf baseline-only test] 67604: all pass

2016-08-29 Thread Platform Team regression test user
This run is configured for baseline tests only.

flight 67604 ovmf real [real]
http://osstest.xs.citrite.net/~osstest/testlogs/logs/67604/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 37136e069dc0a0b8a47098d80d8f6f742db88c04
baseline version:
 ovmf 81d9f86f8a7106b59057e5b29490eb04e38483bd

Last test of basis67598  2016-08-26 19:19:33 Z2 days
Testing same since67604  2016-08-29 09:48:27 Z0 days1 attempts


People who touched revisions under test:
  Star Zeng 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.xs.citrite.net
logs: /home/osstest/logs
images: /home/osstest/images

Logs, config files, etc. are available at
http://osstest.xs.citrite.net/~osstest/testlogs/logs

Test harness code can be found at
http://xenbits.xensource.com/gitweb?p=osstest.git;a=summary


Push not applicable.


commit 37136e069dc0a0b8a47098d80d8f6f742db88c04
Author: Star Zeng 
Date:   Fri Aug 26 16:27:06 2016 +0800

IntelFrameworkModulePkg FwVolDxe: Return correct AuthStatus for FvReadFile

Inherit the authentication status from FV.

Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Chao Zhang 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
Reviewed-by: Jiewen Yao 
Reviewed by: Chao Zhang 

commit 2bc08e8cd64d2f2ab80f11abc63fc8291126626e
Author: Star Zeng 
Date:   Fri Aug 12 16:21:17 2016 +0800

MdeModulePkg DxeCore: Return correct AuthStatus for FvReadFile

Inherit the authentication status from FV.

Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Chao Zhang 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
Reviewed-by: Jiewen Yao 
Reviewed by: Chao Zhang 

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


[Xen-devel] Questions about Using Perf at Dom0

2016-08-29 Thread Sanghyun Hong
Dear Xen-Devel Community:

I’m a grad student working on measuring performance counters at the Xen 
domains. I read this 
thread(https://wiki.xenproject.org/wiki/Xen_Profiling:_oprofile_and_perf) in 
web, and it says using Linux perf command will let us collecting performance 
counters in both dom0 and domU. Does it mean that we can collect both of them 
at once if we run perf command on the dom0? (If not, does it mean we can 
collect counters for each domain separately once we run the perf command in 
each domain?

All the best,
Sanghyun.

-
Hong, Sanghyun (http://www.sanghyunhong.com/)
Ph.D. student in the Department of Computer Science,
University of Maryland - College Park, United States.
(M) (301) 771 - 1475
(E) shh...@umd.edu
-

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


Re: [Xen-devel] [Minios-devel] [PATCH 1/2] mini-os: support keeping start_info structure conditionally

2016-08-29 Thread Juergen Gross
On 29/08/16 14:32, Andrew Cooper wrote:
> On 29/08/2016 13:28, Juergen Gross wrote:
>> On 29/08/16 13:47, Andrew Cooper wrote:
>>> On 29/08/2016 12:17, Juergen Gross wrote:
 On 29/08/16 13:09, Wei Liu wrote:
> On Mon, Aug 29, 2016 at 01:01:08PM +0200, Juergen Gross wrote:
>> grub stubdom needs the start_info structure. Keep a copy of it in
>> pv mini-os if configured via "CONFIG_KEEP_STARTINFO". This should
>> default to "n" in order to have it enabled only when really needed.
>>
> I'm not sure I understand the rationale for this.
>
> Shouldn't start_info always be kept when mini-os is PV? Under what
> condition should it not be kept?
 The application on top of Mini-OS shouldn't depend on Mini-OS being
 paravirtualized or not in the "normal" case. grub-stubdom is a
 special case, as it needs to kexec to a loaded kernel which in turn
 needs the start_info, of course.

 ioemu-stubdom OTOH should not need start_info as it could work on
 a HVMlite Mini-OS, too.

 The idea of removing start_info in my HVMlite series was driven by
 that thought: any application using start_info should break as it
 clearly wouldn't be agnostic of the mode (pv or HVMlite) of Mini-OS.
 pv-grub was an oversight here.

 I'm planning to modify ioemu-stubdom in the future to not use
 start_info and then let it run in HVMlite mode, too.
>>> There is an issue here between MiniOS itself, and "the stubdom application".
>> Correct.
>>
>>> There should be no circumstance where the stubdom application needs
>>> access (pv-grub being a special case, but maybe the kexec details can be
>>> hidden as well).
>> Indeed. I'll have a look if this is possible. In case I find a clean
>> solution I'll send patches including one removing CONFIG_KEEP_STARTINFO
>> again.
>>
>>> However, while there is still relevant information in start_info, the
>>> low level PV bits should still have access.  Moreover, it is necessary
>>> to always have access when doing suspend/resume.
>> The information from start_info is available inside Mini-OS. So this
>> should be no problem.
> 
> I have never understood MiniOS's decision to memcpy() it elsewhere.  It
> is just a plain page of RAM set up by the domain builder; copying it
> elsewhere is just a waste of space.
> 
> OTOH, you must pass a pointer to it in the suspend() hypercall, so the
> resume logic can re-modify part of it.

Hmm, interesting detail. It took me some time to locate the code where
the start_info parameter of the suspend call is being used.

So the correct way to deal with start_info is to save the pointer to it
and mark this page as being in use.

I think I'll modify my patch to drop the new CONFIG parameter. Later
I'll modify ioemu to no longer rely on start_info and pv-grub if
possible, too. Then I can handle the start_info page the way it should
be done.


Juergen

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


Re: [Xen-devel] [MINIOS PATCH 3/3] gitignore: ignore files generated by various indexing software

2016-08-29 Thread Juergen Gross
On 29/08/16 15:01, Wei Liu wrote:
> Signed-off-by: Wei Liu 

Reviewed-by: Juergen Gross 

Juergen

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


Re: [Xen-devel] [MINIOS PATCH 2/3] Makefile: add gtags target

2016-08-29 Thread Juergen Gross
On 29/08/16 15:01, Wei Liu wrote:
> Use GNU Global to generate source code index.
> 
> Signed-off-by: Wei Liu 

Reviewed-by: Juergen Gross 

Juergen

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


Re: [Xen-devel] [MINIOS PATCH 1/3] Makefile: simplify all_sources macro

2016-08-29 Thread Juergen Gross
On 29/08/16 15:01, Wei Liu wrote:
> There is no SCCS file.
> 
> Signed-off-by: Wei Liu 

Reviewed-by: Juergen Gross 

Juergen

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


[Xen-devel] [MINIOS PATCH 0/3] Some miscellaneous patches

2016-08-29 Thread Wei Liu
Wei Liu (3):
  Makefile: simplify all_sources macro
  Makefile: add gtags target
  gitignore: ignore files generated by various indexing software

 .gitignore | 7 +++
 Makefile   | 6 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

-- 
2.1.4


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


[Xen-devel] [MINIOS PATCH 3/3] gitignore: ignore files generated by various indexing software

2016-08-29 Thread Wei Liu
Signed-off-by: Wei Liu 
---
 .gitignore | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/.gitignore b/.gitignore
index efc193c..e55133d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,13 @@
 *.o
 *.a
 *.swp
+cscope.*
+GPATH
+GRTAGS
+GTAGS
+TAGS
+tags
+
 arch/x86/minios-x86*.lds
 include/list.h
 mini-os
-- 
2.1.4


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


[Xen-devel] [MINIOS PATCH 1/3] Makefile: simplify all_sources macro

2016-08-29 Thread Wei Liu
There is no SCCS file.

Signed-off-by: Wei Liu 
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index b783684..a8ae67c 100644
--- a/Makefile
+++ b/Makefile
@@ -175,7 +175,7 @@ clean:  arch_clean
 
 
 define all_sources
- ( find . -name SCCS -prune -o -name '*.[chS]' -print )
+ ( find . -name '*.[chS]' -print )
 endef
 
 .PHONY: cscope
-- 
2.1.4


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


[Xen-devel] [MINIOS PATCH 2/3] Makefile: add gtags target

2016-08-29 Thread Wei Liu
Use GNU Global to generate source code index.

Signed-off-by: Wei Liu 
---
 Makefile | 4 
 1 file changed, 4 insertions(+)

diff --git a/Makefile b/Makefile
index a8ae67c..43dcbd6 100644
--- a/Makefile
+++ b/Makefile
@@ -190,3 +190,7 @@ tags:
 .PHONY: TAGS
 TAGS:
$(all_sources) | xargs etags
+
+.PHONY: gtags
+gtags:
+   $(all_sources) | gtags -f -
-- 
2.1.4


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


[Xen-devel] [linux-3.10 baseline-only test] 67602: regressions - FAIL

2016-08-29 Thread Platform Team regression test user
This run is configured for baseline tests only.

flight 67602 linux-3.10 real [real]
http://osstest.xs.citrite.net/~osstest/testlogs/logs/67602/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-amd64-amd64-xl-qcow210 guest-start   fail REGR. vs. 66494
 test-amd64-i386-xl-xsm   19 guest-start/debian.repeat fail REGR. vs. 66494
 test-amd64-i386-xl-qemut-stubdom-debianhvm-amd64-xsm 9 debian-hvm-install fail 
REGR. vs. 66494
 test-amd64-i386-xl-qemut-debianhvm-amd64-xsm 9 debian-hvm-install fail REGR. 
vs. 66494
 test-amd64-amd64-xl-qemut-stubdom-debianhvm-amd64-xsm 9 debian-hvm-install 
fail REGR. vs. 66494
 test-amd64-amd64-xl-qemut-winxpsp3  9 windows-install fail REGR. vs. 66494

Regressions which are regarded as allowable (not blocking):
 build-amd64-rumpuserxen   6 xen-buildfail   like 66494
 build-i386-rumpuserxen6 xen-buildfail   like 66494
 test-amd64-i386-xl-qemut-win7-amd64 16 guest-stop  fail like 66494
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stop fail like 66494

Tests which did not succeed, but are not blocking:
 test-amd64-i386-rumpuserxen-i386  1 build-check(1)   blocked  n/a
 test-amd64-amd64-rumpuserxen-amd64  1 build-check(1)   blocked n/a
 test-amd64-amd64-xl-pvh-intel 11 guest-start  fail  never pass
 test-amd64-i386-libvirt  12 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-pvh-amd  11 guest-start  fail   never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt 12 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 12 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-xsm  12 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-amd64-amd64-qemuu-nested-amd 16 debian-hvm-install/l1/l2  fail never pass
 test-amd64-amd64-libvirt-vhd 11 migrate-support-checkfail   never pass
 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop  fail never pass
 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-stop fail never pass

version targeted for testing:
 linux2ecaf1d025af0f481d00b3701ffbcc600dcab076
baseline version:
 linuxca1199fccf14540e86f6da955333e31d6fec5f3e

Last test of basis66494  2016-07-01 10:55:17 Z   59 days
Testing same since67602  2016-08-29 05:20:05 Z0 days1 attempts


People who touched revisions under test:
  Al Viro 
  Alan Stern 
  Alex Deucher 
  Alex Hung 
  Alexander Klein 
  Alexander Shiyan 
  Alexandru Cornea 
  Alexey Brodkin 
  Alexey Brodkin 
  Amadeusz Sławiński 
  Amr Bekhit 
  Andi Kleen 
  Andrew Goodbody 
  Andrew Morton 
  Andrey Grodzovsky 
  Andrey Ryabinin 
  Andy Lutomirski 
  Anna Schumaker 
  Anthony Romano 
  Antonio Alecrim Jr 
  Ben Hutchings 
  Benjamin Herrenschmidt 
  Bernhard Thaler 
  Bin Liu 
  Bjorn Helgaas 
  Bjørn Mork 
  Bjørn Mork 
  Bob Copeland 
  Borislav Petkov 
  Brian King 
  Cameron Gutman 
  Charles (Chas) Williams 
  Chas Williams <3ch...@gmail.com>
  Chas Williams 
  Christian König 
  Christoph Hellwig 
  Crestez Dan Leonard 
  Cyril Bur 
  Dan Carpenter 
  dan.carpen...@oracle.com 
  Daniel Vetter 
  Daniele Palmas 
  Darren Hart 
  Dave Chinner 
  Dave Chinner 
  Dave Jones 
  Dave Weinstein 
  David Howells 
  David S. Miller 
  David Vrabel 
  Denis V. Lunev 
  Dmitri Epshtein 
  Dmitry Torokhov 
  Dmitry Vyukov 
  Doug Ledford 
  

Re: [Xen-devel] IOMMU initialization failure when using linux-as-bootloader

2016-08-29 Thread Jan Beulich
>>> On 29.08.16 at 14:00,  wrote:
>> I think this is reasonable, despite it certainly being unexpected for
>> the BIOS to turn such on when not putting the system into x2APIC
>> mode.
> 
> It seems that linux doesn't use x2APIC because the BIOS explicitly
> "opts out" of it :
> 
> "DMAR-IR: x2apic is disabled because BIOS sets x2apic opt out bit."

Note the "not" in my earlier reply. Or otherwise I don't understand
what you're trying to tell me.

>> Considering you're not talking about a BIOS here, may I
>> nevertheless ask why it's not instead Linux/kexec which get fixed
>> to not leave these features enabled before handing off control?
> 
> I think both should be done.
> 
> Xen should tolerate that case and not assume that if it's enabled it's
> been enabled by Xen.

That's debatable, but as said, your draft patch looks reasonable.
The problem here is that (as so many things in this area) what
state a kernel is allowed to expect the system to be in when
handled control for the first time.

> Especially since that "pre-cleanup" already exists in one path and not
> the other.

On that other path it's a requirement, since firmware can indeed
be expected to turn on interrupt remapping when coming up in
x2APIC mode. Plus ...

> But the kernel should definitely clean up as much as possible after
> itself before reboot.
> I've actually been looking into that this morning but didn't come up
> with a solution yet.
> 
> The Xen case was easy because I just had to copy the missing calls
> from one codepath to the other, for the linux path I'm still looking
> how & where to do that. If I'm still no closer to an answer by
> tomorrow, I'll ask on the kexec mailing list if anyone has any
> suggestion.

... this makes clear that you're acting phenomenologically. For us
to be safe in this regard, however, it would require that we put
back into a clean state _everything_ that the firmware (or Linux in
your present case) may have (pre-)initialized.

Jan


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


Re: [Xen-devel] find_next{,_zero}_bit() inconsistencies

2016-08-29 Thread Jan Beulich
>>> On 29.08.16 at 14:03,  wrote:
> On 29/08/2016 12:59, Jan Beulich wrote:
>> in the context of
>> https://lists.xenproject.org/archives/html/xen-devel/2016-08/msg03068.html 
>> I once again came across the different behavior our various
>> implementations of the $subject functions, in particular their varying
>> handling of the offset argument being greater / greater-or-equal
>> the size argument. Shouldn't we settle on a single, uniform model,
>> which might be
>> 1) offset >= size is valid, returns size,
>> 2) offset == size is valid, returns size, offset > size is invalid,
>> 3) offset >= size is invalid.
>>
>> Thanks for opinions, Jan
> 
> A number of existing situations use size as an end sentinel, so option 3
> will probably break things.

But otoh the ARM32 variant looks broken even for offset == size
(when both are a multiple of 8 the first byte after the array would
get accessed).

> What did you have in mind for invalid?

ASSERT()

>  Option 2 is probably the better
> angle, especially for catching errors, but it is might show up some
> existing latently-buggy code which would also need fixing.

I agree - that's why I'm asking for opinions first.

Jan


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


Re: [Xen-devel] [Minios-devel] [PATCH 1/2] mini-os: support keeping start_info structure conditionally

2016-08-29 Thread Andrew Cooper
On 29/08/2016 13:28, Juergen Gross wrote:
> On 29/08/16 13:47, Andrew Cooper wrote:
>> On 29/08/2016 12:17, Juergen Gross wrote:
>>> On 29/08/16 13:09, Wei Liu wrote:
 On Mon, Aug 29, 2016 at 01:01:08PM +0200, Juergen Gross wrote:
> grub stubdom needs the start_info structure. Keep a copy of it in
> pv mini-os if configured via "CONFIG_KEEP_STARTINFO". This should
> default to "n" in order to have it enabled only when really needed.
>
 I'm not sure I understand the rationale for this.

 Shouldn't start_info always be kept when mini-os is PV? Under what
 condition should it not be kept?
>>> The application on top of Mini-OS shouldn't depend on Mini-OS being
>>> paravirtualized or not in the "normal" case. grub-stubdom is a
>>> special case, as it needs to kexec to a loaded kernel which in turn
>>> needs the start_info, of course.
>>>
>>> ioemu-stubdom OTOH should not need start_info as it could work on
>>> a HVMlite Mini-OS, too.
>>>
>>> The idea of removing start_info in my HVMlite series was driven by
>>> that thought: any application using start_info should break as it
>>> clearly wouldn't be agnostic of the mode (pv or HVMlite) of Mini-OS.
>>> pv-grub was an oversight here.
>>>
>>> I'm planning to modify ioemu-stubdom in the future to not use
>>> start_info and then let it run in HVMlite mode, too.
>> There is an issue here between MiniOS itself, and "the stubdom application".
> Correct.
>
>> There should be no circumstance where the stubdom application needs
>> access (pv-grub being a special case, but maybe the kexec details can be
>> hidden as well).
> Indeed. I'll have a look if this is possible. In case I find a clean
> solution I'll send patches including one removing CONFIG_KEEP_STARTINFO
> again.
>
>> However, while there is still relevant information in start_info, the
>> low level PV bits should still have access.  Moreover, it is necessary
>> to always have access when doing suspend/resume.
> The information from start_info is available inside Mini-OS. So this
> should be no problem.

I have never understood MiniOS's decision to memcpy() it elsewhere.  It
is just a plain page of RAM set up by the domain builder; copying it
elsewhere is just a waste of space.

OTOH, you must pass a pointer to it in the suspend() hypercall, so the
resume logic can re-modify part of it.

~Andrew

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


Re: [Xen-devel] [Minios-devel] [PATCH 1/2] mini-os: support keeping start_info structure conditionally

2016-08-29 Thread Juergen Gross
On 29/08/16 13:47, Andrew Cooper wrote:
> On 29/08/2016 12:17, Juergen Gross wrote:
>> On 29/08/16 13:09, Wei Liu wrote:
>>> On Mon, Aug 29, 2016 at 01:01:08PM +0200, Juergen Gross wrote:
 grub stubdom needs the start_info structure. Keep a copy of it in
 pv mini-os if configured via "CONFIG_KEEP_STARTINFO". This should
 default to "n" in order to have it enabled only when really needed.

>>> I'm not sure I understand the rationale for this.
>>>
>>> Shouldn't start_info always be kept when mini-os is PV? Under what
>>> condition should it not be kept?
>> The application on top of Mini-OS shouldn't depend on Mini-OS being
>> paravirtualized or not in the "normal" case. grub-stubdom is a
>> special case, as it needs to kexec to a loaded kernel which in turn
>> needs the start_info, of course.
>>
>> ioemu-stubdom OTOH should not need start_info as it could work on
>> a HVMlite Mini-OS, too.
>>
>> The idea of removing start_info in my HVMlite series was driven by
>> that thought: any application using start_info should break as it
>> clearly wouldn't be agnostic of the mode (pv or HVMlite) of Mini-OS.
>> pv-grub was an oversight here.
>>
>> I'm planning to modify ioemu-stubdom in the future to not use
>> start_info and then let it run in HVMlite mode, too.
> 
> There is an issue here between MiniOS itself, and "the stubdom application".

Correct.

> There should be no circumstance where the stubdom application needs
> access (pv-grub being a special case, but maybe the kexec details can be
> hidden as well).

Indeed. I'll have a look if this is possible. In case I find a clean
solution I'll send patches including one removing CONFIG_KEEP_STARTINFO
again.

> However, while there is still relevant information in start_info, the
> low level PV bits should still have access.  Moreover, it is necessary
> to always have access when doing suspend/resume.

The information from start_info is available inside Mini-OS. So this
should be no problem.

Juergen

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


Re: [Xen-devel] [PATCH RFC] tools/libxc, xen/x86: Added xc_set_mem_access_sparse()

2016-08-29 Thread Razvan Cojocaru
On 08/29/2016 03:11 PM, Razvan Cojocaru wrote:
> On 08/26/2016 10:18 AM, Jan Beulich wrote:
> On 26.08.16 at 08:11,  wrote:
>>> +rc = p2m_set_mem_access(d, _gfn(mao.pfn), arr, mao.nr, start_iter,
>>> +MEMOP_CMD_MASK, mao.access, 0);
>>
>> Please don't pass mao.pfn here when it's meant to be ignore by
>> the caller. Use GFN_INVALID instead. And for future extensibility
>> please check that the caller put some pre-defined pattern here
>> (not sure whether zero is appropriate in this case).
> 
> GFN_INVALID has it's own semantics in p2m_set_mem_access():
> 
> /* If request to set default access. */
> if ( gfn_eq(gfn, INVALID_GFN) )
> {
> p2m->default_access = a;
> return 0;
> }
> 
> I'll replace the condition with "if ( !arr && gfn_eq(gfn, INVALID_GFN)
> )" and use GFN_INVALID in the XENMEM_access_op_set_access_multi (renamed
> from XENMEM_access_op_set_access_sparse), as recommended.

Sorry for the reversals, it obviously should say "INVALID_GFN"
everywhere. :)


Thanks,
Razvan

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


Re: [Xen-devel] [PATCH RFC] tools/libxc, xen/x86: Added xc_set_mem_access_sparse()

2016-08-29 Thread Razvan Cojocaru
On 08/26/2016 10:18 AM, Jan Beulich wrote:
 On 26.08.16 at 08:11,  wrote:
>> +rc = p2m_set_mem_access(d, _gfn(mao.pfn), arr, mao.nr, start_iter,
>> +MEMOP_CMD_MASK, mao.access, 0);
> 
> Please don't pass mao.pfn here when it's meant to be ignore by
> the caller. Use GFN_INVALID instead. And for future extensibility
> please check that the caller put some pre-defined pattern here
> (not sure whether zero is appropriate in this case).

GFN_INVALID has it's own semantics in p2m_set_mem_access():

/* If request to set default access. */
if ( gfn_eq(gfn, INVALID_GFN) )
{
p2m->default_access = a;
return 0;
}

I'll replace the condition with "if ( !arr && gfn_eq(gfn, INVALID_GFN)
)" and use GFN_INVALID in the XENMEM_access_op_set_access_multi (renamed
from XENMEM_access_op_set_access_sparse), as recommended.


Thanks,
Razvan

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


Re: [Xen-devel] [Minios-devel] [PATCH 1/2] mini-os: support keeping start_info structure conditionally

2016-08-29 Thread Wei Liu
On Mon, Aug 29, 2016 at 01:17:56PM +0200, Juergen Gross wrote:
> On 29/08/16 13:09, Wei Liu wrote:
> > On Mon, Aug 29, 2016 at 01:01:08PM +0200, Juergen Gross wrote:
> >> grub stubdom needs the start_info structure. Keep a copy of it in
> >> pv mini-os if configured via "CONFIG_KEEP_STARTINFO". This should
> >> default to "n" in order to have it enabled only when really needed.
> >>
> > 
> > I'm not sure I understand the rationale for this.
> > 
> > Shouldn't start_info always be kept when mini-os is PV? Under what
> > condition should it not be kept?
> 
> The application on top of Mini-OS shouldn't depend on Mini-OS being
> paravirtualized or not in the "normal" case. grub-stubdom is a
> special case, as it needs to kexec to a loaded kernel which in turn
> needs the start_info, of course.
> 
> ioemu-stubdom OTOH should not need start_info as it could work on
> a HVMlite Mini-OS, too.
> 
> The idea of removing start_info in my HVMlite series was driven by
> that thought: any application using start_info should break as it
> clearly wouldn't be agnostic of the mode (pv or HVMlite) of Mini-OS.
> pv-grub was an oversight here.
> 
> I'm planning to modify ioemu-stubdom in the future to not use
> start_info and then let it run in HVMlite mode, too.
> 
> 

Right. I think we're on the same page regarding how apps should be like.

Would it be sufficient that pv-grub has a hard dependency on PV mini-os?
That should avoid yet another config option. And the semantics seems
rather strange.

But in the end I don't think I would argue strongly one way or the
other because the config option your introduced defaults to n.

Wei.

> Juergen
> 

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


Re: [Xen-devel] IOMMU initialization failure when using linux-as-bootloader

2016-08-29 Thread Sylvain Munaut
Hi Jan,


> I think this is reasonable, despite it certainly being unexpected for
> the BIOS to turn such on when not putting the system into x2APIC
> mode.

It seems that linux doesn't use x2APIC because the BIOS explicitly
"opts out" of it :

"DMAR-IR: x2apic is disabled because BIOS sets x2apic opt out bit."


> Considering you're not talking about a BIOS here, may I
> nevertheless ask why it's not instead Linux/kexec which get fixed
> to not leave these features enabled before handing off control?

I think both should be done.

Xen should tolerate that case and not assume that if it's enabled it's
been enabled by Xen.
Especially since that "pre-cleanup" already exists in one path and not
the other.

But the kernel should definitely clean up as much as possible after
itself before reboot.
I've actually been looking into that this morning but didn't come up
with a solution yet.

The Xen case was easy because I just had to copy the missing calls
from one codepath to the other, for the linux path I'm still looking
how & where to do that. If I'm still no closer to an answer by
tomorrow, I'll ask on the kexec mailing list if anyone has any
suggestion.


Cheers,

Sylvain

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


[Xen-devel] find_next{,_zero}_bit() inconsistencies

2016-08-29 Thread Jan Beulich
Hello,

in the context of
https://lists.xenproject.org/archives/html/xen-devel/2016-08/msg03068.html
I once again came across the different behavior our various
implementations of the $subject functions, in particular their varying
handling of the offset argument being greater / greater-or-equal
the size argument. Shouldn't we settle on a single, uniform model,
which might be
1) offset >= size is valid, returns size,
2) offset == size is valid, returns size, offset > size is invalid,
3) offset >= size is invalid.

Thanks for opinions, Jan


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


Re: [Xen-devel] [PATCH] Fix a BUG_ON issue

2016-08-29 Thread Jan Beulich
>>> On 29.08.16 at 11:14,  wrote:
> --- a/xen/drivers/passthrough/io.c
> +++ b/xen/drivers/passthrough/io.c
> @@ -243,7 +243,7 @@ static struct vcpu *vector_hashing_dest(const struct 
> domain *d,
>  for ( i = 0; i <= mod; i++ )
>  {
>  idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx) + 1;
> -BUG_ON(idx >= d->max_vcpus);
> +BUG_ON(idx > d->max_vcpus);
>  }
>  
>  dest = d->vcpu[idx - 1];

Wouldn't it be better to change the code to

unsigned int idx = -1;

for ( i = 0; i <= mod; i++ )
{
idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx + 1);
BUG_ON(idx >= d->max_vcpus);
}

dest = d->vcpu[idx];

or, not utilizing wrapping

unsigned int idx = find_first_bit(dest_vcpu_bitmap, d->max_vcpus);

for ( i = 0; i < mod; i++ )
idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx + 1);

BUG_ON(idx >= d->max_vcpus);

dest = d->vcpu[idx];

Jan


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


Re: [Xen-devel] [Minios-devel] [PATCH 1/2] mini-os: support keeping start_info structure conditionally

2016-08-29 Thread Andrew Cooper
On 29/08/2016 12:17, Juergen Gross wrote:
> On 29/08/16 13:09, Wei Liu wrote:
>> On Mon, Aug 29, 2016 at 01:01:08PM +0200, Juergen Gross wrote:
>>> grub stubdom needs the start_info structure. Keep a copy of it in
>>> pv mini-os if configured via "CONFIG_KEEP_STARTINFO". This should
>>> default to "n" in order to have it enabled only when really needed.
>>>
>> I'm not sure I understand the rationale for this.
>>
>> Shouldn't start_info always be kept when mini-os is PV? Under what
>> condition should it not be kept?
> The application on top of Mini-OS shouldn't depend on Mini-OS being
> paravirtualized or not in the "normal" case. grub-stubdom is a
> special case, as it needs to kexec to a loaded kernel which in turn
> needs the start_info, of course.
>
> ioemu-stubdom OTOH should not need start_info as it could work on
> a HVMlite Mini-OS, too.
>
> The idea of removing start_info in my HVMlite series was driven by
> that thought: any application using start_info should break as it
> clearly wouldn't be agnostic of the mode (pv or HVMlite) of Mini-OS.
> pv-grub was an oversight here.
>
> I'm planning to modify ioemu-stubdom in the future to not use
> start_info and then let it run in HVMlite mode, too.

There is an issue here between MiniOS itself, and "the stubdom application".

There should be no circumstance where the stubdom application needs
access (pv-grub being a special case, but maybe the kexec details can be
hidden as well).

However, while there is still relevant information in start_info, the
low level PV bits should still have access.  Moreover, it is necessary
to always have access when doing suspend/resume.

~Andrew

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


Re: [Xen-devel] [Minios-devel] [PATCH 1/2] mini-os: support keeping start_info structure conditionally

2016-08-29 Thread Juergen Gross
On 29/08/16 13:09, Wei Liu wrote:
> On Mon, Aug 29, 2016 at 01:01:08PM +0200, Juergen Gross wrote:
>> grub stubdom needs the start_info structure. Keep a copy of it in
>> pv mini-os if configured via "CONFIG_KEEP_STARTINFO". This should
>> default to "n" in order to have it enabled only when really needed.
>>
> 
> I'm not sure I understand the rationale for this.
> 
> Shouldn't start_info always be kept when mini-os is PV? Under what
> condition should it not be kept?

The application on top of Mini-OS shouldn't depend on Mini-OS being
paravirtualized or not in the "normal" case. grub-stubdom is a
special case, as it needs to kexec to a loaded kernel which in turn
needs the start_info, of course.

ioemu-stubdom OTOH should not need start_info as it could work on
a HVMlite Mini-OS, too.

The idea of removing start_info in my HVMlite series was driven by
that thought: any application using start_info should break as it
clearly wouldn't be agnostic of the mode (pv or HVMlite) of Mini-OS.
pv-grub was an oversight here.

I'm planning to modify ioemu-stubdom in the future to not use
start_info and then let it run in HVMlite mode, too.


Juergen


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


Re: [Xen-devel] [PATCH 2/2] mini-os: don't get xenbus parameters if xenbus is disabled

2016-08-29 Thread Wei Liu
On Mon, Aug 29, 2016 at 01:01:09PM +0200, Juergen Gross wrote:
> get_xenbus() should be called only if CONFIG_XENBUS is set.
> 
> Signed-off-by: Juergen Gross 

Reviewed-by: Wei Liu 

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


Re: [Xen-devel] [PATCH 1/2] mini-os: support keeping start_info structure conditionally

2016-08-29 Thread Wei Liu
On Mon, Aug 29, 2016 at 01:01:08PM +0200, Juergen Gross wrote:
> grub stubdom needs the start_info structure. Keep a copy of it in
> pv mini-os if configured via "CONFIG_KEEP_STARTINFO". This should
> default to "n" in order to have it enabled only when really needed.
> 

I'm not sure I understand the rationale for this.

Shouldn't start_info always be kept when mini-os is PV? Under what
condition should it not be kept?

Wei.

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


Re: [Xen-devel] linux-4.7.* under xen-4.6.* gives "unhandled page fault (ec=0000)" at boot. -- Root cause found.

2016-08-29 Thread Jan Beulich
>>> On 29.08.16 at 01:14,  wrote:

First of all - please don't cross post.

> Den 17. aug. 2016 21:56, I wrote (to xen-users, as I am no developer):
>> I'm on gentoo, running gentoo-sources kernel for dom0.
>>
>> I am unable to run gentoo-sources-4.7.{0,1}. I'm running under xen,
>> currently at 4.6.3-r1
> 
> I am now on linux gentoo-sources-4.7.2, and the bug is stil present.
> 
> I have done some digging on my own, and found that protecting two instances 
> of " for_each_efi_memory_desc(md) {" with something like "if( efi.memmap.map 
> != NULL) {" will allow my dom0 to boot and run.

Which is basically the equivalent of e.g.

http://lkml.iu.edu/hypermail/linux/kernel/1608.2/03448.html

(this first one that a quick search found)

> My line-numbers may be a bit off due to copious use of pr_info.
> 
> The locations are:
> - linux/arch/x86/platform/efi/efi.c line 121 in function efi_find_mirror()
> - /usr/src/linux/arch/x86/platform/efi/quirks.c line 253 in function
> efi_free_boot_services(void)
> 
> Searching the web lead me first to a solution which I believe to be
> wrong, changing the comparison operator in for_each_efi_memory_desc. It
> also lead me to someone mentioning that efi.memmap.map is not used when
> running under xen. That info may also be bogus for all I know.

Not sure which part the "bogus" here is meant to apply to: Do you
mean the statement is bogus (in which case I wonder why), or do
you mean the data pointed to would be bogus (in which case I
wonder what data you think about when the pointer is NULL)?

Jan


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


[Xen-devel] [PATCH 1/2] mini-os: support keeping start_info structure conditionally

2016-08-29 Thread Juergen Gross
grub stubdom needs the start_info structure. Keep a copy of it in
pv mini-os if configured via "CONFIG_KEEP_STARTINFO". This should
default to "n" in order to have it enabled only when really needed.

Signed-off-by: Juergen Gross 
---
 Config.mk|  2 ++
 arch/x86/setup.c | 12 
 include/hypervisor.h | 13 +
 3 files changed, 27 insertions(+)

diff --git a/Config.mk b/Config.mk
index aa36761..ae18ffd 100644
--- a/Config.mk
+++ b/Config.mk
@@ -175,6 +175,7 @@ CONFIG_XENBUS ?= y
 CONFIG_XC ?=y
 CONFIG_LWIP ?= $(lwip)
 CONFIG_BALLOON ?= n
+CONFIG_KEEP_STARTINFO ?= n
 
 # Export config items as compiler directives
 DEFINES-$(CONFIG_PARAVIRT) += -DCONFIG_PARAVIRT
@@ -192,6 +193,7 @@ DEFINES-$(CONFIG_FBFRONT) += -DCONFIG_FBFRONT
 DEFINES-$(CONFIG_CONSFRONT) += -DCONFIG_CONSFRONT
 DEFINES-$(CONFIG_XENBUS) += -DCONFIG_XENBUS
 DEFINES-$(CONFIG_BALLOON) += -DCONFIG_BALLOON
+DEFINES-$(CONFIG_KEEP_STARTINFO) += -DCONFIG_KEEP_STARTINFO
 
 # Override settings for this OS
 PTHREAD_LIBS =
diff --git a/arch/x86/setup.c b/arch/x86/setup.c
index 86955cf..1761b81 100644
--- a/arch/x86/setup.c
+++ b/arch/x86/setup.c
@@ -33,6 +33,14 @@
 #include 
 #include 
 
+#ifdef CONFIG_KEEP_STARTINFO
+/*
+ * This structure contains start-of-day info, such as pagetable base pointer,
+ * address of the shared_info structure, and things like that.
+ */
+union start_info_union start_info_union;
+#endif
+
 /*
  * Shared page for communicating with the hypervisor.
  * Events flags go here, for example.
@@ -189,6 +197,10 @@ arch_init(void *par)
/* print out some useful information  */
print_start_of_day(par);
 
+#ifdef CONFIG_KEEP_STARTINFO
+   memcpy(_info, par, sizeof(start_info));
+#endif
+
start_kernel();
 }
 
diff --git a/include/hypervisor.h b/include/hypervisor.h
index 3073a8a..5475867 100644
--- a/include/hypervisor.h
+++ b/include/hypervisor.h
@@ -27,6 +27,19 @@
 #include 
 
 /* hypervisor.c */
+#ifdef CONFIG_KEEP_STARTINFO
+/*
+ * a placeholder for the start of day information passed up from the hypervisor
+ */
+union start_info_union
+{
+start_info_t start_info;
+char padding[512];
+};
+extern union start_info_union start_info_union;
+#define start_info (start_info_union.start_info)
+#endif
+
 #ifndef CONFIG_PARAVIRT
 int hvm_get_parameter(int idx, uint64_t *value);
 int hvm_set_parameter(int idx, uint64_t value);
-- 
2.6.6


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


[Xen-devel] [PATCH 0/2] mini-os: repair stubdom build

2016-08-29 Thread Juergen Gross
The patch series adding HVMlite support for Mini-OS unfortunately
broke building Xen's stubdoms. This small series repairs the broken
bits again.

Please note that there is still some action required in Xen:
ioemu and grub stubdom minios.cfg files need CONFIG_KEEP_STARTINFO=y
to be added. I'm sending out a patch for Xen to do this in parallel.

Juergen Gross (2):
  mini-os: support keeping start_info structure conditionally
  mini-os: don't get xenbus parameters if xenbus is disabled

 Config.mk|  2 ++
 arch/x86/setup.c | 12 
 include/hypervisor.h | 13 +
 include/xenbus.h |  5 -
 4 files changed, 31 insertions(+), 1 deletion(-)

-- 
2.6.6


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


[Xen-devel] [PATCH 2/2] mini-os: don't get xenbus parameters if xenbus is disabled

2016-08-29 Thread Juergen Gross
get_xenbus() should be called only if CONFIG_XENBUS is set.

Signed-off-by: Juergen Gross 
---
 include/xenbus.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/xenbus.h b/include/xenbus.h
index 5646a25..c254652 100644
--- a/include/xenbus.h
+++ b/include/xenbus.h
@@ -9,10 +9,14 @@ typedef unsigned long xenbus_transaction_t;
 #ifdef CONFIG_XENBUS
 /* Initialize the XenBus system. */
 void init_xenbus(void);
+void get_xenbus(void *p);
 #else
 static inline void init_xenbus(void)
 {
 }
+static inline void get_xenbus(void *p)
+{
+}
 #endif
 
 /* Read the value associated with a path.  Returns a malloc'd error
@@ -31,7 +35,6 @@ typedef struct xenbus_event *xenbus_event_queue;
 
 extern uint32_t xenbus_evtchn;
 
-void get_xenbus(void *p);
 char *xenbus_watch_path_token(xenbus_transaction_t xbt, const char *path, 
const char *token, xenbus_event_queue *events);
 char *xenbus_unwatch_path_token(xenbus_transaction_t xbt, const char *path, 
const char *token);
 extern struct wait_queue_head xenbus_watch_queue;
-- 
2.6.6


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


[Xen-devel] [PATCH] stubdom: add CONFIG_KEEP_STARTINFO for stubdoms which reference start_info

2016-08-29 Thread Juergen Gross
grub-stubdom and ioemu-stubdom rely on Mini-OS exporting the start_info
structure via a global variable. To use this feature in future we must
specify CONFIG_KEEP_STARTINFO in the Mini-OS config file.

Signed-off-by: Juergen Gross 
---
 stubdom/grub/minios.cfg  | 1 +
 stubdom/ioemu-minios.cfg | 1 +
 2 files changed, 2 insertions(+)

diff --git a/stubdom/grub/minios.cfg b/stubdom/grub/minios.cfg
index 8df4909..0e81f0a 100644
--- a/stubdom/grub/minios.cfg
+++ b/stubdom/grub/minios.cfg
@@ -1,3 +1,4 @@
 CONFIG_START_NETWORK=n
 CONFIG_SPARSE_BSS=n
 CONFIG_TPMFRONT=y
+CONFIG_KEEP_STARTINFO=y
diff --git a/stubdom/ioemu-minios.cfg b/stubdom/ioemu-minios.cfg
index d690553..9e9ea99 100644
--- a/stubdom/ioemu-minios.cfg
+++ b/stubdom/ioemu-minios.cfg
@@ -1,3 +1,4 @@
 CONFIG_START_NETWORK=n
 CONFIG_QEMU_XS_ARGS=y
 CONFIG_PCIFRONT=y
+CONFIG_KEEP_STARTINFO=y
-- 
2.6.6


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


Re: [Xen-devel] IOMMU initialization failure when using linux-as-bootloader

2016-08-29 Thread Jan Beulich
>>> On 27.08.16 at 12:40,  wrote:
> I'll test this in more detail next week to make sure things really
> work as expected (atm I'm just testing if dom0 boots properly). And if
> things turn OK and you think this is a proper fix for the issue and
> safe to apply, I can send the patch properly to the list.

I think this is reasonable, despite it certainly being unexpected for
the BIOS to turn such on when not putting the system into x2APIC
mode. Considering you're not talking about a BIOS here, may I
nevertheless ask why it's not instead Linux/kexec which get fixed
to not leave these features enabled before handing off control?

Jan

> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -2102,6 +2102,9 @@ static int __must_check init_vtd_hw(void)
> 
>  clear_fault_bits(iommu);
> 
> +disable_intremap(iommu);
> +disable_qinval(iommu);
> +
>  spin_lock_irqsave(>register_lock, flags);
>  sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
>  sts &= ~DMA_FECTL_IM;



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


Re: [Xen-devel] [PATCH net-next] xen-netfront: avoid packet loss when ethernet header crosses page boundary

2016-08-29 Thread Vitaly Kuznetsov
Vitaly Kuznetsov  writes:

> David Vrabel  writes:
>
>> On 22/08/16 16:42, Vitaly Kuznetsov wrote:
>>> 
>>> I see two ways to fix the issue:
>>> - Change the 'wire' protocol between netfront and netback to start keeping
>>>   the original SKB structure. We'll have to add a flag indicating the fact
>>>   that the particular request is a part of the original linear part and not
>>>   a frag. We'll need to know the length of the linear part to pre-allocate
>>>   memory.
>>
>> I don't think there needs to be a protocol change.  I think the check in
>> netback is bogus -- it's the total packet length that must be >
>> HLEN_ETH.  The upper layers will pull any headers from the frags as
>> needed
>
> I'm afraid this is not always true, just removing the check leads us to
> the following:
>
> [  495.442186] kernel BUG at ./include/linux/skbuff.h:1927! 
> [  495.468789] invalid opcode:  [#1] SMP 

What I wanted to say here is that this test makes me think the
description of the patch I suggested is correct: an SKB can't have its
linear part shorter than ETH_HLEN as the header is being pointed directly,
upper network layers don't assemble it from frags, the check in netback
is valid.

So, how can we proceed here?

-- 
  Vitaly

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


Re: [Xen-devel] Save/Restore is not working properly

2016-08-29 Thread Cendrin Sa
I have tested it both on
Xen 4.8 and Debian Stretch : Kernel version 4.6
Xen 4.6 and Debian Jessie : Kernel version 3.19
and also Xen 4.6 and 4.7 on ubuntu Kernel 3.16

On Wed, Aug 24, 2016 at 3:38 PM, Roger Pau Monné 
wrote:

> On Fri, Aug 19, 2016 at 08:45:49PM +0430, Cendrin Sa wrote:
> > Hi again,
> > So save/restore has a bug or not? I still have problem with it when i use
> > LVM.
>
> Which kernel version are you using on the Dom0?
>
> Roger.
>
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v2 0/3] mini-os: some cleanups

2016-08-29 Thread Wei Liu
On Mon, Aug 29, 2016 at 08:17:19AM +0200, Juergen Gross wrote:
> Do some cleanups in Mini-OS.
> 
> V2: modified patch 2 as suggested by Andrew Cooper
> 
> Juergen Gross (3):
>   mini-os: cleanup x86_32.S
>   mini-os: cleanup x86_64.S
>   mini-os: remove unused functions from sched.c
> 
>  arch/x86/x86_32.S |  7 +--
>  arch/x86/x86_64.S | 43 +++
>  sched.c   | 48 
>  3 files changed, 16 insertions(+), 82 deletions(-)
> 

Pushed.

> -- 
> 2.6.6
> 

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


Re: [Xen-devel] [PATCH v3 5/6] x86/time: implement PVCLOCK_TSC_STABLE_BIT

2016-08-29 Thread Jan Beulich
>>> On 26.08.16 at 17:44,  wrote:
> On 08/25/2016 11:37 AM, Jan Beulich wrote:
> On 24.08.16 at 14:43,  wrote:
>>> This patch proposes relying on host TSC synchronization and
>>> passthrough to the guest, when running on a TSC-safe platform. On
>>> time_calibration we retrieve the platform time in ns and the counter
>>> read by the clocksource that was used to compute system time. We
>>> introduce a new rendezous function which doesn't require
>>> synchronization between master and slave CPUS and just reads
>>> calibration_rendezvous struct and writes it down the stime and stamp
>>> to the cpu_calibration struct to be used later on. We can guarantee that
>>> on a platform with a constant and reliable TSC, that the time read on
>>> vcpu B right after A is bigger independently of the VCPU calibration
>>> error. Since pvclock time infos are monotonic as seen by any vCPU set
>>> PVCLOCK_TSC_STABLE_BIT, which then enables usage of VDSO on Linux.
>>> IIUC, this is similar to how it's implemented on KVM.
>> 
>> Without any tools side change, how is it guaranteed that a guest
>> which observed the stable bit won't get migrated to a host not
>> providing that guarantee?
> Do you want to prevent migration in such cases? The worst that can happen is 
> that the
> guest might need to fallback to a system call if this bit is 0 and would keep 
> doing
> so if the bit is 0.

Whether migration needs preventing I'm not sure; all I was trying
to indicate is that there seem to be pieces missing wrt migration.
As to the guest falling back to a system call - are guest kernels and
(as far as as affected) applications required to cope with the flag
changing from 1 to 0 behind their back?

>>>  {
>>>  struct cpu_time_stamp *c = _cpu(cpu_calibration);
>>>  
>>> -c->local_tsc= rdtsc_ordered();
>>> -c->local_stime  = get_s_time_fixed(c->local_tsc);
>>> +if ( master_tsc )
>>> +{
>>> +c->local_tsc= r->master_tsc_stamp;
>> 
>> Doesn't this require the TSCs to run in perfect sync (not even off
>> wrt each other by a single cycle)? Is such even possible on multi
>> socket systems? I.e. how would multiple chips get into such a
>> mode in the first place, considering their TSCs can't possibly start
>> ticking at exactly the same (perhaps even sub-)nanosecond?
> They do require to be in sync with multi-sockets, otherwise this wouldn't 
> work.

"In sync" may mean two things: Ticking at exactly the same rate, or
(more strict) holding the exact same values at all times.

> Invariant TSC only refers to cores in a package, but multi-socket is up to 
> board
> vendors (no manuals mention this guarantee across sockets). That one of the 
> reasons
> TSC is such a burden :(
> 
> Looking at datasheets (on the oldest processor I was testing this) it 
> mentions this note:
> 
> "In order In order to ensure Timestamp Counter (TSC) synchronization across 
> sockets
> in multi-socket systems, the RESET# deassertion edge should arrive at the 
> same BCLK
> rising edge at both sockets and should meet the Tsu and Th requirement of 
> 600ps
> relative to BCLK, as outlined in Table 2-26.".

Hmm, a dual socket system is certainly still one of the easier ones to
deal with. 600ps means 18cm difference in signaling paths, which on
larger systems (and namely ones composed of mostly independent
nodes) I could easily seem getting exceeded. That can certainly be
compensated (e.g. by deasserting RESET# at different times for
different sockets), but I'd then still question the accuracy.

> [0] Intel Xeon Processor 5600 Series Datasheet Vol 1, Page 63,
> http://www.intel.com/content/dam/www/public/us/en/documents/datasheets/xeon-5 
> 600-vol-1-datasheet.pdf
> 
> The BCLK looks to be the global reference clock shared across sockets IIUC 
> used in
> the PLLs in the individual packages (to generate the signal where the TSC is
> extrapolated from). ( Please read it with a grain of salt, as I may be doing 
> wrong
> readings of these datasheets ). But If it was a box with TSC skewed among 
> sockets,
> wouldn't we see that at boot time in the tsc warp test? Or maybe TSC sync 
> check isn't
> potentially fast enough to catch any oddities?

That's my main fear: The check can't possibly determine whether TSCs
are in perfect sync, it can only check an approximation. Perhaps even
worse than the multi-node consideration here is hyper-threading, as
that makes it fundamentally impossible that all threads within one core
execute the same operation at exactly the same time. Not to speak of
the various odd cache effects which I did observe while doing the
measurements for my series (e.g. the second thread speculating the
TSC reads much farther than the primary ones, presumably because
the primary ones first needed to get the I-cache populated).

> Our docs
> (https://xenbits.xen.org/docs/unstable/misc/tscmode.txt) also seem to mention
> something along these lines on multi-socket systems. 

Re: [Xen-devel] [PATCH v3 3/6] x86/time: streamline platform time init on plt_update()

2016-08-29 Thread Jan Beulich
>>> On 26.08.16 at 17:12,  wrote:
> On 08/25/2016 11:13 AM, Jan Beulich wrote:
> On 24.08.16 at 14:43,  wrote:
>>> And use to initialize platform time solely for clocksource=tsc,
>>> as opposed to initializing platform overflow timer, which would
>>> only fire in ~180 years (on 2.2 Ghz Broadwell processor).
>> 
>> Do we really want to risk this time period going down by two orders
>> of magnitude? Is there anything that's really expensive in setting the
>> overflow timer in the far distant future?
> It wasn't about cost but rather setting the timer in a so distant future. I 
> could
> decrease to an year time, month or day. But do you think we really need that 
> overflow
> handling for TSC?

I think we shouldn't introduce latent issues, no matter how unlikely
we may deem it for them to actually become active ones. Just
consider how unlikely it would have seemed to someone in the
i586 days (when the TSC got introduced) that clock speeds might
ever cross the 4GHz boundary. As a consequence long ago Linux
did use a 32-bit variable for it. It got noticed early enough before
processors got really close to that boundary, but it demonstrates
the fundamental issue. And yes, processor speeds have stopped
to always grow (at least in the x86 space), but that's not a rule
set in stone.

Jan


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


[Xen-devel] [ovmf test] 100653: all pass - PUSHED

2016-08-29 Thread osstest service owner
flight 100653 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/100653/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 37136e069dc0a0b8a47098d80d8f6f742db88c04
baseline version:
 ovmf 81d9f86f8a7106b59057e5b29490eb04e38483bd

Last test of basis   100633  2016-08-26 11:15:54 Z2 days
Testing same since   100653  2016-08-29 07:45:04 Z0 days1 attempts


People who touched revisions under test:
  Star Zeng 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

+ branch=ovmf
+ revision=37136e069dc0a0b8a47098d80d8f6f742db88c04
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x '!=' x/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock
++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push ovmf 
37136e069dc0a0b8a47098d80d8f6f742db88c04
+ branch=ovmf
+ revision=37136e069dc0a0b8a47098d80d8f6f742db88c04
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']'
+ . ./cri-common
++ . ./cri-getconfig
++ umask 002
+ select_xenbranch
+ case "$branch" in
+ tree=ovmf
+ xenbranch=xen-unstable
+ '[' xovmf = xlinux ']'
+ linuxbranch=
+ '[' x = x ']'
+ qemuubranch=qemu-upstream-unstable
+ select_prevxenbranch
++ ./cri-getprevxenbranch xen-unstable
+ prevxenbranch=xen-4.7-testing
+ '[' x37136e069dc0a0b8a47098d80d8f6f742db88c04 = x ']'
+ : tested/2.6.39.x
+ . ./ap-common
++ : osst...@xenbits.xen.org
+++ getconfig OsstestUpstream
+++ perl -e '
use Osstest;
readglobalconfig();
print $c{"OsstestUpstream"} or die $!;
'
++ :
++ : git://xenbits.xen.org/xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/xen.git
++ : git://xenbits.xen.org/qemu-xen-traditional.git
++ : git://git.kernel.org
++ : git://git.kernel.org/pub/scm/linux/kernel/git
++ : git
++ : git://xenbits.xen.org/libvirt.git
++ : osst...@xenbits.xen.org:/home/xen/git/libvirt.git
++ : git://xenbits.xen.org/libvirt.git
++ : git://xenbits.xen.org/rumpuser-xen.git
++ : git
++ : git://xenbits.xen.org/rumpuser-xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/rumpuser-xen.git
+++ besteffort_repo https://github.com/rumpkernel/rumpkernel-netbsd-src
+++ local repo=https://github.com/rumpkernel/rumpkernel-netbsd-src
+++ cached_repo https://github.com/rumpkernel/rumpkernel-netbsd-src 
'[fetch=try]'
+++ local repo=https://github.com/rumpkernel/rumpkernel-netbsd-src
+++ local 'options=[fetch=try]'
 getconfig GitCacheProxy
 perl -e '
use Osstest;
readglobalconfig();
print $c{"GitCacheProxy"} or die $!;
'
+++ local cache=git://cache:9419/
+++ '[' xgit://cache:9419/ '!=' x ']'
+++ echo 
'git://cache:9419/https://github.com/rumpkernel/rumpkernel-netbsd-src%20[fetch=try]'

[Xen-devel] [PATCH] Fix a BUG_ON issue

2016-08-29 Thread Feng Wu
The 'idx' can equal to the max number of vCPUs, fix it.

Signed-off-by: Feng Wu 
---
 xen/drivers/passthrough/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index 9e6b46c..66577b6 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -243,7 +243,7 @@ static struct vcpu *vector_hashing_dest(const struct domain 
*d,
 for ( i = 0; i <= mod; i++ )
 {
 idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx) + 1;
-BUG_ON(idx >= d->max_vcpus);
+BUG_ON(idx > d->max_vcpus);
 }
 
 dest = d->vcpu[idx - 1];
-- 
2.1.0


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


Re: [Xen-devel] [PATCH v3 4/6] x86/time: refactor read_platform_stime()

2016-08-29 Thread Jan Beulich
>>> On 26.08.16 at 17:13,  wrote:
> On 08/25/2016 11:17 AM, Jan Beulich wrote:
> On 24.08.16 at 14:43,  wrote:
>>> In the case of clocksource=tsc we will
>>> use it to set tsc_timestamp.
>> 
>> I don't see how this relates to the patch here.
>> 
>> The change itself looks reasonable assuming its a prereq for a
>> subsequent patch.
> OK, I can remove it, and could perhaps add this instead?
> 
> "This is a prerequisite for a subsequent patch that will use this last 
> read."

Sounds good.

Jan


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


Re: [Xen-devel] [PATCH v3 2/6] x86/time: implement tsc as clocksource

2016-08-29 Thread Jan Beulich
>>> On 26.08.16 at 17:11,  wrote:
> On 08/25/2016 11:06 AM, Jan Beulich wrote:
> On 24.08.16 at 14:43,  wrote:
>>> This patch introduces support for using TSC as platform time source
>>> which is the highest resolution time and most performant to get (~20
>>> nsecs).
>> 
>> Is this indeed still the case with the recently added fences?
> Hmm, may be not as fast with the added fences, But definitely the fastest 
> time
> source. If you prefer I can remove the mention to time taken.

I'd say either you re-measure it with the added fences, or remove it
as potentially being stale/wrong.

>>>  - Change init_tsctimer to skip all the tests and assume it's called
>>>  only on reliable TSC conditions and no warps observed. Tidy
>>>  initialization on verify_tsc_reliability as suggested by Konrad.
>> 
>> Which means that contrary to what you say in the cover letter
>> there's nothing to prevent it from being used when CPU hotplug
>> is possible.
> Probably the cover letter wasn't completely clear on this. I mention that I 
> split it
> between Patch 2 and 5 (intent was for easier review), and you can see that I 
> add
> check in patch 5, plus preventing online of CPUs too.
> 
>> I don't think you should skip basic sanity checks, and
>> place entirely on the admin the burden of knowing whether the
>> option is safe to use.
> Neither do I think it should be skipped. We mainly don't duplicate these 
> checks. In
> the end I am just running init_tsctimer, in the TSC_RELIABLE block and if no 
> warps
> are observed. So putting that in init_tsctimer would just duplicate the 
> previously
> done checks. Or would you still prefer as done in previous version i.e. all 
> checks in
> both init_tsctimer and verify_tsc_reliability?

I'm not sure they're needed in both places; what you need to make
certain is that they're reliably gone through, and that this happens
early enough.

As to breaking this off into the later patch - please don't forget
that this (as any) series may get applied in pieces, so deferring a
crucial check to a later patch is not acceptable. If you mean things
to be split for easier review you may check whether you can find
a way to add the check in q prereq patch.

>>> +{
>>> +struct cpu_time *t = _cpu(cpu_time, cpu);
>>> +
>>> +t->stamp.local_tsc = boot_tsc_stamp;
>>> +t->stamp.local_stime = 0;
>>> +t->stamp.local_stime = get_s_time_fixed(boot_tsc_stamp);
>>> +t->stamp.master_stime = t->stamp.local_stime;
>>> +}
>> 
>> Without any synchronization, how "good" are the chances that
>> this updating would race with something the other CPUs do?
> 
> I assumed that at this stage init calls are still being invoked that we 
> update all
> cpus time infos, but maybe it's a misconception. I can have this part in one 
> function
> and have it done on_selected_cpus() and wait until all cpu time structures get
> updated. That perhaps would be better?

I think so - even if the risk of thee being a race right now is rather
low, that way you'd avoid this becoming a problem if secondary
CPUs get made do something other than idling at this point in time.

>>> @@ -1528,6 +1607,7 @@ void __init early_time_init(void)
>>>  
>>>  preinit_pit();
>>>  tmp = init_platform_timer();
>>> +plt_tsc.frequency = tmp;
>> 
>> How can this be the TSC frequency? init_platform_timer()
>> specifically skips the TSC. And I can see no other place where
>> plt_tsc.frequency gets initialized. Am I overlooking something?
>> 
> That's the calibrated TSC frequency. Before I was setting pts->frequency in
> init_tsctimer through a temporary variable called tsc_freq. So I thought I 
> could just
> drop the variable and set plt_tsc directly. The difference though from 
> previous
> versions is that since commit 9334029 this value is returned from platform 
> time
> source init() and calibrated against platform timer, instead of always 
> against PIT.

This doesn't seem to answer my primary question: Where does
plt_tsc.frequency get initialized now? try_platform_timer() and
init_platform_timer() don't - PIT and ACPI timer use static
initializers, and HEPT gets taken care of in init_hpet(), and hence so
should init_tsctimer() do (instead of just returning this apparently
never initialized value). And that's unrelated to what ->init() returns.

Jan

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


  1   2   >