Re: [Xen-devel] [PATCH] tools: work around collision of -O0 and -D_FORTIFY_SOURCE

2015-02-06 Thread Jan Beulich
 On 05.02.15 at 17:56, ian.jack...@eu.citrix.com wrote:
 Jan Beulich writes (Re: [PATCH] tools: work around collision of -O0 and 
  --- a/tools/Rules.mk
  +++ b/tools/Rules.mk
  @@ -56,7 +56,7 @@ SHLIB_libxenvchan  = -Wl,-rpath-link=$(XEN_LIBVCHAN)
   
   ifeq ($(debug),y)
   # Disable optimizations and enable debugging information for macros
  -CFLAGS += -O0 -g3
  +CFLAGS += -O0 -g3 $(PY_NOOPT_CFLAGS)
 
 Why would you do this for all of the tools build rather than just the
 python components?
 
 You're right.  This should be something like:
 
   CFLAGS += -O0 -g3
  +PY_CFLAGS += $(PY_NOOPT_CFLAGS)
 
 and including PY_CFLAGS in tools/python/Makefile etc.

Attached the patch I used for testing. While it works okay for me,
I guess the configure part will need further taking care of the
-Wp,-D... variant Don is seeing.

Jan


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


Re: [Xen-devel] [PATCH] tools: work around collision of -O0 and -D_FORTIFY_SOURCE

2015-02-06 Thread Jan Beulich
 On 06.02.15 at 09:19, jbeul...@suse.com wrote:
 Attached the patch I used for testing.

This time for real.

Jan

tools: work around collision of -O0 and -D_FORTIFY_SOURCE

Some systems have python-config include -D_FORTIFY_SOURCE in the
CFLAGS.  But -D_FORTIFY_SOURCE does not (currently) work with -O0, and
-O0 is enabled in debug builds (since 1166ecf781).  As a result, on
those systems, debug builds fail.

Work around this problem as follows:
 * In configure, detect -D_FORTIFY_SOURCE in $(python-config --cflags)
 * If detected, set the new autoconf substitution and make variable
   PY_NOOPT_CFLAGS to -O1.
 * In tools/Rules.mk, where we add -O0, also add PY_NOOPT_CFLAGS
   (which will override the -O0 with -O1 if required).

Overriding the -O0 is better than disabling Fortify because the
latter might have an adverse security impact.  A user who wants to
disable optimisation completely even for Python and also disable
Fortify can set the environment variable
EXTRA_CFLAGS_XEN_TOOLS='-U_FORTIFY_SOURCE -O0'

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
Reported-by: Jan Beulich jbeul...@suse.com

Limit no-optimization override to Python interface code.

Signed-off-by: Jan Beulich jbeul...@suse.com

--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -13,6 +13,7 @@ BISON   := @BISON@
 FLEX:= @FLEX@
 PYTHON  := @PYTHON@
 PYTHON_PATH := @PYTHONPATH@
+PY_NOOPT_CFLAGS := @PY_NOOPT_CFLAGS@
 PERL:= @PERL@
 CURL_CONFIG := @CURL@
 XML2_CONFIG := @XML@
--- /dev/null
+++ b/m4/python_fortify_noopt.m4
@@ -0,0 +1,29 @@
+dnl Defines PY_NOOPT_CFLAGS to either '' or -O1
+dnl
+
+dnl This is necessary because on some systems setup.py includes
+dnl -D_FORTIFY_SOURCE but have a -D_FORTIFY_SOURCE which breaks
+dnl with -O0.  On those systems we arrange to use -O1 for debug
+dnl builds instead.
+
+AC_DEFUN([AX_CHECK_PYTHON_FORTIFY_NOOPT], [
+AC_CACHE_CHECK([whether Python setup.py brokenly enables 
-D_FORTIFY_SOURCE],
+   [ax_cv_python_fortify],[
+ax_cv_python_fortify=no
+for arg in $($PYTHON-config --cflags); do
+case $arg in
+-D_FORTIFY_SOURCE=0) ax_cv_python_fortify=no ;;
+-D_FORTIFY_SOURCE=*) ax_cv_python_fortify=yes ;;
+*) ;;
+esac
+done
+])
+
+AS_IF([test x$ax_cv_python_fortify = xyes],[
+PY_NOOPT_CFLAGS=-O1
+], [
+PY_NOOPT_CFLAGS=''
+])
+
+AC_SUBST(PY_NOOPT_CFLAGS)
+])
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -57,6 +57,8 @@ SHLIB_libxenvchan  = -Wl,-rpath-link=$(X
 ifeq ($(debug),y)
 # Disable optimizations and enable debugging information for macros
 CFLAGS += -O0 -g3
+# But allow an override to -O0 in case Python enforces -D_FORTIFY_SOURCE=n.
+PY_CFLAGS += $(PY_NOOPT_CFLAGS)
 endif
 
 LIBXL_BLKTAP ?= $(CONFIG_BLKTAP2)
--- a/tools/configure
+++ b/tools/configure
@@ -652,6 +652,7 @@ PKG_CONFIG_LIBDIR
 PKG_CONFIG_PATH
 PKG_CONFIG
 CURSES_LIBS
+PY_NOOPT_CFLAGS
 EGREP
 GREP
 CPP
@@ -7043,6 +7044,38 @@ CPPFLAGS=$ac_previous_cppflags
 LDLFAGS=$ac_previous_ldflags
 
 
+{ $as_echo $as_me:${as_lineno-$LINENO}: checking whether Python setup.py 
brokenly enables -D_FORTIFY_SOURCE 5
+$as_echo_n checking whether Python setup.py brokenly enables 
-D_FORTIFY_SOURCE...  6; }
+if ${ax_cv_python_fortify+:} false; then :
+  $as_echo_n (cached)  6
+else
+
+ax_cv_python_fortify=no
+for arg in $($PYTHON-config --cflags); do
+case $arg in
+-D_FORTIFY_SOURCE=0) ax_cv_python_fortify=no ;;
+-D_FORTIFY_SOURCE=*) ax_cv_python_fortify=yes ;;
+*) ;;
+esac
+done
+
+fi
+{ $as_echo $as_me:${as_lineno-$LINENO}: result: $ax_cv_python_fortify 5
+$as_echo $ax_cv_python_fortify 6; }
+
+if test x$ax_cv_python_fortify = xyes; then :
+
+PY_NOOPT_CFLAGS=-O1
+
+else
+
+PY_NOOPT_CFLAGS=''
+
+fi
+
+
+
+
 fi
 
 if ! $rump; then
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -58,6 +58,7 @@ m4_include([../m4/checkpolicy.m4])
 m4_include([../m4/set_cflags_ldflags.m4])
 m4_include([../m4/python_version.m4])
 m4_include([../m4/python_devel.m4])
+m4_include([../m4/python_fortify_noopt.m4])
 m4_include([../m4/ocaml.m4])
 m4_include([../m4/uuid.m4])
 m4_include([../m4/pkg.m4])
@@ -295,6 +296,7 @@ AX_CHECK_PYTHON_VERSION([2], [3])
 
 AS_IF([test $cross_compiling != yes], [
 AX_CHECK_PYTHON_DEVEL()
+AX_CHECK_PYTHON_FORTIFY_NOOPT()
 ])
 
 if ! $rump; then
--- a/tools/pygrub/Makefile
+++ b/tools/pygrub/Makefile
@@ -2,15 +2,17 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS) $(APPEND_LDFLAGS)
+
 .PHONY: all
 all: build
 .PHONY: build
 build:
-   CC=$(CC) CFLAGS=$(CFLAGS) $(APPEND_LDFLAGS) $(PYTHON) setup.py build
+   CC=$(CC) CFLAGS=$(PY_CFLAGS) $(PYTHON) setup.py build
 
 .PHONY: install
 install: all
-   CC=$(CC) CFLAGS=$(CFLAGS) $(APPEND_LDFLAGS) 

Re: [Xen-devel] Xen Development for Dummies.

2015-02-06 Thread Pasi Kärkkäinen
On Fri, Feb 06, 2015 at 06:46:23AM +, Jason Long wrote:
 Hello Folks.
 I want to become a Xen developer and I don't have any knowledge about 
 development. Can you tell me what programming language is needed? How can I 
 start and etc?


Hello,

Xen is mostly written in C language, but there are other languages being used 
aswell.. obviously lowlevel assembly language for some architecture specific 
lowlevel stuff, and some highler level languages (OCaml) for certain components 
(oxenstored). Also various scripting languages are used, perl, python, etc. 

Also you need to know all the usual Linux/Unix commandline (development) tools.

-- Pasi

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

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


[Xen-devel] [OSSTEST PATCH 06/10] sg-run-job: testid generation: Introduce $testid_args

2015-02-06 Thread Ian Jackson
Rather than accumulating into host_testid_suffix directly, accumulate
into a list testid_args first.

No functional change: all we do is defer the construction of
host_testid_suffix, which is not used until later in this function.

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
---
 sg-run-job |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sg-run-job b/sg-run-job
index 68d6c65..5c192ab 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -117,19 +117,22 @@ proc spawn-ts {iffail testid ts args} {
 
 set real_args {}
 set adding 1
-set host_testid_suffix {}
+set testid_args {}
 foreach arg $args {
 if {![string compare + $arg]} {
 set adding [expr {!$adding}]
 continue
 }
 lappend real_args $arg
-if {$adding} { append host_testid_suffix /$arg }
+if {$adding} { lappend testid_args $arg }
 }
 
 regsub {^ts-} $ts {} deftestid
 append deftestid /@
 
+set host_testid_suffix {}
+foreach arg $testid_args { append host_testid_suffix /$arg }
+
 jobdb::spawn-step-begin $flight $jobinfo(job) $ts stepno
 
 if {[string match =* $testid]} {
-- 
1.7.10.4


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


[Xen-devel] [PATCH 00/10] Repeat rump kernel xenstorels test

2015-02-06 Thread Ian Jackson
This 10-patch series(!) arranges to repeat the xenstorels test 50
times.  In my ad-hoc tests this takes about 3 minutes so is clearly
fine from a resource POV.

This is in aid of debugging the problem seen in 33690 and 33416 (which
we think is the same).  However, in my ad-hoc tests it hasn't failed
even once (with the bits from flight 33866 which is after we think the
bug appeared).  I think it would be valuable to introduce this new
repeat test in any case.

The series is in four parts:

 - 01..03  Minor improvements in TestSupport.pm

 - 04..07 Changes to testid generation to give better control of the
   testid for tests done with the ts-repeat-test script from
   patch 08.

 - 08..10  Actually do the repetition

04..07 need a thorough full-flight test which I have not yet done.
But this sql rune suggests that nothing is horribly broken at least
for the rump test job:

  select * from (select testid,flight,stepno,step,status,started,finished from 
steps where flight=33866 and job='test-amd64-i386-rumpuserxen-i386') a full 
outer join (select * from steps where flight=34273 and 
job='test-amd64-i386-rumpuserxen-i386') b using (testid) order by b.stepno, 
a.stepno;


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


[Xen-devel] [OSSTEST PATCH 08/10] sg-run-job, etc.: Infrastructure for test script repetition

2015-02-06 Thread Ian Jackson
Provide:
 * ts-repeat-test, a script to run multiple other test scripts in a loop
 * repeat-ts, a proc in sg-run-job which invokes it

No callers yet.

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
---
 sg-run-job |4 
 ts-repeat-test |   66 
 2 files changed, 70 insertions(+)
 create mode 100755 ts-repeat-test

diff --git a/sg-run-job b/sg-run-job
index 070534d..0a49c93 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -103,6 +103,10 @@ proc run-ts {args} {
 if {![reap-ts $reap]} { error test script failed }
 }
 
+proc repeat-ts {reps testid args} {
+ eval [list run-ts . $testid + ts-repeat-test $reps +] $args
+}
+
 proc spawn-ts {iffail testid args} {
 global flight c jobinfo reap_details env
 
diff --git a/ts-repeat-test b/ts-repeat-test
new file mode 100755
index 000..e3b1426
--- /dev/null
+++ b/ts-repeat-test
@@ -0,0 +1,66 @@
+#!/usr/bin/perl -w
+#
+# usage:
+#   ./ts-repeat-test COUNT ARGSPECS...
+#   ./ts-repeat-test COUNT [-] ts-SCRIPT [ARGS...] [; ...]
+#
+# ts-SCRIPT  will be prefixed with ./ before execution
+# (provided it actually starts with `ts-')
+# ;  separates multiple scripts to be run
+# -  before script name means to ignore errors
+# \  at the start of any ARGSPEC is removed (after the checks above)
+
+use strict;
+use Osstest::TestSupport;
+
+use Data::Dumper;
+
+tsreadconfig();
+
+my $reps = shift @ARGV;
+die unless @ARGV  $reps =~ m/^\d+$/;
+
+my @cmdis = ();
+my $cmdi = { };
+# $cmds[]{L} = qw(./ts-foo-bar arg arg...);
+# $cmds[]{IgnoreError} = undef or 1
+
+push @ARGV, ';';
+
+foreach (@ARGV) {
+if ($_ eq ';') {
+   if (%$cmdi) {
+   push @cmdis, $cmdi;
+   $cmdi = { };
+   }
+} else {
+   if (!$cmdi-{L}) {
+   if ($_ eq '-') {
+   $cmdi-{IgnoreError} = 1;
+   next;
+   }
+   s#^(?=ts-)#./#;
+   }
+   s#^\\##;
+   push @{ $cmdi-{L} }, $_;
+}
+}
+
+my $dumper = new Data::Dumper [\@cmdis], [qw(*cmdis)];
+$dumper-Indent(0);
+print $dumper-Dump,\n;
+
+foreach my $rep (1..$reps) {
+logm(== rep $rep ==);
+foreach my $cmdi (@cmdis) {
+   my $l = $cmdi-{L};
+   logm(-- rep $rep @$l --);
+   my $r = system @$l;
+   if ($r) {
+   my $m = $l-[0]: .($r==-1 ? $! : status $?).\n;
+   if ($cmdi-{IgnoreError}) { warn $m; } else { die $m; }
+   }
+}
+}
+
+logm(== did $reps ==);
-- 
1.7.10.4


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


[Xen-devel] [OSSTEST PATCH 10/10] rump kernel tests: Repeat the xenstorels test 50 times

2015-02-06 Thread Ian Jackson
Add a new step which uses repeat-ts to run
ts-rumpuserxen-demo-xenstorels many times.

We have to run ts-guest-destroy-hard first each time, to destroy the
guest which might exist at each previous step.  To help with ad-hoc
debugging runs, we specify `-' on the destroy, so that if the destroy
fails (probably because the guest doesn't exist) we don't mind.

Strategically placed `+'s in the repeat-ts command line arrange that
the testid ends up being
   rumpuserxen-demo-xenstorels/xenstorels.repeat

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
---
 sg-run-job |3 +++
 1 file changed, 3 insertions(+)

diff --git a/sg-run-job b/sg-run-job
index 0a49c93..ebbf53f 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -327,6 +327,9 @@ proc run-job/test-rumpuserxen {} {
 set g xenstorels
 run-ts . =   ts-rumpuserxen-demo-setup  + host + $g
 run-ts . =   ts-rumpuserxen-demo-xenstorels + host + $g
+repeat-ts 50 =.repeat \
+ + - ts-guest-destroy-hardhost   $g \; + \
+ ts-rumpuserxen-demo-xenstorels + host + $g
 run-ts . =   ts-guest-destroy-hard  + host + $g
 }
 
-- 
1.7.10.4


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


Re: [Xen-devel] Xen Development for Dummies.

2015-02-06 Thread Jason Long
Thank you.
Can you answer my previous questions about Ocaml and C? Why Ocaml is unique and 
which part of Xen use it?
I know my questions are silly but I'm a dummies and I looked at amazon.com and 
found Tons of C book but which one is good?

Cheers.



On Friday, February 6, 2015 5:14 PM, Pasi Kärkkäinen pa...@iki.fi wrote:
On Fri, Feb 06, 2015 at 01:35:58PM +, Jason Long wrote:
 In your opinion, Can a normal user like me become a developer? 
 I must first start learning C or Ocaml? Can you recommend a book for both to 
 me? 
 Can you tell me why developers choose Ocaml and C? and not C++ or Python?


Xen hypervisor, like any other hypervisor, is a very low level piece of 
software.
Lowlevel software tends to be written in lowlevel languages, such as C and 
assembler.

Like said most of Xen is written in C, so you need to learn/know C.

You should first start with learning programming with C language, and the 
generic concepts of computer hardware,
operating systems, kernels, memory management, etc.

Something like a hypervisor, or an operating system kernel, is a quite complex 
beast,
so you should probably first start with something much easier and learn C 
properly in an easier project.
When you know C and Linux/Unix internals well you can continue working on Xen 
aswell.


-- Pasi


 Cheers.
 
 
 
 On Friday, February 6, 2015 2:46 AM, Pasi Kärkkäinen pa...@iki.fi wrote:
 On Fri, Feb 06, 2015 at 10:31:09AM +, Jason Long wrote:
  Can you tell me why Ocaml used? What is the features of this language? Why 
  not other?
  Excuse me, I'm a beginner in programming and can you show me some books or 
  reference step by step? I'm a dummies :(
 
 
 There are two different versions of xenstore-daemon (xenstored). 
 The earlier one, written in C, and the newer one, written in OCaml 
 (oxenstored).
 
 Note that this is just one of the many components in Xen. Most Xen components 
 are written in C.
 
 Here you have some slides about oxenstored:
 http://gazagnaire.org/pub/GH09.pdf
 
 
 -- Pasi
 
 
  Cheers.
  
  
  
  On Thursday, February 5, 2015 11:59 PM, Pasi Kärkkäinen pa...@iki.fi 
  wrote:
  On Fri, Feb 06, 2015 at 06:46:23AM +, Jason Long wrote:
   Hello Folks.
   I want to become a Xen developer and I don't have any knowledge about 
   development. Can you tell me what programming language is needed? How can 
   I start and etc?
  
  
  Hello,
  
  Xen is mostly written in C language, but there are other languages being 
  used aswell.. obviously lowlevel assembly language for some architecture 
  specific lowlevel stuff, and some highler level languages (OCaml) for 
  certain components (oxenstored). Also various scripting languages are used, 
  perl, python, etc. 
  
  Also you need to know all the usual Linux/Unix commandline (development) 
  tools.
  
  -- Pasi
  
  
   
   Tnx.
   
   ___
   Xen-devel mailing list
   Xen-devel@lists.xen.org
   http://lists.xen.org/xen-devel

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


[Xen-devel] [OSSTEST PATCH 03/10] TestSupport: Make next_unique_name count in decimal, not unary

2015-02-06 Thread Ian Jackson
Ie, we add `+counter' rather than an ever-longer series of `+'s.

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
---
 Osstest/TestSupport.pm |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 55541b1..8aed285 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -486,7 +486,8 @@ sub target_file_exists ($$) {
 
 sub next_unique_name ($) {
 my ($fnref) = @_;
-$$fnref .= '+';
+my $num = $$fnref =~ s/\+([1-9]\d*)$// ? $1 : 0;
+$$fnref .= '+'.($num+1);
 }
 
 our $target_editfile_cancel_exception =
-- 
1.7.10.4


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


[Xen-devel] [OSSTEST PATCH 04/10] tcl/osstestlib.tcl: Provide lshift

2015-02-06 Thread Ian Jackson
No callers yet.

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
---
 tcl/osstestlib.tcl |7 +++
 1 file changed, 7 insertions(+)

diff --git a/tcl/osstestlib.tcl b/tcl/osstestlib.tcl
index 1531c87..a0413c4 100644
--- a/tcl/osstestlib.tcl
+++ b/tcl/osstestlib.tcl
@@ -67,3 +67,10 @@ proc lremove {listvar item} {
 if {$ix0} return
 set list [lreplace $list $ix $ix]
 }
+
+proc lshift {listvar} {
+upvar 1 $listvar list
+set head [lindex $list 0]
+set list [lrange $list 1 end]
+return $head
+}
-- 
1.7.10.4


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


[Xen-devel] [OSSTEST PATCH 09/10] rump kernel tests: Cancel unneeded edits of guest config

2015-02-06 Thread Ian Jackson
If the guest config is already set up to preserve, cancel the edit.
We are going to repeat this test, and this avoids creating many
identical copies of the same file in the log output.

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
---
 ts-rumpuserxen-demo-xenstorels |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ts-rumpuserxen-demo-xenstorels b/ts-rumpuserxen-demo-xenstorels
index ed46843..a54fbf4 100755
--- a/ts-rumpuserxen-demo-xenstorels
+++ b/ts-rumpuserxen-demo-xenstorels
@@ -32,7 +32,11 @@ our $gn = $gho-{Guest};
 sub arrangepreserve () {
 target_editfile_root($ho,$r{$gho-{Guest}_cfgpath}, sub {
while (EI) {
-   next if m/^\s*on_poweroff\s*=/;
+   if (m/^\s*on_poweroff\s*=/) {
+   target_editfile_cancel(already configured to preserve)
+   if m/\bpreserve\b/;
+   next;
+   }
print EO or die $!;
}
print EO \n,on_poweroff='preserve'\n or die $!;
-- 
1.7.10.4


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


[Xen-devel] [OSSTEST PATCH 07/10] sg-run-job: testid generation: Process ts more like rest of args

2015-02-06 Thread Ian Jackson
Remove ts as a separate parameter to spawn-ts.  The test script now
becomes the first entry in args.

We process it through the arg loop as before.  Currently there are no
calls where the first arg is `+' so the test script name ends up in
both real_args and testid_args.

We split it out of real_args into the ts variable with lshift.
We split it out of testid_args into the deftestid with lshift.

So afterwards in spawn-ts, all the variables (including real_args, ts,
deftestid and testid_args and hence host_testid_suffix) have the
values they would have had before.

Therefore there is no functional change for any existing calls.

However, because the first argument is not treated specially for the
`+' procesing loop, it is now possible to specify `+' as the first
entry in args to spawn-ts (ie where ts used to be) to arrange that the
deftestid (and hence, probably, the testid) is computed using later
arguments.

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
---
 sg-run-job |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sg-run-job b/sg-run-job
index 5c192ab..070534d 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -103,12 +103,12 @@ proc run-ts {args} {
 if {![reap-ts $reap]} { error test script failed }
 }
 
-proc spawn-ts {iffail testid ts args} {
+proc spawn-ts {iffail testid args} {
 global flight c jobinfo reap_details env
 
 if {[file exists abort]} {
 jobdb::logputs stdout \
-aborting - not executing $flight.$jobinfo(job) $ts $args
+aborting - not executing $flight.$jobinfo(job) $args
 job-set-status $flight $jobinfo(job) aborted
 return {}
 }
@@ -127,7 +127,9 @@ proc spawn-ts {iffail testid ts args} {
 if {$adding} { lappend testid_args $arg }
 }
 
-regsub {^ts-} $ts {} deftestid
+set ts [lshift real_args]
+
+regsub {^ts-} [lshift testid_args] {} deftestid
 append deftestid /@
 
 set host_testid_suffix {}
-- 
1.7.10.4


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


[Xen-devel] [OSSTEST PATCH 05/10] sg-run-job: testid generation: Move spawn-step-begin

2015-02-06 Thread Ian Jackson
Run spawn-step-begin until after the loop over $args, and after the
computation of the basic deftestid.

No functional change: nothing in that loop looks at stepno.

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
---
 sg-run-job |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sg-run-job b/sg-run-job
index 2cf810a..68d6c65 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -115,8 +115,6 @@ proc spawn-ts {iffail testid ts args} {
 
 if {![string compare . $iffail]} { set iffail fail }
 
-jobdb::spawn-step-begin $flight $jobinfo(job) $ts stepno
-
 set real_args {}
 set adding 1
 set host_testid_suffix {}
@@ -132,6 +130,8 @@ proc spawn-ts {iffail testid ts args} {
 regsub {^ts-} $ts {} deftestid
 append deftestid /@
 
+jobdb::spawn-step-begin $flight $jobinfo(job) $ts stepno
+
 if {[string match =* $testid]} {
 set testid $deftestid[string range $testid 1 end]
 } elseif {![string compare $testid *]} {
-- 
1.7.10.4


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


[Xen-devel] [rumpuserxen test] 34212: regressions - FAIL

2015-02-06 Thread xen . org
flight 34212 rumpuserxen real [real]
http://www.chiark.greenend.org.uk/~xensrcts/logs/34212/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-i386-rumpuserxen6 xen-build fail REGR. vs. 33866
 build-amd64-rumpuserxen   6 xen-build fail REGR. vs. 33866

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-rumpuserxen-amd64  1 build-check(1)   blocked n/a
 test-amd64-i386-rumpuserxen-i386  1 build-check(1)   blocked  n/a

version targeted for testing:
 rumpuserxen  e28e2b9daf7ab2922913889d90ec438b9bee3d56
baseline version:
 rumpuserxen  30d72f3fc5e35cd53afd82c8179cc0e0b11146ad


People who touched revisions under test:
  Ian Jackson ian.jack...@eu.citrix.com
  Martin Lucina mar...@lucina.net


jobs:
 build-amd64  pass
 build-i386   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 build-amd64-rumpuserxen  fail
 build-i386-rumpuserxen   fail
 test-amd64-amd64-rumpuserxen-amd64   blocked 
 test-amd64-i386-rumpuserxen-i386 blocked 



sg-report-flight on osstest.cam.xci-test.com
logs: /home/xc_osstest/logs
images: /home/xc_osstest/images

Logs, config files, etc. are available at
http://www.chiark.greenend.org.uk/~xensrcts/logs

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


Not pushing.


commit e28e2b9daf7ab2922913889d90ec438b9bee3d56
Author: Ian Jackson ian.jack...@eu.citrix.com
Date:   Wed Feb 4 16:29:26 2015 +

app-tools: Support old -D__RUMPUSER_XEN__ for now

Released versions of Xen (Xen 4.5) rely on __RUMPUSER_XEN__ being
defined.

A patch to change this in Xen upstream exists and will be backported,
but until that makes it through to a stable point release of Xen 4.5,
we should support both #defines.

This commit partially reverts 91d56232d987
   Renaming platform macros, app-tools and autoconf target string

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
CC: Martin Lucina mar...@lucina.net
CC: Ian Campbell ian.campb...@eu.citrix.com
CC: Wei Liu wei.l...@citrix.com

commit 05e06b0fe52918d6575e33b7d7551d85c93f7aff
Author: Martin Lucina mar...@lucina.net
Date:   Mon Feb 2 18:01:52 2015 +0100

Sync Travis CI configuration with app-tools rename

Signed-off-by: Martin Lucina mar...@lucina.net

commit 3b36d1f55a08e1849ccd5424afb0fbe29647bd6c
Author: Martin Lucina mar...@lucina.net
Date:   Mon Feb 2 18:00:36 2015 +0100

Remove even older rumpxen-app-* variants of app-tools

Signed-off-by: Martin Lucina mar...@lucina.net

commit 91d56232d987f5df594723ed46b9000b4d43e21a
Author: Martin Lucina mar...@lucina.net
Date:   Mon Feb 2 17:52:41 2015 +0100

Renaming platform macros, app-tools and autoconf target string

As discussed at: http://thread.gmane.org/gmane.comp.rumpkernel.user/739

This commit renames the platform macros, app-tools and autoconf target
string to be consistent with current naming of the entire stack:

app-tools/rumpapp-xen-* - app-tools/rumprun-xen-*
$ARCH-rumpxen-netbsd - $ARCH-rumprun-netbsd
-D__RUMPUSER_XEN__ -D__RUMPAPP__ - -D__RUMPRUN__

Signed-off-by: Martin Lucina mar...@lucina.net

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


Re: [Xen-devel] Xen Development for Dummies.

2015-02-06 Thread Razvan Cojocaru
On 02/06/2015 09:17 PM, Jason Long wrote:
 I know my questions are silly but I'm a dummies and I looked at amazon.com 
 and found Tons of C book but which one is good?

The C Programming Language, by Brian W. Kernighan and Dennis M.
Ritchie: http://cm.bell-labs.com/cm/cs/cbook/


Cheers,
Razvan

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


[Xen-devel] vNUMA for PV guest: kernel and toolstack interaction regarding e820_host=1

2015-02-06 Thread Wei Liu
Hi all

I encounter a problem that I would like to get some advice. It's PV
specific because of the P2M manipulation is only required by PV.

Current scheme of memory allocation scheme:

1. Libxc populate contiguous chunk of pages and fill in initial P2M. The
   holes in e820 map are in fact filled with pages.

2. Guest kernel reads e820 map from Xen and remap pages in e820 holes if
   there are holes, update P2M as it sees fit. (That is normally true when
   e820_host=1 is set)

This is not very ideal for PV vNUMA, because those pages remapped may
end up in the wrong vnode.

What I have in mind is:

1. Libxc populates pages, but skips e820 holes. The initial P2M is the
   final P2M guest sees.
2. Guest kernel skips remapping. But Linux still needs to setup 1-1
   mapping for holes.

In order to avoid misconfiguration, we would need to introduce a new
feature flag to indicate guest has the ability to skip remapping. Libxc
will check that feature flag when building domain.

Does the above scheme make sense?

Wei.

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


Re: [Xen-devel] vNUMA for PV guest: kernel and toolstack interaction regarding e820_host=1

2015-02-06 Thread Wei Liu
On Fri, Feb 06, 2015 at 07:42:15PM +, David Vrabel wrote:
 On 06/02/15 19:32, Wei Liu wrote:
  Hi all
  
  I encounter a problem that I would like to get some advice. It's PV
  specific because of the P2M manipulation is only required by PV.
  
  Current scheme of memory allocation scheme:
  
  1. Libxc populate contiguous chunk of pages and fill in initial P2M. The
 holes in e820 map are in fact filled with pages.
  
  2. Guest kernel reads e820 map from Xen and remap pages in e820 holes if
 there are holes, update P2M as it sees fit. (That is normally true when
 e820_host=1 is set)
  
  This is not very ideal for PV vNUMA, because those pages remapped may
  end up in the wrong vnode.
  
  What I have in mind is:
  
  1. Libxc populates pages, but skips e820 holes. The initial P2M is the
 final P2M guest sees.
  2. Guest kernel skips remapping. But Linux still needs to setup 1-1
 mapping for holes.
  
  In order to avoid misconfiguration, we would need to introduce a new
  feature flag to indicate guest has the ability to skip remapping. Libxc
  will check that feature flag when building domain.
  
  Does the above scheme make sense?
 
 I really not keen on any additional complexity in PV guest memory setup.

I agree. I would like to avoid as much complexity as possible. That's
why I ask before implementing anything on guest side.

FWIW the tool stack side already makes sense to me (sans the new feature
flag). It's Linux that I'm not very sure of what to do.

  Particularly as I don't see a long term future for x86 PV guests.  I
 also don't think we should bake into the Xen ABI the behaviour of one
 particular guest.
 
 Consider how you can fix this purely in the guest.
 

Yeah, I guess I can make the memory movement more sensible inside Linux.
That is, take into consideration vNUMA information. There might be other
complex interactions, I will need to get my hands dirty first.

Now my conclusion is that I should proceed with my toolstack side patches
first and fix Linux later.

Wei.

 David

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


Re: [Xen-devel] [PATCH 00/10] Repeat rump kernel xenstorels test

2015-02-06 Thread Ian Jackson
Ian Jackson writes ([PATCH 00/10] Repeat rump kernel xenstorels test):
 04..07 need a thorough full-flight test which I have not yet done.
 But this sql rune suggests that nothing is horribly broken at least
 for the rump test job:
 
   select * from (select testid,flight,stepno,step,status,started,finished 
 from steps where flight=33866 and job='test-amd64-i386-rumpuserxen-i386') a 
 full outer join (select * from steps where flight=34273 and 
 job='test-amd64-i386-rumpuserxen-i386') b using (testid) order by b.stepno, 
 a.stepno;

For my own records: said full-flight test is now running as 34137.

Ian.

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


Re: [Xen-devel] vNUMA for PV guest: kernel and toolstack interaction regarding e820_host=1

2015-02-06 Thread David Vrabel
On 06/02/15 19:32, Wei Liu wrote:
 Hi all
 
 I encounter a problem that I would like to get some advice. It's PV
 specific because of the P2M manipulation is only required by PV.
 
 Current scheme of memory allocation scheme:
 
 1. Libxc populate contiguous chunk of pages and fill in initial P2M. The
holes in e820 map are in fact filled with pages.
 
 2. Guest kernel reads e820 map from Xen and remap pages in e820 holes if
there are holes, update P2M as it sees fit. (That is normally true when
e820_host=1 is set)
 
 This is not very ideal for PV vNUMA, because those pages remapped may
 end up in the wrong vnode.
 
 What I have in mind is:
 
 1. Libxc populates pages, but skips e820 holes. The initial P2M is the
final P2M guest sees.
 2. Guest kernel skips remapping. But Linux still needs to setup 1-1
mapping for holes.
 
 In order to avoid misconfiguration, we would need to introduce a new
 feature flag to indicate guest has the ability to skip remapping. Libxc
 will check that feature flag when building domain.
 
 Does the above scheme make sense?

I really not keen on any additional complexity in PV guest memory setup.
 Particularly as I don't see a long term future for x86 PV guests.  I
also don't think we should bake into the Xen ABI the behaviour of one
particular guest.

Consider how you can fix this purely in the guest.

David

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


Re: [Xen-devel] pvSCSI test

2015-02-06 Thread Kristian Hagsted Rasmussen

On Friday, February 6, 2015 15:25, Juergen Gross jgr...@suse.com wrote:
 To: Kristian Hagsted Rasmussen; Olaf Hering; xen-de...@lists.xensource.com
 Subject: Re: [Xen-devel] pvSCSI test
 

 After some more fiddling around, I believe the configuration should be okay. 
 My /etc/target/xen-pvscsi_start.sh look like this:

 modprobe xen-scsiback
 mkdir /sys/kernel/config/target/xen-pvscsi
 mkdir -p /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0
 echo naa.6001405708ab297e  
 /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/nexus
  xen-pvscsi Target Ports
 mkdir -p 
 /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/lun/lun_0
 ln -s 
 /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/lun/lun_0/../../../../../../target/core/iblock_0/3_0_0_0
  
 /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/lun/lun_0/xen-pvscsi_port
 
 iblock_0?
 
Sorry the result is the same if I use pscsi, I just tried iblock as it was a 
harddisk I tried to pass through and lio documentation advice against using 
pscsi for hard drives.

I just now tried to pass through a bluray drive on another machine, however I 
get the exact same error. What I noticed, however, was that the error only 
appears if the DomU kernel supports xen-scsifront. I hazzard a guess that this 
is because the backend only tries to connect to the device if the frontend 
makes a call for it.

In xenstore I have the following entry for vscsi under /local/domain/0/backend:
vscsi = 
 3 = 
  0 = 
   frontend = /local/domain/3/device/vscsi/0
   frontend-id = 3
   online = 1
   state = 4
   feature-host = 0
   vscsi-devs = 
dev-0 = 
 p-dev = 3:0:0:0
 v-dev = 0:0:0:0
 state = 6
   feature-sg-grant = 128

As I am no expert I am not sure about this, but shouldn't there be a path to 
the device, more then just the p-dev statement?

Do I have to manually add the device to xenstore?

If you do not feel for answering more of my questions please feel free to say 
so, I am just interested in this work and really look forward to its inclusion 
in xen.

/Kristian

 You are not using pscsi, but iblock. Is that on purpose? I have tested
 pscsi and fileio only.
 
 What does lsscsi tell you after adding the device via targetcli? I
 suppose you see a new scsi target you should use instead of 3:0:0:0
 (that's what I did in the fileio case).
 
  Attributes for xen-pvscsi Target Portal Group
  Parameters for xen-pvscsi Target Portal Group
 echo 3:0:0:0  
 /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/param/alias

 And
 cat 
 /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/param/alias
 returns 3:0:0:0 as expected.

 If I understand this correctly, it is xen-scsiback that reads the target 
 configuration from ConfigFS and hence the problem that xen-pvscsi cannot 
 find the device has nothing to do with which toolstack is used?
 
 Yes and no. In theory the backend would accept anything from xenstore
 which it can find in configfs. The toolstack however will only write
 values into the xenstore it believes are valid SCSI devices.
 
 If you are willing to part with the script you used together with targetcli, 
 I would be more then happy to try that out.
 
 I did my first tests with fileio on a machine I have no longer access
 to. after I got it running I changed to my local test machine and pscsi.
 Here I did the targetcli stuff manually and verified afterwards that
 the single steps I put in my script were working. So the script I gave
 you is basically the documentation of the manual setup I used.
 
 Juergen
 
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [OSSTEST PATCH 02/10] TestSupport: Introduce next_unique_name

2015-02-06 Thread Ian Jackson
No functional change.

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
---
 Osstest/TestSupport.pm |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 5a4c41f..55541b1 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -46,7 +46,7 @@ BEGIN {
 
   store_runvar get_runvar get_runvar_maybe
   get_runvar_default need_runvars flight_otherjob
-  unique_incrementing_runvar 
+  unique_incrementing_runvar next_unique_name
 
   target_cmd_root target_cmd target_cmd_build
   target_cmd_output_root target_cmd_output
@@ -484,6 +484,11 @@ sub target_file_exists ($$) {
 die $rfile $out ?;
 }
 
+sub next_unique_name ($) {
+my ($fnref) = @_;
+$$fnref .= '+';
+}
+
 our $target_editfile_cancel_exception =
 bless { }, 'Osstest::TestSupport::TargetEditfileCancelException';
 
@@ -509,7 +514,7 @@ sub teditfileex {
 $! == ENOENT or die $lfile $!;
 last;
 }
-$lleaf .= '+';
+next_unique_name \$lleaf;
 }
 if ($rdest eq $rfile) {
 logm(editing $rfile as $lfile.'{,.new}');
@@ -929,7 +934,7 @@ sub open_unique_stashfile ($) {
 $dh= new IO::File $stash/$df, O_WRONLY|O_EXCL|O_CREAT;
 last if $dh;
 die $df $! unless $!==EEXIST;
-$$leafref .= '+';
+next_unique_name $leafref;
 }
 return $dh;
 }
-- 
1.7.10.4


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


Re: [Xen-devel] [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-06 Thread Sasha Levin
On 02/06/2015 02:42 PM, Davidlohr Bueso wrote:
 On Fri, 2015-02-06 at 08:25 -0800, Linus Torvalds wrote:
 On Fri, Feb 6, 2015 at 6:49 AM, Raghavendra K T
 raghavendra...@linux.vnet.ibm.com wrote:
 Paravirt spinlock clears slowpath flag after doing unlock.
 [ fix edited out ]

 So I'm not going to be applying this for 3.19, because it's much too
 late and the patch is too scary. Plus the bug probably effectively
 never shows up in real life (it is probably easy to trigger the
 speculative *read* but probably never the actual speculative write
 after dropping the lock last).

 This will need a lot of testing by the paravirt people - both
 performance and correctness. So *maybe* for 3.20, but maybe for even
 later, and then marked for stable, of course.

 Are there any good paravirt stress-tests that people could run for
 extended times?
 
 locktorture inside a VM should give a proper pounding.

Would it catch lifetime issues too? I thought it just tests out correctness.

I tried it and other unrelated stuff broke. I'll send separate mails for that...


Thanks,
Sasha

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


Re: [Xen-devel] [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-06 Thread Sasha Levin
On 02/06/2015 09:49 AM, Raghavendra K T wrote:
 Paravirt spinlock clears slowpath flag after doing unlock.
 As explained by Linus currently it does:
 prev = *lock;
 add_smp(lock-tickets.head, TICKET_LOCK_INC);
 
 /* add_smp() is a full mb() */
 
 if (unlikely(lock-tickets.tail  TICKET_SLOWPATH_FLAG))
 __ticket_unlock_slowpath(lock, prev);
 
 
 which is *exactly* the kind of things you cannot do with spinlocks,
 because after you've done the add_smp() and released the spinlock
 for the fast-path, you can't access the spinlock any more.  Exactly
 because a fast-path lock might come in, and release the whole data
 structure.
 
 Linus suggested that we should not do any writes to lock after unlock(),
 and we can move slowpath clearing to fastpath lock.
 
 However it brings additional case to be handled, viz., slowpath still
 could be set when somebody does arch_trylock. Handle that too by ignoring
 slowpath flag during lock availability check.
 
 Reported-by: Sasha Levin sasha.le...@oracle.com
 Suggested-by: Linus Torvalds torva...@linux-foundation.org
 Signed-off-by: Raghavendra K T raghavendra...@linux.vnet.ibm.com

With this patch, my VMs lock up quickly after boot with:

[  161.613469] BUG: spinlock lockup suspected on CPU#31, kworker/31:1/5213
[  161.613469]  lock: purge_lock.28981+0x0/0x40, .magic: dead4ead, .owner: 
kworker/7:1/6400, .owner_cpu: 7
[  161.613469] CPU: 31 PID: 5213 Comm: kworker/31:1 Not tainted 
3.19.0-rc7-next-20150204-sasha-00048-gee3a350 #1869
[  161.613469] Workqueue: events bpf_prog_free_deferred
[  161.613469]   f03dd27f 88056b227a88 
a1702276
[  161.613469]   88017cf7 88056b227aa8 
9e1d009c
[  161.613469]  a3edae60 86c3f830 88056b227ad8 
9e1d01d7
[  161.613469] Call Trace:
[  161.613469] dump_stack (lib/dump_stack.c:52)
[  161.613469] spin_dump (kernel/locking/spinlock_debug.c:68 (discriminator 8))
[  161.613469] do_raw_spin_lock (include/linux/nmi.h:48 
kernel/locking/spinlock_debug.c:119 kernel/locking/spinlock_debug.c:137)
[  161.613469] _raw_spin_lock (kernel/locking/spinlock.c:152)
[  161.613469] ? __purge_vmap_area_lazy (mm/vmalloc.c:615)
[  161.613469] __purge_vmap_area_lazy (mm/vmalloc.c:615)
[  161.613469] ? vm_unmap_aliases (mm/vmalloc.c:1021)
[  161.613469] vm_unmap_aliases (mm/vmalloc.c:1052)
[  161.613469] ? vm_unmap_aliases (mm/vmalloc.c:1021)
[  161.613469] ? __lock_acquire (kernel/locking/lockdep.c:2019 
kernel/locking/lockdep.c:3184)
[  161.613469] change_page_attr_set_clr (arch/x86/mm/pageattr.c:1394)
[  161.613469] ? debug_object_deactivate (lib/debugobjects.c:463)
[  161.613469] set_memory_rw (arch/x86/mm/pageattr.c:1662)
[  161.613469] ? __lock_is_held (kernel/locking/lockdep.c:3518)
[  161.613469] bpf_jit_free (include/linux/filter.h:377 
arch/x86/net/bpf_jit_comp.c:991)
[  161.613469] bpf_prog_free_deferred (kernel/bpf/core.c:646)
[  161.613469] process_one_work (kernel/workqueue.c:2014 
include/linux/jump_label.h:114 include/trace/events/workqueue.h:111 
kernel/workqueue.c:2019)
[  161.613469] ? process_one_work (./arch/x86/include/asm/atomic64_64.h:33 
include/asm-generic/atomic-long.h:38 kernel/workqueue.c:598 
kernel/workqueue.c:625 kernel/workqueue.c:2007)
[  161.613469] worker_thread (include/linux/list.h:189 kernel/workqueue.c:2147)
[  161.613469] ? process_one_work (kernel/workqueue.c:2091)
[  161.613469] kthread (kernel/kthread.c:207)
[  161.613469] ? finish_task_switch (./arch/x86/include/asm/current.h:14 
kernel/sched/sched.h:1058 kernel/sched/core.c:2258)
[  161.613469] ? flush_kthread_work (kernel/kthread.c:176)
[  161.613469] ret_from_fork (arch/x86/kernel/entry_64.S:283)
[  161.613469] ? flush_kthread_work (kernel/kthread.c:176)

And a few soft lockup messages inside the scheduler after that.


Thanks,
Sasha



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


Re: [Xen-devel] [RFC 1/7] linux-stubdomain: Compile QEMU

2015-02-06 Thread Wei Liu
On Fri, Feb 06, 2015 at 12:25:33PM -0500, Eric Shelton wrote:
 On Fri, Feb 6, 2015 at 10:46 AM, Stefano Stabellini
 stefano.stabell...@eu.citrix.com wrote:
  On Tue, 3 Feb 2015, Eric Shelton wrote:
 
  Before having patches, I would like to try to get them upstream in QEMU.
  If we really cannot do that, then I would still prefer to commit any
  required workarounds to the qemu-xen rather than having them here as
  patches.
 
 Absolutely; the intent is to upstream the changes to QEMU, and
 eliminate the patching to QEMU being done in the patchset I sent out.
 I just need to sort out all of the QEMU changes first...
 
  diff --git a/stubdom-linux/qemu-xen-common.patch 
  b/stubdom-linux/qemu-xen-common.patch
  new file mode 100644
  index 000..b473e36
  --- /dev/null
  +++ b/stubdom-linux/qemu-xen-common.patch
  @@ -0,0 +1,12 @@
  +--- a/xen-common.c   2015-01-25 20:42:36.32998 -0500
   b/xen-common.c   2015-01-25 20:43:20.34663 -0500
  +@@ -92,7 +92,8 @@
  + exit(1);
  + }
  +
  +-snprintf(path, sizeof (path), device-model/%u/state, xen_domid);
  ++snprintf(path, sizeof (path),
  ++ /local/domain/0/device-model/%u/state, xen_domid);
 
  Even if this counts as a workaround, I think it could go upstream in
  QEMU.
 
 Agreed, although I will likely follow Wei's suggestion to use a
 /local/domain/{stubdom-id}/... path, instead of under dom0's tree in
 xenstore.
 

I guess if you don't use absolute path it should just writes to
/local/domain/$stubdom_id. (This has a restriction that it doesn't work
with xenstore connection opened with socket.)

Since you're at it, could you try to 

1) retain the relative path used here, so that it writes to ~ (from
   stubdom's PoV it is /local/domain/$stubdom_id, that's the theory)
2) modify patch 7/7 to use the /local/domain/$stubdom_id path.

My hunch is that it is not too complicated to retrieve stubdom_id in
libxl (it should be available somewhere).

A side note is that you may need to grant write permission the stubdom to
write to its own path. Search for XS_PERM_ in libxl_dm.c you will see
some place using /local/domain/0.

That's what I would do to tackle this whole problem. I haven't tried it
personally though (got distracted half way).

Wei.

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


Re: [Xen-devel] [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-06 Thread Davidlohr Bueso
On Fri, 2015-02-06 at 08:25 -0800, Linus Torvalds wrote:
 On Fri, Feb 6, 2015 at 6:49 AM, Raghavendra K T
 raghavendra...@linux.vnet.ibm.com wrote:
  Paravirt spinlock clears slowpath flag after doing unlock.
 [ fix edited out ]
 
 So I'm not going to be applying this for 3.19, because it's much too
 late and the patch is too scary. Plus the bug probably effectively
 never shows up in real life (it is probably easy to trigger the
 speculative *read* but probably never the actual speculative write
 after dropping the lock last).
 
 This will need a lot of testing by the paravirt people - both
 performance and correctness. So *maybe* for 3.20, but maybe for even
 later, and then marked for stable, of course.
 
 Are there any good paravirt stress-tests that people could run for
 extended times?

locktorture inside a VM should give a proper pounding.


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


Re: [Xen-devel] Xen's Linux kernel config options V2

2015-02-06 Thread Luis R. Rodriguez
On Wed, Feb 4, 2015 at 6:57 AM, Stefano Stabellini
stefano.stabell...@eu.citrix.com wrote:
 Given that there is no CONFIG_PV or CONFIG_PVH or even CONFIG_PVHVM on
 arm and arm64

I'll update CONFIG_XEN_PVHVM to be x86 specific, it already depends on
X86_LOCAL_APIC, so just updating it on the proposal to annotate it is
x86 specific.

  Luis

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


Re: [Xen-devel] Xen's Linux kernel config options V2

2015-02-06 Thread Luis R. Rodriguez
On Mon, Jan 19, 2015 at 5:28 AM, Ian Campbell ian.campb...@citrix.com wrote:
 In your list do the options which come under XEN or XEN_FRONTEND depend
 on the respective headline config option?

An indentation reflects a dependency on the above option.

 Luis

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


[Xen-devel] Xen's Linux kernel config options v3

2015-02-06 Thread Luis R. Rodriguez
This is a third respin for a design proposal for a rework on the config options
on the Linux kernel related to Xen. The frist two proposals came from Juergen,
I'm taking on the work now as some other work I am doing is related to this.
This third iteration addresses the feedback given on Juergen's last v2
proposal. Let me know if there are any questions or any further feedback before
we start addressing the changes.

Reasons to consider a cleanup / reorganizing of the kconfig options:

- Everything depends on Xen but that's obviously not right. For instance
  we want to be able to build Xen frontend drivers for HVM domains without
  the need for choosing a pvops kernel: currently the frontend drivers need
  Xen configured which depends on PARAVIRT.
- XEN should not depend on PAE, we can have HVM guests without PAE.
- Some features are available for x86 only, in spite of these not being
  architecture specific, e.g. XEN_DEBUG_FS
- Be able to build a Dom0 using XEN_PVH(x86) without having to configure
  XEN_HAVE_PVMMU(x86).

Current Xen related config options are as follows:

Legend:

- The first column are the Xen config options. Indentation in this
  column reflects the dependency between those options (e.g.
  XEN_SCSI_BACKEND depends on XEN_BACKEND, which in turn depends on
  XEN_DOM0, which depends on XEN).
- The second column shows the options which are selected automatically
  if the corresponding option in the first column is configured.
- The last column shows additional dependencies which can't be shown via
  the indentation level of the first column.
- Some options or dependencies are architecture specific, they are
  listed with the architecture requirements in parens (e.g. XEN_TMEM(x86)
  which is available for x86 only).
- Non-Xen options are mentioned only if they seem to be really relevant,
  like e.g. PARAVIRT or BROKEN.
- All listed options are user selectable, options which are not user selectable 
but
  automatic are prefixed with a '*' on the left hand side to make emphasis

Option  Selects Depends
-
XEN PARAVIRT_CLOCK(x86) PARAVIRT(x86)
XEN_HAVE_PVMMU(x86)
SWIOTLB_XEN(arm,arm64)
  PCI_XEN(x86)  SWIOTLB_XEN
  XEN_DOM0  PCI_XEN(x86)
XEN_BACKEND
  XEN_BLKDEV_BACKEND
  XEN_PCIDEV_BACKEND(x86)
  XEN_SCSI_BACKEND
  XEN_NETDEV_BACKEND
XEN_ACPI_HOTPLUG_MEMORY XEN_STUB
XEN_ACPI_HOTPLUG_CPUXEN_STUB
XEN_MCE_LOG(x86)
  XEN_ACPI_PROCESSOR(x86)   ACPI_PROCESSOR
CPU_FREQ
  XEN_PVHVM(x86)
XEN_PVH(x86)
  XEN_MAX_DOMAIN_MEMORY(x86)
  XEN_SAVE_RESTORE(x86)
  XEN_DEBUG_FS(x86)
  XEN_FBDEV_FRONTENDXEN_XENBUS_FRONTEND
INPUT_XEN_KBDDEV_FRONTEND
  XEN_BLKDEV_FRONTEND   XEN_XENBUS_FRONTEND
  HVC_XEN
HVC_XEN_FRONTENDXEN_XENBUS_FRONTEND
  TCG_XEN   XEN_XENBUS_FRONTEND
  XEN_PCIDEV_FRONTEND   PCI_XEN
XEN_XENBUS_FRONTEND
  XEN_SCSI_FRONTEND XEN_XENBUS_FRONTEND
  INPUT_XEN_KBDDEV_FRONTEND XEN_XENBUS_FRONTEND
  XEN_WDT
  XEN_BALLOON
XEN_SELFBALLOONING  XEN_TMEM
XEN_BALLOON_MEMORY_HOTPLUG
XEN_SCRUB_PAGES
  XEN_DEV_EVTCHN
  XENFS XEN_PRIVCMD
XEN_COMPAT_XENFS
  XEN_SYS_HYPERVISOR
  XEN_XENBUS_FRONTEND
  XEN_GNTDEV
  XEN_GRANT_DEV_ALLOC
  SWIOTLB_XEN
  XEN_TMEM(x86)
  XEN_PRIVCMD
  XEN_STUB(x86_64)  BROKEN
  XEN_ACPI_PROCESSOR(x86)
  XEN_HAVE_PVMMU
  XEN_EFI(x64)
  XEN_NETDEV_FRONTEND   XEN_XENBUS_FRONTEND

After some feedback for the first draft I'd suggest the following:

Option  Selects Depends
--
XEN
  XEN_PV(x86)   XEN_HAVE_PVMMU(x86)
PARAVIRT
PARAVIRT_CLOCK
  XEN_PVH(x86)  XEN_PVHVM
PARAVIRT
PARAVIRT_CLOCK
  XEN_PVHVM(x86)PARAVIRT
PARAVIRT_CLOCK
  XEN_BACKEND   SWIOTLB_XEN(arm,arm64)  XEN_PV(x86) ||
XEN_PVH(x86) ||
XEN_PVHVM(x86)
XEN_TMEM(x86)
XEN_PRIVCMD
XEN_BLKDEV_BACKEND
XEN_PCIDEV_BACKEND(x86)
XEN_SCSI_BACKEND
XEN_NETDEV_BACKEND
  PCI_XEN(x86)  SWIOTLB_XEN
  XEN_DOM0  

Re: [Xen-devel] [PATCH v3 0/2] x86/arm64: add xenconfig

2015-02-06 Thread Luis R. Rodriguez
On Mon, Feb 2, 2015 at 1:32 PM, Luis R. Rodriguez
mcg...@do-not-panic.com wrote:
 On Mon, Feb 2, 2015 at 1:13 PM, Michal Marek mma...@suse.cz wrote:
 Dne 30.1.2015 v 19:25 Luis R. Rodriguez napsal(a):
 On Fri, Jan 30, 2015 at 2:49 AM, Michal Marek mma...@suse.cz wrote:
 On 2015-01-29 21:47, Paul Bolle wrote:
 [Added Michal. Removed Yann.]

 On Thu, 2015-01-29 at 12:38 -0800, Luis R. Rodriguez wrote:
 On Tue, Jan 27, 2015 at 12:00 PM, Luis R. Rodriguez mcg...@suse.com 
 wrote:
 On Fri, Jan 23, 2015 at 03:19:25PM +, Stefano Stabellini wrote:
 On Fri, 23 Jan 2015, Luis R. Rodriguez wrote:
 On Wed, Jan 14, 2015 at 11:33:45AM -0800, Luis R. Rodriguez wrote:
 From: Luis R. Rodriguez mcg...@suse.com

 This v3 addresses Stefano's feedback from the v2 series, namely
 moving PCI stuff to x86 as its all x86 specific and also just
 removing the CONFIG_TCG_XEN=m from the general config. To be
 clear the changes from the v2 series are below.

 Luis R. Rodriguez (2):
   x86, platform, xen, kconfig: clarify kvmconfig is for kvm
   x86, arm, platform, xen, kconfig: add xen defconfig helper

  arch/x86/configs/xen.config | 10 ++
  kernel/configs/xen.config   | 26 ++
  scripts/kconfig/Makefile|  7 ++-
  3 files changed, 42 insertions(+), 1 deletion(-)
  create mode 100644 arch/x86/configs/xen.config
  create mode 100644 kernel/configs/xen.config

 Who could these changes go through?

 I would be OK with taking it in the Xen tree, but I would feel more
 comfortable doing that if you had an ack from Yann Morin (CC'ed).

 *Poke*

 Hey Yann, wondering if you had any feedback. Thanks.

 Yann has disappeared a year ago. Michal now, informally, keeps an eye on
 kconfig related patches.

 I did not see this. Can you please bounce me the original series?

 Done, let me know if you did not get them

 I got them, sorry for the delay. You can add Acked-by: Michal Marek
 mma...@suse.cz if you want.

 Thanks Michal, what tree should this go through though?

David should this go through your tree? Can anyone provide pointers?

 Luis

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


[Xen-devel] [linux-3.10 test] 34210: regressions - FAIL

2015-02-06 Thread xen . org
flight 34210 linux-3.10 real [real]
http://www.chiark.greenend.org.uk/~xensrcts/logs/34210/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-amd64-amd64-xl-qemut-winxpsp3  7 windows-install fail REGR. vs. 26303

Tests which are failing intermittently (not blocking):
 test-amd64-i386-xl-qemut-win7-amd64  7 windows-install  fail pass in 34094
 test-amd64-amd64-xl-qemuu-ovmf-amd64 7 debian-hvm-install fail in 34094 pass 
in 34210

Regressions which are regarded as allowable (not blocking):
 test-amd64-amd64-rumpuserxen-amd64 11 rumpuserxen-demo-xenstorels/xenstorels 
fail blocked in 26303
 test-amd64-i386-pair17 guest-migrate/src_host/dst_host fail like 26303
 test-amd64-amd64-xl-winxpsp3  7 windows-install  fail   like 26303
 test-amd64-i386-libvirt   9 guest-start   fail in 34094 like 26303
 test-amd64-amd64-libvirt  9 guest-start   fail in 34094 like 26303

Tests which did not succeed, but are not blocking:
 test-amd64-i386-libvirt  10 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-pvh-amd   9 guest-start  fail   never pass
 test-amd64-amd64-xl-pcipt-intel  9 guest-start fail never pass
 test-amd64-amd64-xl-pvh-intel  9 guest-start  fail  never pass
 test-armhf-armhf-xl-credit2   5 xen-boot fail   never pass
 test-armhf-armhf-xl-sedf-pin  5 xen-boot fail   never pass
 test-armhf-armhf-xl-midway5 xen-boot fail   never pass
 test-armhf-armhf-xl-sedf  5 xen-boot fail   never pass
 test-armhf-armhf-xl   5 xen-boot fail   never pass
 test-armhf-armhf-libvirt  5 xen-boot fail   never pass
 test-armhf-armhf-xl-multivcpu  5 xen-boot fail  never pass
 test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 14 guest-stop fail never pass
 test-amd64-i386-xl-winxpsp3-vcpus1 14 guest-stop   fail never pass
 test-amd64-amd64-xl-qemuu-winxpsp3 14 guest-stop   fail never pass
 test-amd64-amd64-libvirt 10 migrate-support-checkfail   never pass
 test-amd64-i386-xl-qemuu-win7-amd64 14 guest-stop  fail never pass
 test-amd64-i386-xl-win7-amd64 14 guest-stop   fail  never pass
 test-amd64-i386-xl-winxpsp3  14 guest-stop   fail   never pass
 test-amd64-amd64-xl-win7-amd64 14 guest-stop   fail never pass
 test-amd64-i386-xl-qemut-winxpsp3 14 guest-stopfail never pass
 test-amd64-amd64-xl-qemuu-win7-amd64 14 guest-stop fail never pass
 test-amd64-i386-xl-qemut-winxpsp3-vcpus1 14 guest-stop fail never pass
 test-amd64-i386-xl-qemuu-winxpsp3 14 guest-stopfail never pass
 test-amd64-amd64-xl-qemut-win7-amd64 14 guest-stop fail never pass
 test-amd64-i386-xl-qemut-win7-amd64 14 guest-stop fail in 34094 never pass

version targeted for testing:
 linux4227cffc1f9e4a9241071354476c225705b614c8
baseline version:
 linuxbe67db109090b17b56eb8eb2190cd70700f107aa


879 people touched revisions under test,
not listing them all


jobs:
 build-amd64  pass
 build-armhf  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-armhf-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-armhf-pvopspass
 build-i386-pvops pass
 build-amd64-rumpuserxen  pass
 build-i386-rumpuserxen   pass
 test-amd64-amd64-xl  pass
 test-armhf-armhf-xl  fail
 test-amd64-i386-xl   pass
 test-amd64-amd64-xl-pvh-amd  fail
 test-amd64-i386-rhel6hvm-amd pass
 test-amd64-i386-qemut-rhel6hvm-amd   pass
 test-amd64-i386-qemuu-rhel6hvm-amd   pass
 test-amd64-amd64-xl-qemut-debianhvm-amd64pass
 test-amd64-i386-xl-qemut-debianhvm-amd64 pass
 test-amd64-amd64-xl-qemuu-debianhvm-amd64pass
 test-amd64-i386-xl-qemuu-debianhvm-amd64 pass
 test-amd64-i386-freebsd10-amd64

Re: [Xen-devel] Xen's Linux kernel config options V2

2015-02-06 Thread Luis R. Rodriguez
On Fri, Feb 6, 2015 at 4:07 AM, Stefano Stabellini
stefano.stabell...@eu.citrix.com wrote:
 On Thu, 5 Feb 2015, Luis R. Rodriguez wrote:
 On Wed, Feb 4, 2015 at 6:57 AM, Stefano Stabellini
 stefano.stabell...@eu.citrix.com wrote:
  On Wed, 4 Feb 2015, David Vrabel wrote:
  On 16/12/14 16:21, Juergen Gross wrote:
   Hi,
  
   This is a design proposal for a rework of the config options on the
   Linux kernel which are related to Xen.
  
   The need to do so arose from the fact that it is currently not
   possible to build the Xen frontend drivers for a non-pvops kernel,
   e.g. to run them in a HVM-domain. There are more drawbacks in the
   current config options to which I'll come later.
  
   Option  Selects Depends
   --
   XEN
 XEN_PV(x86)   XEN_HAVE_PVMMU
   PARAVIRT
   PARAVIRT_CLOCK
 XEN_PVH(x86)  XEN_PVHVM
   PARAVIRT
   PARAVIRT_CLOCK
 XEN_PVHVM PARAVIRT
   PARAVIRT_CLOCK
 
  PARAVIRT_CLOCK and PARAVIRT are x86 specific.
  Given that there is no CONFIG_PV or CONFIG_PVH or even CONFIG_PVHVM on
  arm and arm64 as there is just one type of guest, I would rather just
  have CONFIG_XEN there.

 Interesting, right now we have as part of the recommended change for
 XEN_BACKEND:

 Option  Selects Depends
 --
 XEN
   XEN_BACKEND   SWIOTLB_XEN(arm,arm64)  XEN_PV(x86) ||
 XEN_PVH(x86) ||
 XEN_PVHVM

 How would we ensure to enable XEN_BACKEND for arm then?

 I thought that you wanted to turn XEN_BACKEND into a user selectable
 option.  On arm and arm64 this option wouldn't depend on anything
 (except CONFIG_XEN).

OK sure, that maps to this dependency list then:

ARM || ARM64 || ( X86  (XEN_PV || XEN_PVH || XEN_PVHVM )

 XEN_BACKEND   SWIOTLB_XEN(arm,arm64)  XEN_PV(x86) ||
   XEN_PVH(x86) ||
   XEN_PVHVM
   XEN_BLKDEV_BACKEND
   XEN_PCIDEV_BACKEND(x86)
   XEN_SCSI_BACKEND
   XEN_NETDEV_BACKEND
 PCI_XEN(x86)  SWIOTLB_XEN
 XEN_DOM0  XEN_BACKEND XEN_PV(x86) ||
   PCI_XEN(x86)XEN_PVH(x86)
   XEN_ACPI_HOTPLUG_MEMORY XEN_STUB
   XEN_ACPI_HOTPLUG_CPUXEN_STUB
   XEN_MCE_LOG(x86)
 XEN_MAX_DOMAIN_MEMORY(x86)
 XEN_SAVE_RESTORE(x86)
 XEN_DEBUG_FS
 XEN_WDT
 XEN_BALLOON
   XEN_SELFBALLOONING  XEN_TMEM
   XEN_BALLOON_MEMORY_HOTPLUG
   XEN_SCRUB_PAGES
 XENFS XEN_PRIVCMD
   XEN_COMPAT_XENFS
 XEN_SYS_HYPERVISOR
 XEN_DEV_EVTCHN
 XEN_GNTDEV
 XEN_GRANT_DEV_ALLOC
 SWIOTLB_XEN
 XEN_TMEM
 
  not available on arm and arm64

 Can you clarify if you meant only XEN_TMEM or all the above here?

 Only TMEM, sorry for being terse

That was listed as one of the example Kconfig entries which are
currently not available on other architectures despite not being
architecture specific, the other one being XEN_DEBUG_FS. So to be
clear -- do we not want XEN_TMEM for arm in the future ?

 XEN_PRIVCMD
 XEN_STUB(x86_64)  BROKEN
 XEN_ACPI_PROCESSOR(x86)
 XEN_HAVE_PVMMU
 
  x86 specific

 Likewise, all of the above quoted options ?

 only XEN_HAVE_PVMMU

Updated.

 XEN_EFI(x64)
 
  FYI soon to be available on arm

 OK thanks.

 XEN_XENBUS_FRONTEND
   XEN_FRONTENDXEN
   XEN_XENBUS_FRONTEND
 XEN_FBDEV_FRONTENDINPUT_XEN_KBDDEV_FRONTEND
 XEN_BLKDEV_FRONTEND
 HVC_XEN_FRONTEND  HVC_XEN
 TCG_XEN
 XEN_PCIDEV_FRONTEND   PCI_XEN
 
  x86 specific for the moment

 All?

 XEN_PCIDEV_FRONTEND and PCI_XEN

Updated.

 XEN_SCSI_FRONTEND
 INPUT_XEN_KBDDEV_FRONTEND
 XEN_NETDEV_FRONTEND
 XEN_PLATFORM_PCI
 
  definitely x86 only

 All?

 only XEN_PLATFORM_PCI

Updated.

 Luis

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


Re: [Xen-devel] [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-06 Thread Davidlohr Bueso
On Fri, 2015-02-06 at 16:15 -0500, Sasha Levin wrote:
 On 02/06/2015 02:42 PM, Davidlohr Bueso wrote:
  On Fri, 2015-02-06 at 08:25 -0800, Linus Torvalds wrote:
  On Fri, Feb 6, 2015 at 6:49 AM, Raghavendra K T
  raghavendra...@linux.vnet.ibm.com wrote:
  Paravirt spinlock clears slowpath flag after doing unlock.
  [ fix edited out ]
 
  So I'm not going to be applying this for 3.19, because it's much too
  late and the patch is too scary. Plus the bug probably effectively
  never shows up in real life (it is probably easy to trigger the
  speculative *read* but probably never the actual speculative write
  after dropping the lock last).
 
  This will need a lot of testing by the paravirt people - both
  performance and correctness. So *maybe* for 3.20, but maybe for even
  later, and then marked for stable, of course.
 
  Are there any good paravirt stress-tests that people could run for
  extended times?
  
  locktorture inside a VM should give a proper pounding.
 
 Would it catch lifetime issues too? I thought it just tests out correctness.

Given enough contention it should, yeah. The spinlock can be acquired by
another thread right after releasing the lock in the unlock's slowpath.
And all locktorture does is pound on locks with random hold times.

Thanks,
Davidlohr


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


Re: [Xen-devel] Xen's Linux kernel config options V2

2015-02-06 Thread Luis R. Rodriguez
On Mon, Jan 19, 2015 at 5:28 AM, Ian Campbell ian.campb...@citrix.com wrote:
 Could you annotate (maybe not a new column, perhaps with a * or
 something) which options are supposed to be user-visible vs purely
 internal things which can be selected?

All options listed will be user selectable unless otherwise noted with
a (*) in the next iteration.

 Luis

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


[Xen-devel] [ovmf test] 34196: regressions - FAIL

2015-02-06 Thread xen . org
flight 34196 ovmf real [real]
http://www.chiark.greenend.org.uk/~xensrcts/logs/34196/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-amd64-amd64-xl-qemuu-ovmf-amd64 7 debian-hvm-install fail REGR. vs. 33686
 test-amd64-i386-xl-qemuu-ovmf-amd64  7 debian-hvm-install fail REGR. vs. 33686
 test-amd64-i386-libvirt   5 xen-boot  fail REGR. vs. 33686

Regressions which are regarded as allowable (not blocking):
 test-amd64-amd64-xl-sedf 15 guest-localmigrate/x10fail REGR. vs. 33686

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-xl-pvh-intel  9 guest-start  fail  never pass
 test-amd64-amd64-libvirt 10 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-pvh-amd   9 guest-start  fail   never pass
 test-amd64-amd64-xl-pcipt-intel  9 guest-start fail never pass
 test-amd64-i386-xl-qemut-win7-amd64 14 guest-stop  fail never pass
 test-amd64-amd64-xl-qemut-win7-amd64 14 guest-stop fail never pass
 test-amd64-amd64-xl-qemuu-win7-amd64 14 guest-stop fail never pass
 test-amd64-i386-xl-win7-amd64 14 guest-stop   fail  never pass
 test-amd64-i386-xl-winxpsp3  14 guest-stop   fail   never pass
 test-amd64-i386-xl-qemuu-win7-amd64 14 guest-stop  fail never pass
 test-amd64-amd64-xl-win7-amd64 14 guest-stop   fail never pass
 test-amd64-i386-xl-qemut-winxpsp3-vcpus1 14 guest-stop fail never pass
 test-amd64-amd64-xl-winxpsp3 14 guest-stop   fail   never pass
 test-amd64-i386-xl-qemuu-winxpsp3 14 guest-stopfail never pass
 test-amd64-i386-xl-winxpsp3-vcpus1 14 guest-stop   fail never pass
 test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 14 guest-stop fail never pass
 test-amd64-i386-xl-qemut-winxpsp3 14 guest-stopfail never pass
 test-amd64-amd64-xl-qemut-winxpsp3 14 guest-stop   fail never pass
 test-amd64-amd64-xl-qemuu-winxpsp3  7 windows-install  fail never pass

version targeted for testing:
 ovmf 0e40240230fe51cc1890ec90d6f602046a3d8a77
baseline version:
 ovmf 447d264115c476142f884af0be287622cd244423


People who touched revisions under test:
  Gao, Liming liming@intel.com
  Long, Qin qin.l...@intel.com
  Yao, Jiewen jiewen@intel.com
  Aaron Pop aar...@ami.com
  Abner Chang abner.ch...@hp.com
  Alex Williamson alex.william...@redhat.com
  Anderw Fish af...@apple.com
  Andrew Fish af...@apple.com
  Anthony PERARD anthony.per...@citrix.com
  Ard Biesheuvel ard.biesheu...@linaro.org
  Ari Zigler a...@mellanox.com
  Brendan Jackman brendan.jack...@arm.com
  Bruce Cran bruce.c...@gmail.com
  Cecil Sheng cecil.sh...@hp.com
  Chao Zhang chao.b.zh...@intel.com
  Chao, Zhang chao.b.zh...@intel.com
  Chen Fan chen.fan.f...@cn.fujitsu.com
  Chris Phillips chr...@hp.com
  Chris Ruffin chris.ruf...@intel.com
  Cinnamon Shia cinnamon.s...@hp.com
  Daryl McDaniel  daryl.mcdan...@intel.com
  Daryl McDaniel daryl.mcdan...@intel.com
  daryl.mcdaniel daryl.mcdan...@intel.com
  daryl.mcdan...@intel.com
  darylm503 darylm503@Edk2
  David Wei david@intel.com
  David Woodhouse david.woodho...@intel.com
  Deric Cole deric_c...@phoenix.com
  Dong Eric eric.d...@intel.com
  Dong Guo guo.d...@intel.com
  Dong, Guo guo.d...@intel.com
  Elvin Li elvin...@intel.com
  Eric Dong eric.d...@intel.com
  Eugene Cohen eug...@hp.com
  Feng Tian feng.t...@intel.com
  Feng, Bob C bob.c.f...@intel.com
  Fu Siyuan siyuan...@intel.com
  Fu, Siyuan siyuan...@intel.com
  Gabriel Somlo so...@cmu.edu
  Gao, Liming liming@intel.com
  Gao, Liming liming.gao Gao, Liming liming@intel.com
  Gao, Liming liming@intel.com
  Garrett Kirkendall garrett.kirkend...@amd.com
  Gary Lin g...@suse.com
  Grzegorz Milos gm...@cam.ac.uk
  Hao Wu hao.a...@intel.com
  Harry Liebel harry.lie...@arm.com
  Hess Chen hesheng.c...@intel.com
  Hot Tian hot.t...@intel.com
  isakov-sl isakov...@bk.ru
  isakov...@bk.ru
  Jaben Carsey jaben.car...@intel.com
  jcarsey jcarsey
  jcarsey jcarsey@Edk2
  Jeff Bobzin (jeff.bobzin Jeff Bobzin (jeff.bob...@insyde.com)
  Jeff Bobzin (jeff.bob...@insyde.com)
  Jeff Fan jeff@intel.com
  Jiewen Yao jiewen@intel.com
  Joe Peterson joe.peter...@intel.com
  Jordan Justen jordan.l.jus...@intel.com
  jyao1 jyao1
  jyao1 jyao1@Edk2
  Kinney, Michael D michael.d.kin...@intel.com
  Larry Cleeton lclee...@microsoft.com
  Laszlo Ersek ler...@redhat.com
  Leandro G. Biss Becker lbec...@positivo.com.br
  Lee Leahy leroy.p.le...@intel.com
  Leif Lindholm leif.lindh...@linaro.org
  leroy.p.leahy leroy.p.le...@intel.com
  leroy.p.le...@intel.com
  lhauch larry.ha...@intel.com
  Li, Elvin elvin...@intel.com
  Liming Gao liming@intel.com
  Long Qin qin.l...@intel.com
  Long, Qin  

Re: [Xen-devel] [Embedded-pv-devel] [PATCH v6] sndif: add ABI for Para-virtual sound

2015-02-06 Thread Oleksandr Dmytryshyn
Hi, Stefano.

Currently we have this configuration:
Dom0, DomD (driver domain), DomU (Android).
Sound driver is inside DomD. Backend uses ALSA for playback/capture.

On Thu, Feb 5, 2015 at 9:47 PM, Stefano Panella
stefano.pane...@citrix.com wrote:
 Hi all,

 First of all I would like to say that:
 - I am happy that PV audio is finding its way into xen and there is active 
 development on it
 - Defining a flexible and future proof PV audio protocol is very hard and 
 will probably take a bit of trial and error in the beginning.
 - I hope I will be able to save some time in the trial and error process 
 sharing a bit of my xen audio related experiences.

 I had a look at the patches sent and even if I am sure they are solving in a 
 practical way a specific use case scenario, the protocol specified does not 
 look general enough in my opinion and it does many assumptions which might or 
 not be acceptable.

 Also I could not find any discussion around the actual design of the protocol 
 including motivations and scope.

 I would like to think one could break the design protocol of a PV driver in 
 different areas where different people can contribute at different levels 
 bringing their particular expertise.

 Anyway, first it would be good to start a discussion around some basic 
 questions and then we could go into more detail.

 - what is the aim of the protocol? Just pipe some sort of sound data from 
 guest and dom0 or expose the guest with a real xen PV soundcard?
The aim is to expose the guest with a real xen PV soundcard.

 - how general/granular/configurable should it be in term of the potentially 
 many and different sound devices present in dom0?
Each sound device in DomD has own name and it is mapped to the selected
sound device of the PV soundcard in the frontend. I'll little rework the stream
mappings description in this protocol in the next patch-set.

 - audio, differently from any other Xen PV driver, is a real-time thing, 
 should this be reflected in the protocol? Most sound driver API require to 
 know when a particular sound sample is played on the Speaker or how old is a 
 sample coming from a Mic (particularly useful for Acoustic Echo Cancellation)
I don't know exactly how reflect it in the protocol. My PV driver adds
additional latency which is comparable to the context switching.

 - Should the protocol allow the backend to publish many capabilities so the 
 frontend can chose how to best use them?
Yes, it should. Maybe this should be added a bit later to the protocol.
At first it will be simple version of the protocol description.

 - how easy/feasible would be to write frontend and backend drivers using the 
 protocol for different OSs?
It is feasible to write backend and frontend drivers.
The main work should be done:
1. Learn how use ALSA to play/capture data (if ALSA is used for backend driver)
2. Learn how to create and use an virtual soundcard in selected OS
(linux, unix, etc.)
3. Learn how use an event channel and shared memory.

 - would the protocol map well with the current major sound driver models and 
 API for the different guest Oss? (linux alsa driver, Windows WaveCiclic or 
 WaveRT etc..)
At least the protocol map would be well with the alsa-like drivers
(Linux, QNX). BTW we've written a test version of the PV sound frontend
which works on the QNX. Unfurtunatelly I don't know about Windows WaveCiclic


 I hope these questions will help moving the conversation in a constructive 
 and productive way for now :)

 Stefano

 -Original Message-
 From: Dario Faggioli [mailto:dario.faggi...@citrix.com]
 Sent: Monday, February 2, 2015 6:52 PM
 To: Oleksandr Dmytryshyn
 Cc: xen-devel@lists.xen.org; embedded-pv-de...@lists.xenproject.org; Iurii 
 Konovalenko; Keir (Xen.org); Ian Campbell; Tim (Xen.org); Ian Jackson; Jan 
 Beulich; Stefano Panella
 Subject: Re: [Embedded-pv-devel] [PATCH v6] sndif: add ABI for Para-virtual 
 sound

 On Thu, 2015-01-29 at 13:01 +0200, Oleksandr Dmytryshyn wrote:
 This is ABI for the two halves of a Para-virtual sound driver to
 communicate with each to other.

 I wonder whether Stefano (Cc-ed), which has a great deal of experience with 
 --real, virtual and paravirtual-- audio, could find a few minutes to have a 
 look and help us here, by saying what he thinks :-)

 Stefano, a bit of context (Oleksandr and Iurii, can add more, if needed, I'm 
 sure):

 http://marc.info/?l=xen-develm=142165575819173
 http://marc.info/?l=xen-develm=142194015107046

 Thanks and Regards,
 Dario

 --
 This happens because I choose it to happen! (Raistlin Majere)
 -
 Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software 
 Engineer, Citrix Systems RD Ltd., Cambridge (UK)


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


Re: [Xen-devel] [PATCH 0/2] xen: cleanup sysfs management

2015-02-06 Thread David Vrabel
On 05/02/15 20:38, Takashi Iwai wrote:
 Hi,
 
 this is a couple of patchset to clean up the sysfs entry creation /
 removal in xen driver codes.  They are relatively straightforward
 conversion patches, where manual function calls are replaced with
 static attribute groups.

These look fine but they're a bit late for 3.20.

David

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


[Xen-devel] [xen-unstable test] 34181: regressions - FAIL

2015-02-06 Thread xen . org
flight 34181 xen-unstable real [real]
http://www.chiark.greenend.org.uk/~xensrcts/logs/34181/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-amd64-amd64-rumpuserxen-amd64 11 rumpuserxen-demo-xenstorels/xenstorels 
fail REGR. vs. 34137

Regressions which are regarded as allowable (not blocking):
 test-amd64-i386-pair17 guest-migrate/src_host/dst_host fail like 34137

Tests which did not succeed, but are not blocking:
 test-armhf-armhf-xl-sedf 10 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-sedf-pin 10 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 10 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-midway   10 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  10 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt 11 guest-stop   fail   never pass
 test-armhf-armhf-libvirt 10 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  10 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-pvh-amd   9 guest-start  fail   never pass
 test-armhf-armhf-xl-credit2   5 xen-boot fail   never pass
 test-amd64-amd64-xl-pcipt-intel  9 guest-start fail never pass
 test-amd64-amd64-libvirt 10 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-pvh-intel  9 guest-start  fail  never pass
 test-amd64-amd64-xl-win7-amd64 14 guest-stop   fail never pass
 test-amd64-i386-xl-winxpsp3-vcpus1 14 guest-stop   fail never pass
 test-amd64-i386-xl-winxpsp3  14 guest-stop   fail   never pass
 test-amd64-i386-xl-qemut-winxpsp3 14 guest-stopfail never pass
 test-amd64-i386-xl-qemuu-win7-amd64 14 guest-stop  fail never pass
 test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 14 guest-stop fail never pass
 test-amd64-amd64-xl-qemut-winxpsp3 14 guest-stop   fail never pass
 test-amd64-i386-xl-qemuu-winxpsp3 14 guest-stopfail never pass
 test-amd64-amd64-xl-winxpsp3 14 guest-stop   fail   never pass
 test-amd64-i386-xl-qemut-winxpsp3-vcpus1 14 guest-stop fail never pass
 test-amd64-amd64-xl-qemut-win7-amd64 14 guest-stop fail never pass
 test-amd64-amd64-xl-qemuu-win7-amd64 14 guest-stop fail never pass
 test-amd64-i386-xl-qemut-win7-amd64 14 guest-stop  fail never pass
 test-amd64-amd64-xl-qemuu-winxpsp3 14 guest-stop   fail never pass
 test-amd64-i386-xl-win7-amd64 14 guest-stop   fail  never pass

version targeted for testing:
 xen  441256a532dd737905ce335506d2ffcf0ff0db7c
baseline version:
 xen  a1b4af132077de694054d757fea4573d482c8b3a


People who touched revisions under test:
  Andrew Cooper andrew.coop...@citrix.com
  Boris Ostrovsky boris.ostrov...@oracle.com
  Daniel De Graaf dgde...@tycho.nsa.gov
  Daniel Kiper daniel.ki...@oracle.com
  Ed White edmund.h.wh...@intel.com
  Ian Jackson ian.jack...@eu.citrix.com
  Jan Beulich jbeul...@suse.com
  Kevin Tian kevin.t...@intel.com
  Tim Deegan t...@xen.org
  Wei Liu wei.l...@citrix.com


jobs:
 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
 build-amd64-pvopspass
 build-armhf-pvopspass
 build-i386-pvops pass
 build-amd64-rumpuserxen  pass
 build-i386-rumpuserxen   pass
 test-amd64-amd64-xl  pass
 test-armhf-armhf-xl  pass
 test-amd64-i386-xl   pass
 test-amd64-amd64-xl-pvh-amd  fail
 test-amd64-i386-rhel6hvm-amd pass
 test-amd64-i386-qemut-rhel6hvm-amd   pass
 test-amd64-i386-qemuu-rhel6hvm-amd   pass
 test-amd64-amd64-xl-qemut-debianhvm-amd64pass
 test-amd64-i386-xl-qemut-debianhvm-amd64 pass 

[Xen-devel] [PATCH v7] sndif: add ABI for Para-virtual sound

2015-02-06 Thread Oleksandr Dmytryshyn
This is ABI for the two halves of a Para-virtual
sound driver to communicate with each to other.

Signed-off-by: Oleksandr Dmytryshyn oleksandr.dmytrys...@globallogic.com
Signed-off-by: Iurii Konovalenko iurii.konovale...@globallogic.com
---
Changes since v1:
 * removed __attribute__((__packed__)) from all structures definitions

Changes since v2:
 * removed all C structures
 * added protocol description between frontend and backend drivers

Changes since v3:
 * fixed some typos
 * renamed XENSND_PCM_FORMAT_FLOAT_** to XENSND_PCM_FORMAT_F32_**
 * renamed XENSND_PCM_FORMAT_FLOAT64_** to XENSND_PCM_FORMAT_F64_**
 * added 'id' field to the request and response packets
 * renamed 'stream_id' to 'stream' in the packets description
 * renamed 'pcm_data_rate' to 'pcm_rate' in the packets description
 * renamed 'pcm_stream_type' to 'pcm_type' in the packets description
 * removed 'stream_id' field from the response packets

Changes since v4:
 * renamed 'stream_id' back to the to 'stream' in the packets description
 * moved 'id' field to the upper position in the response packets

Changes since v5:
 * Slightly reworked request/response packets
 * Size of the request/response packet is changed to the 64 bytes
 * Now parameters for the XENSND_OP_SET_VOLUME/XENSND_OP_GET_VOLUME are
   passed via shared page
 * Added parameters for the XenBus nodes (now each stream can be mapped
   to the defined sound device in the backend using those parameters)
 * Added XenBus state diagrams description

Changes since v6:
 * Reworked streams description  in the Backend XenBus Nodes

 xen/include/public/io/sndif.h | 429 ++
 1 file changed, 429 insertions(+)
 create mode 100644 xen/include/public/io/sndif.h

diff --git a/xen/include/public/io/sndif.h b/xen/include/public/io/sndif.h
new file mode 100644
index 000..0118cab
--- /dev/null
+++ b/xen/include/public/io/sndif.h
@@ -0,0 +1,429 @@
+/**
+ * sndif.h
+ *
+ * Unified sound-device I/O interface for Xen guest OSes.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (C) 2013-2015 GlobalLogic Inc.
+ */
+
+#ifndef __XEN_PUBLIC_IO_XENSND_H__
+#define __XEN_PUBLIC_IO_XENSND_H__
+
+/*
+ * Front-back notifications: When enqueuing a new request, sending a
+ * notification can be made conditional on req_event (i.e., the generic
+ * hold-off mechanism provided by the ring macros). Backends must set
+ * req_event appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()).
+ *
+ * Back-front notifications: When enqueuing a new response, sending a
+ * notification can be made conditional on rsp_event (i.e., the generic
+ * hold-off mechanism provided by the ring macros). Frontends must set
+ * rsp_event appropriately (e.g., using RING_FINAL_CHECK_FOR_RESPONSES()).
+ */
+
+/*
+ * Feature and Parameter Negotiation
+ * =
+ * The two halves of a Para-virtual sound card driver utilize nodes within the
+ * XenStore to communicate capabilities and to negotiate operating parameters.
+ * This section enumerates these nodes which reside in the respective front and
+ * backend portions of the XenStore, following the XenBus convention.
+ *
+ * All data in the XenStore is stored as strings.  Nodes specifying numeric
+ * values are encoded in decimal.  Integer value ranges listed below are
+ * expressed as fixed sized integer types capable of storing the conversion
+ * of a properly formated node string, without loss of information.
+ *
+ *
+ *Backend XenBus Nodes
+ *
+ *
+ *- Backend Device parameters -
+ *
+ * devid
+ *  Values: uint32_t
+ *
+ *  Index of the soundcard which will be 

[Xen-devel] pvSCSI test

2015-02-06 Thread Kristian Hagsted Rasmussen
On Wednesday, February 4, 2015 05:41, Juergen Gross jgr...@suse.com wrote:
 To: Kristian Hagsted Rasmussen; Olaf Hering; xen-de...@lists.xensource.com
 Subject: Re: pvSCSI test
 
 On 02/03/2015 07:16 PM, Kristian Hagsted Rasmussen wrote:

 Hi Olaf and Juergen


 I am interested in testing pvSCSI as I have a system were it would be ideal.
 I have tried to apply this patch 
 http://marc.info/?l=xen-develm=139885599019457w=2; called libbxl: add 
 support for pvscsi, iteration 1, to my xen-4.5 tree.
 I am using kernel 3.18.4 compiled with xen-scsiback and xen-scsifront 
 compiled into the kernel, for both Dom0 and DomU.

   My Ubuntu domU is running fine, however the scsi disk I want to pass 
 through does not appear.

 in my config I have added the line:
 vscsi= ['3:0:0:0,0:0:0:0']
 I have also tried with:
 vscsi= ['/dev/sdb,0:0:0:0']

 but no matter which syntax I use I get the following error in dmesg log:
 xen-pvscsi: 3:0:0:0 doesn't exist

 I have no errors in the log files for the domU.

 Am I missing something in my configuration, perhaps some device hiding like 
 for pci pass through?
 
 The upstream pvscsi backend is using the target infrastructure. Until
 the tools are aware of this you'll have to configure the device to
 pass to a domain in Dom0 e.g. via a script:
 
 #!/bin/bash
 # usage:
 # mkpvscsi device
 # e.g. mkpvscsi /dev/sr0
 
 DEV=$1
 
 gen_uuid()
 {
  cat /proc/sys/kernel/random/uuid | \
 awk '{print naa.6001405 substr($1,1,8) substr($1,10,1);}'
 }
 
 TARG=`gen_uuid`
 INIT=`gen_uuid`
 
 NODE=`lsscsi | awk '$(NF) == '$DEV'
 { print substr($1,2,length($1)-4); }'`
 NAME=`echo $NODE | sed 's/:/_/g'`
 

I used targetcli to create the pscsi target, so 
skipped from here

 modprobe configfs
 mount -t configfs configfs /sys/kernel/config
 modprobe xen-scsiback
 modprobe target_core_mod

to here 

 cd /sys/kernel/config/target
 

and here to 

 mkdir -p core/pscsi_0/$NAME
 echo $DEV core/pscsi_0/$NAME/udev_path
 
to here

 mkdir -p xen-pvscsi/$TARG/tpgt_0
 echo $NODE xen-pvscsi/$TARG/tpgt_0/param/alias
 echo $INIT xen-pvscsi/$TARG/tpgt_0/nexus
 mkdir xen-pvscsi/$TARG/tpgt_0/lun/lun_0
 
 cd xen-pvscsi/$TARG/tpgt_0/lun/lun_0
 ln -s ../../../../../../target/core/pscsi_0/$NAME xen-pvscsi_port
 
 
 
 -
 
 After doing this you can use the xen tools to give the device to a domU.
 Please note: this script is untested, I've used a simpler one which
 fitted my needs (using targetcli, which isn't available everywhere).
 I have tested all single steps of the script above, though.

Thanks for the script, I had some problems with the symlinking when
running the script, so tried to make the pscsi in targetcli, and then
shortening the script to skip all script lines concerning the core dir.
This made the script working for me, however I still get:
xen-pvscsi: 3:0:0:0 doesn't exist
error in dmesg log.

Are you using another patch for the xen-tree than the one I listed above?

Thanks Kristian

 Happy testing,
 
 Juergen
 
 P.S.: If you are feeling adventurous you can try other target backends
than pscsi, e.g. iscsi or fileio.

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


Re: [Xen-devel] Xen Development for Dummies.

2015-02-06 Thread Jason Long
Can you tell me why Ocaml used? What is the features of this language? Why not 
other?
Excuse me, I'm a beginner in programming and can you show me some books or 
reference step by step? I'm a dummies :(

Cheers.



On Thursday, February 5, 2015 11:59 PM, Pasi Kärkkäinen pa...@iki.fi wrote:
On Fri, Feb 06, 2015 at 06:46:23AM +, Jason Long wrote:
 Hello Folks.
 I want to become a Xen developer and I don't have any knowledge about 
 development. Can you tell me what programming language is needed? How can I 
 start and etc?


Hello,

Xen is mostly written in C language, but there are other languages being used 
aswell.. obviously lowlevel assembly language for some architecture specific 
lowlevel stuff, and some highler level languages (OCaml) for certain components 
(oxenstored). Also various scripting languages are used, perl, python, etc. 

Also you need to know all the usual Linux/Unix commandline (development) tools.

-- Pasi


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

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


Re: [Xen-devel] Xen Development for Dummies.

2015-02-06 Thread Pasi Kärkkäinen
On Fri, Feb 06, 2015 at 10:31:09AM +, Jason Long wrote:
 Can you tell me why Ocaml used? What is the features of this language? Why 
 not other?
 Excuse me, I'm a beginner in programming and can you show me some books or 
 reference step by step? I'm a dummies :(


There are two different versions of xenstore-daemon (xenstored). 
The earlier one, written in C, and the newer one, written in OCaml (oxenstored).

Note that this is just one of the many components in Xen. Most Xen components 
are written in C.

Here you have some slides about oxenstored:
http://gazagnaire.org/pub/GH09.pdf


-- Pasi
 
 Cheers.
 
 
 
 On Thursday, February 5, 2015 11:59 PM, Pasi Kärkkäinen pa...@iki.fi wrote:
 On Fri, Feb 06, 2015 at 06:46:23AM +, Jason Long wrote:
  Hello Folks.
  I want to become a Xen developer and I don't have any knowledge about 
  development. Can you tell me what programming language is needed? How can I 
  start and etc?
 
 
 Hello,
 
 Xen is mostly written in C language, but there are other languages being used 
 aswell.. obviously lowlevel assembly language for some architecture specific 
 lowlevel stuff, and some highler level languages (OCaml) for certain 
 components (oxenstored). Also various scripting languages are used, perl, 
 python, etc. 
 
 Also you need to know all the usual Linux/Unix commandline (development) 
 tools.
 
 -- Pasi
 
 
  
  Tnx.
  
  ___
  Xen-devel mailing list
  Xen-devel@lists.xen.org
  http://lists.xen.org/xen-devel

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


Re: [Xen-devel] [PATCH 2/2] drivers: xen/block: add multi-page ring support

2015-02-06 Thread Bob Liu

On 02/02/2015 06:43 PM, Roger Pau Monné wrote:
 El 23/01/15 a les 10.14, Bob Liu ha escrit:
 Extend xen/block to support multi-page ring.
  * xen-blkback notify blkfront with feature-multi-ring-pages
  * xen-blkfront write to xenstore about how many pages are used as the ring

 If using 4 pages as the ring, inflight requests inscreased from 32 to 128 and
 IOPS improved nearly 400% on our system.

 Signed-off-by: Bob Liu bob@oracle.com
 ---
  drivers/block/xen-blkback/xenbus.c |   86 +
  drivers/block/xen-blkfront.c   |   94 
 ++--
 
 This requires a patch to xen/include/public/io/blkif.h in the Xen
 repository describing how this protocol extension is going to work
 before reviewing the Linux implementation.
 

But there is no protocol change, just add an parameter max_ring_pages
to control how many pages can be used as the ring. Now with one page we
can only have 32 requests.

-- 
Regards,
-Bob

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


Re: [Xen-devel] [RFC 7/7] libxl: Wait for QEMU startup in stubdomain

2015-02-06 Thread Wei Liu
Thanks for posting.

On Tue, Feb 03, 2015 at 11:06:15PM -0500, Eric Shelton wrote:
[...]
 @@ -1368,12 +1401,24 @@ static void stubdom_pvqemu_cb(libxl__egc *egc,
  libxl__stub_dm_spawn_state *sdss = CONTAINER_OF(multidev, *sdss, 
 multidev);
  STATE_AO_GC(sdss-dm.spawn.ao);
  uint32_t dm_domid = sdss-pvqemu.guest_domid;
 +libxl__xswait_state *xswait = sdss-pvqemu.spawn.xswait;
  
  if (rc) {
  LOGE(ERROR, error connecting nics devices);
  goto out;
  }
  
 +/* wait for PV stubdom QEMU instance to be ready */
 +libxl__xswait_init(xswait);
 +xswait-ao = sdss-dm.spawn.ao;
 +xswait-what = GCSPRINTF(stub domain %d startup, dm_domid);
 +xswait-path = GCSPRINTF(/local/domain/0/device-model/%d/state,
 + sdss-dm.guest_domid);

FWIW  we are now experiencing problem with this startup protocol (not
Linux stubdom specific) -- that path that libxl waiting for is wrong.

Unfortunately this problem can't be solved without putting in
significant effort and time (involves redesign of protocol and handle
all the compatibility issues). We can't say for sure when the solution
is going to land.

Also upstream QEMU stubdom, as you already notice, doesn't have a
critical functionality -- save / restore. Adding that in might involve
upstreaming some changes to QEMU, which has a time frame that is out of
our control.  So my hunch is that we're not going to make it in time for
4.6. :-/

Wei.

 +xswait-timeout_ms = LIBXL_DEVICE_MODEL_START_TIMEOUT * 1000;
 +xswait-callback = stub_dm_watch_event;
 +rc = libxl__xswait_start(gc, xswait);
 +if (rc) goto out;
 +
  rc = libxl_domain_unpause(CTX, dm_domid);
  if (rc) goto out;
  
 @@ -1387,7 +1432,6 @@ static void stubdom_pvqemu_cb(libxl__egc *egc,
  return;
  }
  }
 -sdss-callback(egc, sdss-dm, rc);
  }
  
  static void spawn_stubdom_pvqemu_destroy_cb(libxl__egc *egc,
 -- 
 1.8.5.5
 
 
 ___
 Xen-devel mailing list
 Xen-devel@lists.xen.org
 http://lists.xen.org/xen-devel

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


Re: [Xen-devel] [PATCH 0/2] xen: cleanup sysfs management

2015-02-06 Thread Takashi Iwai
At Fri, 6 Feb 2015 10:43:44 +,
David Vrabel wrote:
 
 On 05/02/15 20:38, Takashi Iwai wrote:
  Hi,
  
  this is a couple of patchset to clean up the sysfs entry creation /
  removal in xen driver codes.  They are relatively straightforward
  conversion patches, where manual function calls are replaced with
  static attribute groups.
 
 These look fine but they're a bit late for 3.20.

Yeah, feel free to postpone to 3.21 (as long as they aren't lost :)
These are just non-urgent cleanups I happened to find through the
whole tree.


Takashi

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


Re: [Xen-devel] [PATCH] tools: work around collision of -O0 and -D_FORTIFY_SOURCE [and 1 more messages]

2015-02-06 Thread Ian Jackson
Jan Beulich writes (Re: [PATCH] tools: work around collision of -O0 and 
-D_FORTIFY_SOURCE):
 Attached the patch I used for testing. While it works okay for me,
 I guess the configure part will need further taking care of the
 -Wp,-D... variant Don is seeing.

Thanks.  I'm going to pretend my first one was v2, you called your
version v3 and will send out a v4 in just a moment.

Don, can you please test it ?

Thanks,
Ian.

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


Re: [Xen-devel] pvSCSI test

2015-02-06 Thread Juergen Gross

On 02/06/2015 10:32 AM, Kristian Hagsted Rasmussen wrote:

On Wednesday, February 4, 2015 05:41, Juergen Gross jgr...@suse.com wrote:

To: Kristian Hagsted Rasmussen; Olaf Hering; xen-de...@lists.xensource.com
Subject: Re: pvSCSI test

On 02/03/2015 07:16 PM, Kristian Hagsted Rasmussen wrote:


Hi Olaf and Juergen


I am interested in testing pvSCSI as I have a system were it would be ideal.
I have tried to apply this patch http://marc.info/?l=xen-develm=139885599019457w=2; 
called libbxl: add support for pvscsi, iteration 1, to my xen-4.5 tree.
I am using kernel 3.18.4 compiled with xen-scsiback and xen-scsifront compiled 
into the kernel, for both Dom0 and DomU.

   My Ubuntu domU is running fine, however the scsi disk I want to pass through 
does not appear.

in my config I have added the line:
vscsi= ['3:0:0:0,0:0:0:0']
I have also tried with:
vscsi= ['/dev/sdb,0:0:0:0']

but no matter which syntax I use I get the following error in dmesg log:
xen-pvscsi: 3:0:0:0 doesn't exist

I have no errors in the log files for the domU.

Am I missing something in my configuration, perhaps some device hiding like for 
pci pass through?


The upstream pvscsi backend is using the target infrastructure. Until
the tools are aware of this you'll have to configure the device to
pass to a domain in Dom0 e.g. via a script:

#!/bin/bash
# usage:
# mkpvscsi device
# e.g. mkpvscsi /dev/sr0

DEV=$1

gen_uuid()
{
  cat /proc/sys/kernel/random/uuid | \
 awk '{print naa.6001405 substr($1,1,8) substr($1,10,1);}'
}

TARG=`gen_uuid`
INIT=`gen_uuid`

NODE=`lsscsi | awk '$(NF) == '$DEV'
 { print substr($1,2,length($1)-4); }'`
NAME=`echo $NODE | sed 's/:/_/g'`



I used targetcli to create the pscsi target, so
skipped from here


modprobe configfs
mount -t configfs configfs /sys/kernel/config
modprobe xen-scsiback
modprobe target_core_mod


to here


cd /sys/kernel/config/target



and here to


mkdir -p core/pscsi_0/$NAME
echo $DEV core/pscsi_0/$NAME/udev_path


to here


mkdir -p xen-pvscsi/$TARG/tpgt_0
echo $NODE xen-pvscsi/$TARG/tpgt_0/param/alias
echo $INIT xen-pvscsi/$TARG/tpgt_0/nexus
mkdir xen-pvscsi/$TARG/tpgt_0/lun/lun_0

cd xen-pvscsi/$TARG/tpgt_0/lun/lun_0
ln -s ../../../../../../target/core/pscsi_0/$NAME xen-pvscsi_port



-

After doing this you can use the xen tools to give the device to a domU.
Please note: this script is untested, I've used a simpler one which
fitted my needs (using targetcli, which isn't available everywhere).
I have tested all single steps of the script above, though.


Thanks for the script, I had some problems with the symlinking when
running the script, so tried to make the pscsi in targetcli, and then
shortening the script to skip all script lines concerning the core dir.
This made the script working for me, however I still get:
xen-pvscsi: 3:0:0:0 doesn't exist
error in dmesg log.

Are you using another patch for the xen-tree than the one I listed above?


I've used xm to get the drivers working, not xl. I wanted to have only
one changed component during tests in order to know which component is
failing. :-)

What are the contents of

/sys/kernel/config/target/xen-pvscsi/$TARG/tpgt_0/param/alias

($TARG replaced by the UUID generated above, of course)?

This should be 3:0:0:0 in your case. That's where the backend is
looking for the match from xenstore.

And the final symlink in the script is required. $NAME can be anything,
but has to match the pscsi name, of course.

Juergen

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


Re: [Xen-devel] [PATCH 1/2] xenbus_client: extend interface to suppurt multi-page ring

2015-02-06 Thread Wei Liu
On Fri, Jan 23, 2015 at 06:14:30PM +0800, Bob Liu wrote:
[...]
   rv = xenbus_alloc_evtchn(dev, priv-evtchn);
   if (rv)
 diff --git a/drivers/net/xen-netback/netback.c 
 b/drivers/net/xen-netback/netback.c
 index 908e65e..8513764 100644
 --- a/drivers/net/xen-netback/netback.c
 +++ b/drivers/net/xen-netback/netback.c
 @@ -1955,7 +1955,7 @@ int xenvif_map_frontend_rings(struct xenvif_queue 
 *queue,
   int err = -ENOMEM;
  
   err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(queue-vif),
 -  tx_ring_ref, addr);
 + tx_ring_ref, 1, addr);
   if (err)
   goto err;
  
 @@ -1963,7 +1963,7 @@ int xenvif_map_frontend_rings(struct xenvif_queue 
 *queue,
   BACK_RING_INIT(queue-tx, txs, PAGE_SIZE);
  
   err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(queue-vif),
 -  rx_ring_ref, addr);
 + rx_ring_ref, 1, addr);

With my netback maintainer hat on, indentation here looks wrong. Not
sure if this is my fault when writing the original patch, but it would
be good if you fix them in next posting. :-)

Thanks
Wei.

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


Re: [Xen-devel] [RFC PATCH V3 05/12] xen: Introduce vm_event

2015-02-06 Thread Tamas K Lengyel
On Mon, Feb 2, 2015 at 8:35 PM, Daniel De Graaf dgde...@tycho.nsa.gov wrote:
 On 01/31/2015 08:24 AM, Tamas K Lengyel wrote:

 On Fri, Jan 30, 2015 at 6:25 PM, Daniel De Graaf dgde...@tycho.nsa.gov
 wrote:

 On 01/29/2015 04:46 PM, Tamas K Lengyel wrote:


 To make it easier to review the renaming process of mem_event -
 vm_event,
 the process is broken into three pieces, of which this patch is the
 first.
 In this patch the vm_event subsystem is introduced and hooked into the
 build
 process, but it is not yet used anywhere.

 Signed-off-by: Tamas K Lengyel tamas.leng...@zentific.com



 [...]


 diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
 index f20e89c..d6d403a 100644
 --- a/xen/include/xsm/dummy.h
 +++ b/xen/include/xsm/dummy.h
 @@ -525,6 +525,18 @@ static XSM_INLINE int
 xsm_mem_event_op(XSM_DEFAULT_ARG struct domain *d, int op)
XSM_ASSERT_ACTION(XSM_DM_PRIV);
return xsm_default_action(action, current-domain, d);
}
 +
 +static XSM_INLINE int xsm_vm_event_control(XSM_DEFAULT_ARG struct
 domain
 *d, int mode, int op)
 +{
 +XSM_ASSERT_ACTION(XSM_PRIV);
 +return xsm_default_action(action, current-domain, d);
 +}
 +
 +static XSM_INLINE int xsm_vm_event_op(XSM_DEFAULT_ARG struct domain *d,
 int op)
 +{
 +XSM_ASSERT_ACTION(XSM_DM_PRIV);
 +return xsm_default_action(action, current-domain, d);
 +}
#endif

 [...]


 diff --git a/xen/xsm/flask/policy/access_vectors
 b/xen/xsm/flask/policy/access_vectors
 index 1da9f63..a4241b5 100644
 --- a/xen/xsm/flask/policy/access_vectors
 +++ b/xen/xsm/flask/policy/access_vectors
 @@ -250,6 +250,7 @@ class hvm
hvmctl
# XEN_DOMCTL_set_access_required
mem_event
 +vm_event
# XEN_DOMCTL_mem_sharing_op and XENMEM_sharing_op_{share,add_physmap}
 with:
#  source = the domain making the hypercall
#  target = domain whose memory is being shared


 This implies that device model domains should be allowed to use the
 operations
 covered by xsm_vm_event_op but not those covered by xsm_vm_event_control.
 If this is how the eventual operations are intended to be used, the FLASK
 permissions also need to be split so that a similar distinction can be
 made
 in
 the policy.

 After looking at the later patches in this series, this appears to be a
 flaw
 in
 the existing FLASK hooks that got copied over.  While it is still useful
 to
 fix,
 it  may be better to make the split in a separate patch from the renames.
 Now
 that VM events apply to more than just HVM domains, it may be useful to
 move
 the new permission(s) from class hvm to either domain2 or mmu.

 --
 Daniel De Graaf
 National Security Agency


 Moving it to domain2 would make sense to me. The namings seem to be
 pretty poor so I have a hard time understanding why xsm_vm_event_op
 and xsm_vm_event_control differ when it comes to device model domains.
 The event_op corresponds to memops for access, paging and sharing
 while event_control for the domctl that enables/disables the rings. So
 yes, I think splitting the name for these separating things would make
 sense to clarify what they represent but whether that restriction on
 device model domains was intentional I'm not sure about.

 Tamas


 If the device model stubdom does not use (or plan to use) the memory_op
 hypercall, then there is no reason to allow it to make this hypercall,
 and the XSM check should be changed from XSM_DM_PRIV to XSM_PRIV.  From
 a quick look, this seems to be true, but I would defer to someone who
 has actually used or developed this subsystem.

This subsystem hasn't really seen much use AFAIK and I'm not aware on
anyone using it in device model stubdom, thus this change would be
reasonable.


 As far as the naming, several other hypercalls such as tmem have a
 distinction between use and control that is reflected in the XSM
 policy.  From a quick look at how the hypercalls work, the domctl seems
 to be a toolstack-only feature that is set when building a domain, while
 the mem_event_op hypercall is used by a helper process.

 I think it might be possible to move the helper process to a stub domain
 when creating a very disaggregated system.  In that case, a distinct
 permission for its hypercalls would be useful to let the stub domain
 perform sharing operations without being able to turn sharing on and
 off.  Otherwise the current single permission (moved to domain2) should
 be sufficient.

I would rather keep with the current single permission and split it
only when there is a need for it. In our current model the secondary
(security) control domain pretty much holds equivalent rights to dom0
over a subset of domains, so for us there is no benefit in having such
refined distinction between permissions.



 --
 Daniel De Graaf
 National Security Agency

Thanks,
Tamas

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


Re: [Xen-devel] pvSCSI test

2015-02-06 Thread Kristian Hagsted Rasmussen

On Friday, February 6, 2015 10:57, Juergen Gross jgr...@suse.com wrote:
 To: Kristian Hagsted Rasmussen; Olaf Hering; xen-de...@lists.xensource.com
 Subject: Re: pvSCSI test
 
 On 02/06/2015 10:32 AM, Kristian Hagsted Rasmussen wrote:
 On Wednesday, February 4, 2015 05:41, Juergen Gross jgr...@suse.com wrote:
 To: Kristian Hagsted Rasmussen; Olaf Hering; xen-de...@lists.xensource.com
 Subject: Re: pvSCSI test

 On 02/03/2015 07:16 PM, Kristian Hagsted Rasmussen wrote:

 Hi Olaf and Juergen


 I am interested in testing pvSCSI as I have a system were it would be 
 ideal.
 I have tried to apply this patch 
 http://marc.info/?l=xen-develm=139885599019457w=2; called libbxl: add 
 support for pvscsi, iteration 1, to my xen-4.5 tree.
 I am using kernel 3.18.4 compiled with xen-scsiback and xen-scsifront 
 compiled into the kernel, for both Dom0 and DomU.

I have by the way changed my kernel config, so that xen-scsiback, 
xen-scsifront, target_core_mod is compiled as modules.

snip 

 
 I've used xm to get the drivers working, not xl. I wanted to have only
 one changed component during tests in order to know which component is
 failing. :-)
 
 What are the contents of
 
 /sys/kernel/config/target/xen-pvscsi/$TARG/tpgt_0/param/alias
 
 ($TARG replaced by the UUID generated above, of course)?
 
 This should be 3:0:0:0 in your case. That's where the backend is
 looking for the match from xenstore.
 
 And the final symlink in the script is required. $NAME can be anything,
 but has to match the pscsi name, of course.

After some more fiddling around, I believe the configuration should be okay. My 
/etc/target/xen-pvscsi_start.sh look like this:

modprobe xen-scsiback
mkdir /sys/kernel/config/target/xen-pvscsi
mkdir -p /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0
echo naa.6001405708ab297e  
/sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/nexus
 xen-pvscsi Target Ports
mkdir -p 
/sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/lun/lun_0
ln -s 
/sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/lun/lun_0/../../../../../../target/core/iblock_0/3_0_0_0
 
/sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/lun/lun_0/xen-pvscsi_port
 Attributes for xen-pvscsi Target Portal Group
 Parameters for xen-pvscsi Target Portal Group
echo 3:0:0:0  
/sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/param/alias

And
cat /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/param/alias
returns 3:0:0:0 as expected.

If I understand this correctly, it is xen-scsiback that reads the target 
configuration from ConfigFS and hence the problem that xen-pvscsi cannot find 
the device has nothing to do with which toolstack is used?


If you are willing to part with the script you used together with targetcli, I 
would be more then happy to try that out.

Best Kristian
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [RFC PATCH V3 07/12] xen: Remove mem_event

2015-02-06 Thread Jan Beulich
 On 06.02.15 at 13:54, tamas.leng...@zentific.com wrote:
  Did you look at the resulting patch to see what happened? It didn't
 remove the mem_event stuff, but adjusted it enough to become the
 vm_event one while removing the previously added vm_event part
 again. Another argument against this approach imo.
 
 Hm, that is some strange git behavior. I'll reshuffle things in the
 next iteration to have most everything in the renaming patch.

Considering that Andrew too seems to think that this 3 stage
approach is undesirable, I think you'd better go the git mv route
for the next version.

Jan


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


Re: [Xen-devel] [PATCH RFC 26/35] arm : acpi read mmio tables from uefi

2015-02-06 Thread Stefano Stabellini
On Fri, 6 Feb 2015, Julien Grall wrote:
 On 06/02/2015 00:34, Stefano Stabellini wrote:
   diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
   index 93c8a8a..930746b 100644
   --- a/xen/arch/arm/setup.c
   +++ b/xen/arch/arm/setup.c
   @@ -50,6 +50,7 @@
 #include asm-arm/cputype.h
   
 struct bootinfo __initdata bootinfo;
   +struct meminfo __initdata acpi_mmio;
   
 struct cpuinfo_arm __read_mostly boot_cpu_data;
   
   diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
   index ba5a67d..5ea9ed6 100644
   --- a/xen/include/asm-arm/setup.h
   +++ b/xen/include/asm-arm/setup.h
   @@ -46,6 +46,7 @@ struct bootinfo {
 };
   
 extern struct bootinfo bootinfo;
   +extern struct meminfo acpi_mmio;
  
  It might make sense to reuse bootinfo.mem.
 
 Do you mean by extending the meminfo structure with a flags indicating if it's
 a RAM or MMIO range?

Right.  We could avoid introducing acpi_mmio and instead storing the
banks info in bootinfo.mem, that I am guessing it would be unused on
acpi?


 I guess it might be good, but I'm concerned about the static size of the
 array, 64 may not be suffisant.
 
Yes, you are right about that.  Do we have any ideas on how many banks
are available on a few real systems?

The alternative would be to create a list.

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


Re: [Xen-devel] [RFC PATCH V3 11/12] xen/vm_event: Decouple vm_event and mem_access.

2015-02-06 Thread Jan Beulich
 On 06.02.15 at 14:10, tamas.leng...@zentific.com wrote:
 On Wed, Feb 4, 2015 at 10:47 AM, Jan Beulich jbeul...@suse.com wrote:
 On 29.01.15 at 22:46, tamas.leng...@zentific.com wrote:
 --- a/xen/common/Makefile
 +++ b/xen/common/Makefile
 @@ -52,9 +52,10 @@ obj-y += tmem_xen.o
  obj-y += radix-tree.o
  obj-y += rbtree.o
  obj-y += lzo.o
 +obj-y += vm_event.o
 +obj-y += monitor.o

 Please make the (not) sorting situation worse than it already is - the
 original intention was for entries to be alphabetically sorted here.
 
 I'm just going to sort the list in this patch to have everything in
 alphabetic order.

In a prereq patch then you (hopefully) mean?

 +#include public/memory.h

 This can't be enough (nor can I see why it's needed here), or else ...

 +/* Resumes the running of the VCPU, restarting the last instruction */
 +void monitor_resume(struct domain *d);

 ... struct domain may end up being a forward reference (with scope
 restricted to monitor_resume()).
 
 I'll revisit the headers needed for this one but it did build fine.

Sure - presumably because the including sites included what is needed
up front.

Jan


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


Re: [Xen-devel] [PATCH RFC 27/35] arm: acpi map mmio regions to dom0

2015-02-06 Thread Stefano Stabellini
On Fri, 6 Feb 2015, Julien Grall wrote:
 On 06/02/2015 03:40, Parth Dixit wrote:
+static int map_acpi_regions(struct domain *d)
+{
+int res;
+
+res = acpi_map_mmio(d);
+if ( res )
+return res;
+
+return 0;
+}
   
   I don't think that splitting the code in two functions is useful. Just
   implement the remapping here.
  ok, will take care in next patchset.
 
 I agree that the splitting doesn't make really sense right now (only one call
 is done). But the next following patches add few more calls (such has mapping
 ACPI blob...).
 
 So I would keep the splitting here. I would also rename the function to
 prepare_acpi to make clear that we setups ACPI for DOM0.

OK

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


Re: [Xen-devel] pvSCSI test

2015-02-06 Thread Juergen Gross

On 02/06/2015 03:02 PM, Kristian Hagsted Rasmussen wrote:


On Friday, February 6, 2015 10:57, Juergen Gross jgr...@suse.com wrote:

To: Kristian Hagsted Rasmussen; Olaf Hering; xen-de...@lists.xensource.com
Subject: Re: pvSCSI test

On 02/06/2015 10:32 AM, Kristian Hagsted Rasmussen wrote:

On Wednesday, February 4, 2015 05:41, Juergen Gross jgr...@suse.com wrote:

To: Kristian Hagsted Rasmussen; Olaf Hering; xen-de...@lists.xensource.com
Subject: Re: pvSCSI test

On 02/03/2015 07:16 PM, Kristian Hagsted Rasmussen wrote:


Hi Olaf and Juergen


I am interested in testing pvSCSI as I have a system were it would be ideal.
I have tried to apply this patch http://marc.info/?l=xen-develm=139885599019457w=2; 
called libbxl: add support for pvscsi, iteration 1, to my xen-4.5 tree.
I am using kernel 3.18.4 compiled with xen-scsiback and xen-scsifront compiled 
into the kernel, for both Dom0 and DomU.


I have by the way changed my kernel config, so that xen-scsiback, 
xen-scsifront, target_core_mod is compiled as modules.

snip



I've used xm to get the drivers working, not xl. I wanted to have only
one changed component during tests in order to know which component is
failing. :-)

What are the contents of

/sys/kernel/config/target/xen-pvscsi/$TARG/tpgt_0/param/alias

($TARG replaced by the UUID generated above, of course)?

This should be 3:0:0:0 in your case. That's where the backend is
looking for the match from xenstore.

And the final symlink in the script is required. $NAME can be anything,
but has to match the pscsi name, of course.


After some more fiddling around, I believe the configuration should be okay. My 
/etc/target/xen-pvscsi_start.sh look like this:

modprobe xen-scsiback
mkdir /sys/kernel/config/target/xen-pvscsi
mkdir -p /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0
echo naa.6001405708ab297e  
/sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/nexus
 xen-pvscsi Target Ports
mkdir -p 
/sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/lun/lun_0
ln -s 
/sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/lun/lun_0/../../../../../../target/core/iblock_0/3_0_0_0
 
/sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/lun/lun_0/xen-pvscsi_port


iblock_0?

You are not using pscsi, but iblock. Is that on purpose? I have tested
pscsi and fileio only.

What does lsscsi tell you after adding the device via targetcli? I
suppose you see a new scsi target you should use instead of 3:0:0:0
(that's what I did in the fileio case).


 Attributes for xen-pvscsi Target Portal Group
 Parameters for xen-pvscsi Target Portal Group
echo 3:0:0:0  
/sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/param/alias

And
cat /sys/kernel/config/target/xen-pvscsi/naa.600140512a981c66/tpgt_0/param/alias
returns 3:0:0:0 as expected.

If I understand this correctly, it is xen-scsiback that reads the target 
configuration from ConfigFS and hence the problem that xen-pvscsi cannot find 
the device has nothing to do with which toolstack is used?


Yes and no. In theory the backend would accept anything from xenstore
which it can find in configfs. The toolstack however will only write
values into the xenstore it believes are valid SCSI devices.


If you are willing to part with the script you used together with targetcli, I 
would be more then happy to try that out.


I did my first tests with fileio on a machine I have no longer access
to. after I got it running I changed to my local test machine and pscsi.
Here I did the targetcli stuff manually and verified afterwards that
the single steps I put in my script were working. So the script I gave
you is basically the documentation of the manual setup I used.

Juergen

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


Re: [Xen-devel] [RFC PATCH V3 05/12] xen: Introduce vm_event

2015-02-06 Thread Tamas K Lengyel
On Fri, Feb 6, 2015 at 2:58 PM, Andrew Cooper andrew.coop...@citrix.com wrote:
 On 06/02/15 13:54, Tamas K Lengyel wrote:
 Please clarify in the patch description whether this (and perhaps
 other) copied or cloned code is really just a plain copy with some
 renaming, or whether there are any other changes. Reviewing this
 as a non-renaming change isn't time well spent in the former case.
 Ack, this code is identical to mem_event beside the name.

 Using git format-patch/diff -M will make this much more obvious by
 creating a diff which looks something like:

 --- a/xen/common/mem_event.c
 +++ b/xen/common/vm_event.c

 and contains hunks renaming the functions alone.

 ~Andrew

I'll take a look at that, it would certainly simplify things.

Tamas

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


Re: [Xen-devel] [PATCH RFC 22/35] xen/arm: Create chosen node for DOM0

2015-02-06 Thread Stefano Stabellini
On Fri, 6 Feb 2015, Julien Grall wrote:
 Hi Stefano,
 
 On 06/02/2015 00:09, Stefano Stabellini wrote:
  On Wed, 4 Feb 2015, parth.di...@linaro.org wrote:
   From: Naresh Bhat naresh.b...@linaro.org
   
   Create a chosen node for DOM0 with
 - bootargs
 - rsdp
   
   Signed-off-by: Naresh Bhat naresh.b...@linaro.org
   Signed-off-by: Parth Dixit parth.di...@linaro.org
   ---
 xen/arch/arm/domain_build.c | 41
   +
 1 file changed, 41 insertions(+)
   
   diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
   index 30bebe5..d781c63 100644
   --- a/xen/arch/arm/domain_build.c
   +++ b/xen/arch/arm/domain_build.c
   @@ -19,6 +19,7 @@
 #include asm/setup.h
 #include asm/cpufeature.h
 #include asm/acpi.h
   +#include xen/acpi.h
   
 #include asm/gic.h
 #include xen/irq.h
   @@ -1199,6 +1200,41 @@ static int make_memory_node_acpi(const struct
   domain *d,
 return res;
 }
   
   +static int make_chosen_node(const struct domain *d, const struct
   kernel_info *kinfo)
   +{
   +   int res = 0;
   +   const char *bootargs = NULL;
   +   const struct bootmodule *mod = kinfo-kernel_bootmodule;
   +   u64 a = acpi_os_get_root_pointer();
   +   void *fdt = kinfo-fdt;
   +   __be32 val[2];
   +   __be32 *cellp;
   +
   +   DPRINT(Create bootargs chosen node\n);
   +
   +   if ( mod  mod-cmdline[0] )
   +bootargs = mod-cmdline[0];
   +
   +   res = fdt_begin_node(fdt, chosen);
   +   if ( res )
   +   return res;
   +
   +   res = fdt_property(fdt, bootargs, bootargs, (strlen(bootargs)+1));
   +   if ( res )
   +  return res;
   +
   +   cellp = (__be32 *)val;
   +   dt_set_cell(cellp, ARRAY_SIZE(val), a);
   +
   +   res = fdt_property(fdt, rsdp, val, sizeof(val));
   +   if ( res )
   +   return res;
   +
   +res = fdt_end_node(fdt);
   +
   +return res;
   +}
  
  This is similar to setup_chosen_node in xen/arch/arm/efi/efi-boot.h.
  It might make sense to refactor the code to avoid code duplication.
 
 I don't think it make sense to have a common function between efi-boot.h
 (which create the DT for Xen) and here (which create the DT for DOM0).
 
 The former one is adding a node into an existing device tree while the former
 creating the device tree. Futhermore, the rsdp property doesn't exist on EFI
 boot.
 
I meant to share just the very basic creation of a chosen node, but you
are right, it might not be worth it.

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


Re: [Xen-devel] [PATCH RFC 25/35] arm: acpi add helper functions to map memory regions

2015-02-06 Thread Stefano Stabellini
On Fri, 6 Feb 2015, Julien Grall wrote:
 On 06/02/2015 00:21, Stefano Stabellini wrote:
  On Thu, 5 Feb 2015, Julien Grall wrote:
   Hi parth,
   
   Title: this is not acpi specific.
   
   On 04/02/2015 14:02, parth.di...@linaro.org wrote:
From: Parth Dixit parth.di...@linaro.org

For passing ACPI tables to dom0, UEFI memory needs to be mapped
by xen in dom0 address space. This patch adds helper functions for
mapping.
   
   I believe that this is not ACPI/RAM specific. Any cached MMIO regions will
   have same issue.
   
   This because Device memory is too strong and disallow unaligned access.
   
Signed-off-by: Parth Dixit parth.di...@linaro.org
---
   xen/arch/arm/p2m.c| 24 
   xen/include/asm-arm/p2m.h | 10 ++
   2 files changed, 34 insertions(+)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 8809f5a..5593a91 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -943,6 +943,30 @@ int p2m_populate_ram(struct domain *d,
0, MATTR_MEM, p2m_ram_rw);
   }

+int map_ram_regions(struct domain *d,
+ unsigned long start_gfn,
+ unsigned long nr,
+ unsigned long mfn)
   
   I don't like the name of the function. It gives the impression that we map
   any
   RAM region to the guest via this function.
   
   Which is obviously wrong and should never be done.
  
  map_mem_regions?
 
 It's still unclear, what mem mean? is an MMIO region? Is it cached, uncached?
 Is it read-only/read-write.
 
 We already have a function map_mmio_regions. Maybe it would make sense to
 extend it to give more control about the mapping (cached/uncached, read-only,
 read-write,). But this function is common with x86. So I'm not sure about
 what to do.

Usually mmio refers to device memory and not just from the caching
attributes point of view. I would rather not use map_mmio_regions for
something that doesn't belong to a device.

That said, it is difficult to come up with a good name.

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


Re: [Xen-devel] [PATCH RFC 31/35] arm : acpi map status override table to dom0

2015-02-06 Thread Stefano Stabellini
On Fri, 6 Feb 2015, Julien Grall wrote:
 On 06/02/2015 01:39, Stefano Stabellini wrote:
  On Thu, 5 Feb 2015, Julien Grall wrote:
   Hi Parth,
   
   On 05/02/2015 18:57, Parth Dixit wrote:
On 5 February 2015 at 10:54, Julien Grall julien.gr...@linaro.org
wrote:
 On 04/02/2015 14:02, parth.di...@linaro.org wrote:
  +stao-header.length = sizeof(struct acpi_table_header) + 1;
  +stao-header.checksum = 0;
  +ACPI_MEMCPY(stao-header.oem_id, LINARO, 6);
  +ACPI_MEMCPY(stao-header.oem_table_id, RTSMVEV8, 8);
 
 
 I though the plan was to use a Xen OEM ID?
yes, but its not clear what should be used as xen oem id is not
finalized
yet.
   
   I though we decided a name on the email, what is missing?
   
  +stao-header.revision = 1;
  +ACPI_MEMCPY(stao-header.asl_compiler_id, INTL, 4);
  +stao-header.asl_compiler_revision = 0x20140828;
 
 
 Where does this revision comes from?
from the spec
   
   What do you mean? I didn't know that the spec requires a specific compiler
   version... IHMO, this would be wrong.
   
  +stao-uart = 1;
 
 
 What about the devpath?
there is no table for devpath yet, it would require table specific
handling
(mostly parsing) and it can then be updated in it, or maybe i can
create separate structure
which can be used here but element would be added at runtime for each
table.
what do you think?
   
   The devpath is a list of device blacklisted by path, right? If so, the
   comment
   on the field devpath is wrong. Also, it's defined as u8[1], which is very
   confusing.
   
  +size = sizeof(struct acpi_table_stao);
  +checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, stao), size);
  +stao-header.checksum = (u8)( stao-header.checksum - checksum
  );
 
 
 No space before the last )
 
  +*mstao = addr = virt_to_maddr(stao);
  +
  +res = map_ram_regions(d,
  +  paddr_to_pfn(addr  PAGE_MASK),
  +  DIV_ROUND_UP(size, PAGE_SIZE),
  +  paddr_to_pfn(addr  PAGE_MASK));
 
 
 I'm concerned with this mapping, as long as most of the others.
 map_ram_regions is mapping Read/Write the region. In this case, the
 STAO
 size may not be aligned to PAGE_SIZE.
 
 So we may end up to map to DOM0 RW Xen memory. Even if DOM0 is a
 trusted
 domain, we should never let DOM0 write in Xen memory.
 
 IIRC, the plan was to map at least RO all the ACPI tables.
Sure, i'll map them to RO in next patchset.
   
   I didn't say this is the right solution ;). It was something I recall from
   a
   discussion we had few months ago.
   
   So before using this solution, can anyone (re-)confirm me that the ACPI
   tables
   should not be modified by the guest? If so, this should also be written
   somewhere for documentation purpose. It may save time in the future :).
  
  At this point we are completely trusting dom0 with the ACPI tables, I am
  not sure how much we would gain by mapping the tables RO.
 
 I agree that we trust DOM0... but in this specific case, because of the
 page-alignment requirement, we may expose Xen memory/Guest data.

This would be terrible!
I was assuming that all ACPI tables addresses are page aligned and sizes
are page aligned too. Is that true?
If not, is unacceptable to map them the entire page RW in Dom0.


 The Read-Only solution would avoid DOM0 to write in the such zone and mess up
 the hypervisor by mistake.

It is the minimum that we can do.


 FYI, we had a thread about it a couple of months ago. And it was confirmed
 that ACPI is RO at least from guest POV. (I could re-forward you the mail if
 necessary). So it's better to map Read-Only just in case.

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


Re: [Xen-devel] [PATCH] x86/hvm: wait for at least one ioreq server to be enabled

2015-02-06 Thread Jan Beulich
 On 06.02.15 at 13:27, paul.durr...@citrix.com wrote:
 In the case where a stub domain is providing emulation for an HVM
 guest, there is no interlock in the toolstack to make sure that
 the stub domain is up and running before the guest is unpaused.
 
 Prior to the introduction of ioreq servers this was not a problem,
 since there was only ever one emulator so ioreqs were simply
 created anyway and the vcpu remained blocked until the stub domain
 started and picked up the ioreq.
 
 Since ioreq servers allow for multiple emulators for a single guest
 it's not possible to know a priori which emulator will handle a
 particular ioreq, so emulators must attach to a guest before the
 guest runs.
 
 This patch works around the lack of interlock in the toolstack for
 stub domains by keeping the domain paused until at least one ioreq
 server is created and enabled, which in practice means the stub
 domain is indeed up and running.

Do I understand correctly that this only deals correctly with the
single server case, and the multi server case becoming functional
depends on the tool stack change to be done?

 --- a/xen/arch/x86/hvm/hvm.c
 +++ b/xen/arch/x86/hvm/hvm.c
 @@ -885,6 +885,12 @@ static void hvm_ioreq_server_enable(struct 
 hvm_ioreq_server *s,
  
done:
  spin_unlock(s-lock);
 +
 +if ( d-arch.hvm_domain.ioreq_server.waiting )
 +{
 +d-arch.hvm_domain.ioreq_server.waiting = 0;
 +domain_unpause(d);
 +}
  }

So it takes looking up all callers to understand that this doesn't need
to be atomic. This would have been avoided by mentioning this in
the description or in a comment.

 @@ -1435,6 +1441,19 @@ int hvm_domain_initialise(struct domain *d)
  
  spin_lock_init(d-arch.hvm_domain.ioreq_server.lock);
  INIT_LIST_HEAD(d-arch.hvm_domain.ioreq_server.list);
 +
 +/*
 + * In the case where a stub domain is providing emulation for
 + * the guest, there is no interlock in the toolstack to prevent
 + * the guest from running before the stub domain is ready.
 + * Hence the domain must remain paused until at least one ioreq
 + * server is created and enabled.
 + */
 +if ( !is_pvh_domain(d) ) {

Coding style.

 --- a/xen/include/asm-x86/hvm/domain.h
 +++ b/xen/include/asm-x86/hvm/domain.h
 @@ -84,6 +84,7 @@ struct hvm_domain {
  spinlock_t   lock;
  ioservid_t   id;
  struct list_head list;
 +bool_t   waiting;

At least non normal non-debug builds you've got a slot of 32 bits
between id and list - please fill such gaps when adding new
members rather than adding further slack space.

Jan


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


Re: [Xen-devel] [PATCHv5] x86/xen: allow privcmd hypercalls to be preempted

2015-02-06 Thread David Vrabel
On 06/02/15 00:50, Andy Lutomirski wrote:
 On Thu, Feb 5, 2015 at 4:41 AM, David Vrabel david.vra...@citrix.com wrote:
 Hypercalls submitted by user space tools via the privcmd driver can
 take a long time (potentially many 10s of seconds) if the hypercall
 has many sub-operations.

 
 +
 +void xen_maybe_preempt_hcall(void)
 
 I think this should be asmlinkage __visible.  Other than that, this
 looks good to me.  I like your solution to the tracking problem.
 
 +{
 +   if (__this_cpu_read(xen_in_preemptible_hcall)) {
 
 Hmm.  That being said, is there any issue with nested interrupts?

The should_resched() check in _cond_resched() already handles this
because irq_enter() sets the preempt count as non-zero.

FWIW, XenServer has been using something like this in production for
about a year without any problems.

David


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


Re: [Xen-devel] [PATCHv1] xen-blkback: default to X86_32 ABI on x86

2015-02-06 Thread David Vrabel
On 05/02/15 19:44, Konrad Rzeszutek Wilk wrote:
 On Thu, Feb 05, 2015 at 05:09:56PM +, David Vrabel wrote:
 Prior to the existance of 64-bit backends using the X86_64 ABI,
 frontends used the X86_32 ABI.  These old frontends do not specify the
 ABI and when used with a 64-bit backend do not work.
 
 Whoa. How old are we talking? I had been using RHEL5 guests and
 those work OK (64bit dom0, 32-bit domU).

Unfortunately I can't remember and the internal commit is tagged with
the wrong bug number.  I think it was either sles 9 or rhel 4.

David

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


[Xen-devel] [PATCH v4] tools: work around collision of -O0 and -D_FORTIFY_SOURCE

2015-02-06 Thread Ian Jackson
Some systems have python-config include -D_FORTIFY_SOURCE in the
CFLAGS.  But -D_FORTIFY_SOURCE does not (currently) work with -O0, and
-O0 is enabled in debug builds (since 1166ecf781).  As a result, on
those systems, debug builds fail.

Work around this problem as follows:
 * In configure, detect -D_FORTIFY_SOURCE in $(python-config --cflags)
 * If detected, set the new autoconf substitution and make variable
   PY_NOOPT_CFLAGS to -O1.
 * In tools/Rules.mk, where we add -O0, also add PY_NOOPT_CFLAGS
   (which will override the -O0 with -O1 if required).

Overriding the -O0 is better than disabling Fortify because the
latter might have an adverse security impact.  A user who wants to
disable optimisation completely even for Python and also disable
Fortify can set the environment variable
EXTRA_CFLAGS_XEN_TOOLS='-U_FORTIFY_SOURCE -O0'

Signed-off-by: Ian Jackson ian.jack...@eu.citrix.com
Reported-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Jan Beulich jbeul...@suse.com
CC: Jan Beulich jbeul...@suse.com
CC: Ian Campbell ian.campb...@citrix.com
CC: Euan Harris euan.har...@citrix.com
CC: Wei Liu wei.l...@citrix.com
CC: Stefano Stabellini stefano.stabell...@eu.citrix.com
CC: Don Slutz dsl...@verizon.com

---
v4: [Ian Jackson] Spot -Wp,-D_FORTIFY_SOURCE= too
v3: [Jan Beulich] Limit no-optimization override to Python interface code.
v2: [Ian Jackson] Use autoconf
v1: [Jan Beulich] Initial proposal
---
 config/Tools.mk.in |1 +
 m4/python_fortify_noopt.m4 |   31 +++
 tools/Rules.mk |2 ++
 tools/configure|   39 +++
 tools/configure.ac |2 ++
 tools/pygrub/Makefile  |6 --
 tools/python/Makefile  |6 --
 7 files changed, 83 insertions(+), 4 deletions(-)
 create mode 100644 m4/python_fortify_noopt.m4

diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 30267fa..e7da99d 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -13,6 +13,7 @@ BISON   := @BISON@
 FLEX:= @FLEX@
 PYTHON  := @PYTHON@
 PYTHON_PATH := @PYTHONPATH@
+PY_NOOPT_CFLAGS := @PY_NOOPT_CFLAGS@
 PERL:= @PERL@
 CURL_CONFIG := @CURL@
 XML2_CONFIG := @XML@
diff --git a/m4/python_fortify_noopt.m4 b/m4/python_fortify_noopt.m4
new file mode 100644
index 000..f9cb52b
--- /dev/null
+++ b/m4/python_fortify_noopt.m4
@@ -0,0 +1,31 @@
+dnl Defines PY_NOOPT_CFLAGS to either '' or -O1
+dnl
+
+dnl This is necessary because on some systems setup.py includes
+dnl -D_FORTIFY_SOURCE but have a -D_FORTIFY_SOURCE which breaks
+dnl with -O0.  On those systems we arrange to use -O1 for debug
+dnl builds instead.
+
+AC_DEFUN([AX_CHECK_PYTHON_FORTIFY_NOOPT], [
+AC_CACHE_CHECK([whether Python setup.py brokenly enables 
-D_FORTIFY_SOURCE],
+   [ax_cv_python_fortify],[
+ax_cv_python_fortify=no
+for arg in $($PYTHON-config --cflags); do
+case $arg in
+-D_FORTIFY_SOURCE=0) ax_cv_python_fortify=no ;;
+-D_FORTIFY_SOURCE=*) ax_cv_python_fortify=yes ;;
+-Wp,-D_FORTIFY_SOURCE=0) ax_cv_python_fortify=no ;;
+-Wp,-D_FORTIFY_SOURCE=*) ax_cv_python_fortify=yes ;;
+*) ;;
+esac
+done
+])
+
+AS_IF([test x$ax_cv_python_fortify = xyes],[
+PY_NOOPT_CFLAGS=-O1
+], [
+PY_NOOPT_CFLAGS=''
+])
+
+AC_SUBST(PY_NOOPT_CFLAGS)
+])
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 74cf37e..3c29d07 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -57,6 +57,8 @@ SHLIB_libxenvchan  = -Wl,-rpath-link=$(XEN_LIBVCHAN)
 ifeq ($(debug),y)
 # Disable optimizations and enable debugging information for macros
 CFLAGS += -O0 -g3
+# But allow an override to -O0 in case Python enforces -D_FORTIFY_SOURCE=n.
+PY_CFLAGS += $(PY_NOOPT_CFLAGS)
 endif
 
 LIBXL_BLKTAP ?= $(CONFIG_BLKTAP2)
diff --git a/tools/configure b/tools/configure
index ab04e8c..e7dac75 100755
--- a/tools/configure
+++ b/tools/configure
@@ -652,6 +652,7 @@ PKG_CONFIG_LIBDIR
 PKG_CONFIG_PATH
 PKG_CONFIG
 CURSES_LIBS
+PY_NOOPT_CFLAGS
 EGREP
 GREP
 CPP
@@ -3453,6 +3454,10 @@ esac
 
 
 
+
+
+
+
 # pkg.m4 - Macros to locate and utilise pkg-config.-*- Autoconf -*-
 # serial 1 (pkg-config-0.24)
 #
@@ -7043,6 +7048,40 @@ CPPFLAGS=$ac_previous_cppflags
 LDLFAGS=$ac_previous_ldflags
 
 
+{ $as_echo $as_me:${as_lineno-$LINENO}: checking whether Python setup.py 
brokenly enables -D_FORTIFY_SOURCE 5
+$as_echo_n checking whether Python setup.py brokenly enables 
-D_FORTIFY_SOURCE...  6; }
+if ${ax_cv_python_fortify+:} false; then :
+  $as_echo_n (cached)  6
+else
+
+ax_cv_python_fortify=no
+for arg in $($PYTHON-config --cflags); do
+case $arg in
+-D_FORTIFY_SOURCE=0) ax_cv_python_fortify=no ;;
+-D_FORTIFY_SOURCE=*) ax_cv_python_fortify=yes ;;
+-Wp,-D_FORTIFY_SOURCE=0) 

Re: [Xen-devel] Xen's Linux kernel config options V2

2015-02-06 Thread Stefano Stabellini
On Thu, 5 Feb 2015, Luis R. Rodriguez wrote:
 On Wed, Feb 4, 2015 at 6:57 AM, Stefano Stabellini
 stefano.stabell...@eu.citrix.com wrote:
  On Wed, 4 Feb 2015, David Vrabel wrote:
  On 16/12/14 16:21, Juergen Gross wrote:
   Hi,
  
   This is a design proposal for a rework of the config options on the
   Linux kernel which are related to Xen.
  
   The need to do so arose from the fact that it is currently not
   possible to build the Xen frontend drivers for a non-pvops kernel,
   e.g. to run them in a HVM-domain. There are more drawbacks in the
   current config options to which I'll come later.
  
   Option  Selects Depends
   --
   XEN
 XEN_PV(x86)   XEN_HAVE_PVMMU
   PARAVIRT
   PARAVIRT_CLOCK
 XEN_PVH(x86)  XEN_PVHVM
   PARAVIRT
   PARAVIRT_CLOCK
 XEN_PVHVM PARAVIRT
   PARAVIRT_CLOCK
 
  PARAVIRT_CLOCK and PARAVIRT are x86 specific.
  Given that there is no CONFIG_PV or CONFIG_PVH or even CONFIG_PVHVM on
  arm and arm64 as there is just one type of guest, I would rather just
  have CONFIG_XEN there.
 
 Interesting, right now we have as part of the recommended change for
 XEN_BACKEND:
 
 Option  Selects Depends
 --
 XEN
   XEN_BACKEND   SWIOTLB_XEN(arm,arm64)  XEN_PV(x86) ||
 XEN_PVH(x86) ||
 XEN_PVHVM
 
 How would we ensure to enable XEN_BACKEND for arm then?

I thought that you wanted to turn XEN_BACKEND into a user selectable
option.  On arm and arm64 this option wouldn't depend on anything
(except CONFIG_XEN).  


 XEN_BACKEND   SWIOTLB_XEN(arm,arm64)  XEN_PV(x86) ||
   XEN_PVH(x86) ||
   XEN_PVHVM
   XEN_BLKDEV_BACKEND
   XEN_PCIDEV_BACKEND(x86)
   XEN_SCSI_BACKEND
   XEN_NETDEV_BACKEND
 PCI_XEN(x86)  SWIOTLB_XEN
 XEN_DOM0  XEN_BACKEND XEN_PV(x86) ||
   PCI_XEN(x86)XEN_PVH(x86)
   XEN_ACPI_HOTPLUG_MEMORY XEN_STUB
   XEN_ACPI_HOTPLUG_CPUXEN_STUB
   XEN_MCE_LOG(x86)
 XEN_MAX_DOMAIN_MEMORY(x86)
 XEN_SAVE_RESTORE(x86)
 XEN_DEBUG_FS
 XEN_WDT
 XEN_BALLOON
   XEN_SELFBALLOONING  XEN_TMEM
   XEN_BALLOON_MEMORY_HOTPLUG
   XEN_SCRUB_PAGES
 XENFS XEN_PRIVCMD
   XEN_COMPAT_XENFS
 XEN_SYS_HYPERVISOR
 XEN_DEV_EVTCHN
 XEN_GNTDEV
 XEN_GRANT_DEV_ALLOC
 SWIOTLB_XEN
 XEN_TMEM
 
  not available on arm and arm64
 
 Can you clarify if you meant only XEN_TMEM or all the above here?

Only TMEM, sorry for being terse


 XEN_PRIVCMD
 XEN_STUB(x86_64)  BROKEN
 XEN_ACPI_PROCESSOR(x86)
 XEN_HAVE_PVMMU
 
  x86 specific
 
 Likewise, all of the above quoted options ?

only XEN_HAVE_PVMMU


 XEN_EFI(x64)
 
  FYI soon to be available on arm
 
 OK thanks.
 
 XEN_XENBUS_FRONTEND
   XEN_FRONTENDXEN
   XEN_XENBUS_FRONTEND
 XEN_FBDEV_FRONTENDINPUT_XEN_KBDDEV_FRONTEND
 XEN_BLKDEV_FRONTEND
 HVC_XEN_FRONTEND  HVC_XEN
 TCG_XEN
 XEN_PCIDEV_FRONTEND   PCI_XEN
 
  x86 specific for the moment
 
 All?

XEN_PCIDEV_FRONTEND and PCI_XEN


 XEN_SCSI_FRONTEND
 INPUT_XEN_KBDDEV_FRONTEND
 XEN_NETDEV_FRONTEND
 XEN_PLATFORM_PCI
 
  definitely x86 only
 
 All?

only XEN_PLATFORM_PCI

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


Re: [Xen-devel] [PATCH 2/2] drivers: xen/block: add multi-page ring support

2015-02-06 Thread Bob Liu

On 02/06/2015 07:01 PM, Wei Liu wrote:
 On Fri, Feb 06, 2015 at 06:47:17PM +0800, Bob Liu wrote:

 On 02/02/2015 06:43 PM, Roger Pau Monné wrote:
 El 23/01/15 a les 10.14, Bob Liu ha escrit:
 Extend xen/block to support multi-page ring.
  * xen-blkback notify blkfront with feature-multi-ring-pages
  * xen-blkfront write to xenstore about how many pages are used as the ring

 If using 4 pages as the ring, inflight requests inscreased from 32 to 128 
 and
 IOPS improved nearly 400% on our system.

 Signed-off-by: Bob Liu bob@oracle.com
 ---
  drivers/block/xen-blkback/xenbus.c |   86 
 +
  drivers/block/xen-blkfront.c   |   94 
 ++--

 This requires a patch to xen/include/public/io/blkif.h in the Xen
 repository describing how this protocol extension is going to work
 before reviewing the Linux implementation.


 But there is no protocol change, just add an parameter max_ring_pages
 to control how many pages can be used as the ring. Now with one page we
 can only have 32 requests.

 
 I think Roger meant the xenbus protocol used to negotiate this feature,
 not the data protocol regarding how request and response are
 interpreted. Blkif.h (and netif.h FWIW) has section to describe xenbus
 protocol.
 

Oh, I see. Sorry for the misunderstood.
Also will fix the indentation issue of the first patch.

Thanks,
-Bob


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


Re: [Xen-devel] [RFC PATCH V3 07/12] xen: Remove mem_event

2015-02-06 Thread Tamas K Lengyel
 Did you look at the resulting patch to see what happened? It didn't
 remove the mem_event stuff, but adjusted it enough to become the
 vm_event one while removing the previously added vm_event part
 again. Another argument against this approach imo.

 Jan

Hm, that is some strange git behavior. I'll reshuffle things in the
next iteration to have most everything in the renaming patch.

Tamas

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


Re: [Xen-devel] [RFC 7/7] libxl: Wait for QEMU startup in stubdomain

2015-02-06 Thread Eric Shelton
On Fri, Feb 6, 2015 at 9:59 AM, Wei Liu wei.l...@citrix.com wrote:
 On Fri, Feb 06, 2015 at 08:56:40AM -0500, Eric Shelton wrote:
 On Fri, Feb 6, 2015 at 6:16 AM, Wei Liu wei.l...@citrix.com wrote:

 I simply used the code already present in the QEMU upstream code,
 which is writing to that particular ath to indicate running.  Since
 it is distinct from the path used by the QEMU instance running in
 Dom0, it works for my intended purpose: ensuring the device model is
 running before unpausing the HVM guest.  When you say it is wrong,
 is that just because you ultimately intend to rearchitect this and use
 something different?  If so, maybe the path I am using is good
 enough until that happens.  Otherwise, can you suggest a better path
 or mechanism?


 It is not good enough. It just happens to be working.

 Currently the path is hardcoded /local/domain/0/BLAH. It's wrong,
 because the QEMU in stubdom is not running in 0. The correct prefix
 should be /local/domain/$stubdom_id.

OK; that definitely makes more sense - I recall the same idea crossing
my mind when I first dug into this.  Although the revised protocol may
go in a different direction, I will adopt this approach for now.

 I noticed some discussion about this on xen-devel.  Unfortunately, I
 was unable to find anything that laid out specifically what the
 problems are - can you point me to a bug report or such?  The libxl
 startup code - with callbacks on top of callbacks, callbacks within
 callbacks, and callbacks stashed away in little places only to be
 called _much_ later - is really convoluted, I suspect particularly so
 for stubdom startup.  I am not surprised it got broken - who can
 remember how it works?


 It's not how libxl is coded. It's the startup protocol that is broken.
 The breakage of stubdom in Xen 4.5 is a latent bug exposed by a new
 feature.

 I guess I should just send a bug report saying Device model startup
 protocol is broken. But I don't have much to say at this point, because
 thorough research for both qemu-trad and qemu-upstream is required to
 produce a sensible report.

So, just where is the current protocol breaking down?  Is there a
contemplated bandaid for 4.5.1?  I'm just trying to figure out what I
might want to do differently.

 So prior to 4.5, when there is emulation request issued by a guest vcpu,
 that request is put on a ring, guest vcpu is paused. When a DM shows up
 it processes that request, posts response, then guest vcpu is unpaused.
 So there is implicit dependency on Xen's behaviour for DM to work.

 In 4.5, a new feature called ioreq server is added. When Xen sees an
 io request which no backing DM, it returns immediately. Guest sees some
 wired value and crashes. That is, Xen's behaviour has changed and a
 latent bug in stubdom's startup protocol is exposed.

So, is the approach that I took - waiting for the stubdom DM to finish
initializing - a reasonable short-term solution?  I guess I am
wondering whether the fix you are contemplating is in libxl, the
hypervisor, or both.

Thanks,
Eric

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


Re: [Xen-devel] [RFC 3/7] linux-stubdomain: Build a disk image

2015-02-06 Thread Stefano Stabellini
On Tue, 3 Feb 2015, Eric Shelton wrote:
 This patch builds a disk image intended to be mounted as rootfs by the
 Linux stub domain.  It is assembled using dracut and genext2fs.
 
 Signed-off-by: Eric Shelton eshel...@pobox.com
 ---
  stubdom-linux/.gitignore  |  4 ++
  stubdom-linux/Makefile| 45 +++-
  stubdom-linux/extra/initscript| 25 +++
  stubdom-linux/extra/qemu-ifup |  7 +++
  stubdom-linux/gen-stubdom-disk.sh | 89 
 +++
  5 files changed, 168 insertions(+), 2 deletions(-)
  create mode 100644 stubdom-linux/extra/initscript
  create mode 100644 stubdom-linux/extra/qemu-ifup
  create mode 100755 stubdom-linux/gen-stubdom-disk.sh
 
 diff --git a/stubdom-linux/.gitignore b/stubdom-linux/.gitignore
 index 891f0c8..b8f2e26 100644
 --- a/stubdom-linux/.gitignore
 +++ b/stubdom-linux/.gitignore
 @@ -4,3 +4,7 @@
  /linux-*.tar.xz
  /linux-*/
  /vmlinuz-stubdom
 +/initramfs
 +/stubdom-disk.img
 +/dracut-???*
 +/genext2fs-*
 diff --git a/stubdom-linux/Makefile b/stubdom-linux/Makefile
 index 31bfbee..a46f5b0 100644
 --- a/stubdom-linux/Makefile
 +++ b/stubdom-linux/Makefile
 @@ -12,7 +12,19 @@ LINUX_V=linux-3.17.8
  VMLINUZ=$(LINUX_V)/arch/x86/boot/bzImage
  LINUX_URL=ftp://ftp.kernel.org/pub/linux/kernel/v3.x/$(LINUX_V).tar.xz
  
 -all: $(VMLINUZ)
 +DRACUT_URL=http://www.kernel.org/pub/linux/utils/boot/dracut;
 +DRACUT_V=dracut-033
 +
 +GENEXT2FS_V = 1.4.1
 +GENEXT2FS_URL=http://sourceforge.net/projects/genext2fs/files/genext2fs/$(GENEXT2FS_V)/genext2fs-$(GENEXT2FS_V).tar.gz/download

I don't think that we need to download install these tools. They are
available on all major distros.
I think we could add them as dependency to the xen-unstable configure
script.


 +# Stubdom disk content
 +STUBDOM_DISK_FILE= \
 +  qemu-build/i386-softmmu/qemu-system-i386 \
 +  extra/initscript \
 +  extra/qemu-ifup
 +
 +all: $(VMLINUZ) stubdom-disk.img
  
  qemu-build/Makefile:
   export GIT=$(GIT); \
 @@ -73,5 +85,34 @@ $(LINUX_V)/Makefile $(LINUX_V)/.config: $(LINUX_V).tar.xz
  $(VMLINUZ): $(LINUX_V)/.config
   $(MAKE) -C $(LINUX_V)
  
 -install: $(VMLINUZ)
 +$(DRACUT_V).tar.xz:
 + $(FETCHER) $@ $(DRACUT_URL)/$@
 +
 +DRACUT_INSTALL=$(CURDIR)/$(DRACUT_V)/dracut-install
 +$(DRACUT_INSTALL): $(DRACUT_V).tar.xz
 + tar xf $
 + $(MAKE) -C $(DRACUT_V) dracut-install
 +
 +GENEXT2FS = $(shell which genext2fs 2/dev/null)
 +ifeq ($(GENEXT2FS),)
 +GENEXT2FS = $(CURDIR)/genext2fs-$(GENEXT2FS_V)/genext2fs
 +endif
 +
 +genext2fs-$(GENEXT2FS_V).tar.gz:
 + $(FETCHER) $@ $(GENEXT2FS_URL)
 +$(CURDIR)/genext2fs-$(GENEXT2FS_V)/genext2fs: genext2fs-$(GENEXT2FS_V).tar.gz
 + tar xf $
 + cd genext2fs-$(GENEXT2FS_V)  ./configure
 + $(MAKE) -C genext2fs-$(GENEXT2FS_V)
 +
 +gen-stubdom-disk.sh: $(DRACUT_INSTALL) $(GENEXT2FS)
 +
 +export DRACUT_INSTALL
 +export GENEXT2FS
 +stubdom-disk.img: gen-stubdom-disk.sh $(STUBDOM_DISK_FILE)
 + env -u MAKELEVEL -u MAKEFLAGS -u MFLAGS ./$
 + chmod a-w $@
 +
 +install: $(VMLINUZ) stubdom-disk.img
   cp -f $(VMLINUZ) $(DESTDIR)/usr/local/lib/xen/boot/vmlinuz-stubdom
 + cp -f stubdom-disk.img $(DESTDIR)/usr/local/lib/xen/boot/
 diff --git a/stubdom-linux/extra/initscript b/stubdom-linux/extra/initscript
 new file mode 100644
 index 000..a0f50ad
 --- /dev/null
 +++ b/stubdom-linux/extra/initscript
 @@ -0,0 +1,25 @@
 +#!/bin/busybox sh
 +
 +set -e
 +set -x
 +mount -t sysfs /sys /sys
 +mount -t proc /proc /proc
 +mount -t xenfs -o nodev /proc/xen /proc/xen
 +
 +if test -e /sys/class/net/eth0; then
 +  ip link set eth0 address fe:ff:ff:ff:ff:fe
 +  ip addr flush eth0
 +  ip link set eth0 up
 +  brctl addbr br0
 +  brctl addif br0 eth0
 +  ip link set br0 up
 +else
 +  echo No network interface named eth0.
 +  ls -l /sys/class/net/
 +fi
 +
 +domid=$(/bin/xenstore-read target)
 +vm_path=$(xenstore-read /local/domain/$domid/vm)
 +dm_args=$(xenstore-read $vm_path/image/dmargs)
 +
 +/bin/qemu $dm_args
 diff --git a/stubdom-linux/extra/qemu-ifup b/stubdom-linux/extra/qemu-ifup
 new file mode 100644
 index 000..d71672b
 --- /dev/null
 +++ b/stubdom-linux/extra/qemu-ifup
 @@ -0,0 +1,7 @@
 +#! /bin/busybox sh
 +
 +ip link set $1 down
 +ip link set $1 address fe:ff:ff:ff:ff:fd
 +ip addr flush $1
 +brctl addif br0 $1
 +ip link set $1 up
 diff --git a/stubdom-linux/gen-stubdom-disk.sh 
 b/stubdom-linux/gen-stubdom-disk.sh
 new file mode 100755
 index 000..c209cba
 --- /dev/null
 +++ b/stubdom-linux/gen-stubdom-disk.sh
 @@ -0,0 +1,89 @@
 +#!/bin/bash
 +
 +set -e
 +umask 022
 +
 +script_qemu_ifup=extra/qemu-ifup
 +script_init=extra/initscript
 +
 +XEN_ROOT=$(cd ..; pwd)
 +xenstore_libs=$XEN_ROOT/tools/xenstore
 +libxc_libs=$XEN_ROOT/tools/libxc
 +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$xenstore_libs
 +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$libxc_libs
 +
 +initdir=`pwd`/initramfs/
 +
 +rm -fr $initdir
 +
 +# Using dracut to gather the shared libraries
 +# from 

[Xen-devel] [PATCH] x86/hvm: explicitly mark ioreq server pages dirty...

2015-02-06 Thread Paul Durrant
...when they are added back into the guest physmap, when an ioreq
server is disabled. If this is not done then the pages are missed
during migration, causing ioreq server creation to fail on the remote end.

This problem only manifests if the ioreq server is non-default because in
the default case the pages are never removed from the guest physmap.

Signed-off-by: Paul Durrant paul.durr...@citrix.com
Cc: Keir Fraser k...@xen.org
Cc: Jan Beulich jbeul...@suse.com
Cc: Andrew Cooper andrew.coop...@citrix.com
Cc: Stefano Stabellini stefano.stabell...@citrix.com
---
 xen/arch/x86/hvm/hvm.c |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 2e78d1b..ab0a450 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -543,9 +543,16 @@ static void hvm_remove_ioreq_gmfn(
 static int hvm_add_ioreq_gmfn(
 struct domain *d, struct hvm_ioreq_page *iorp)
 {
+int rc;
+
 clear_page(iorp-va);
-return guest_physmap_add_page(d, iorp-gmfn,
-  page_to_mfn(iorp-page), 0);
+
+rc = guest_physmap_add_page(d, iorp-gmfn,
+page_to_mfn(iorp-page), 0);
+if (rc == 0)
+paging_mark_dirty(d, page_to_mfn(iorp-page));
+
+return rc;
 }
 
 static int hvm_print_line(
-- 
1.7.10.4


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


Re: [Xen-devel] [RFC 1/7] linux-stubdomain: Compile QEMU

2015-02-06 Thread Stefano Stabellini
On Tue, 3 Feb 2015, Eric Shelton wrote:
 This patch adds a Makefile which downloads, patches, and compiles
 upstream QEMU for a stubdomain based on a linux kernel.
 
 Signed-off-by: Eric Shelton eshel...@pobox.com
 ---
  stubdom-linux/.gitignore|  3 ++
  stubdom-linux/Makefile  | 55 
 +
  stubdom-linux/qemu-configure.patch  | 47 +++
  stubdom-linux/qemu-xen-common.patch | 12 
  stubdom-linux/qemu-xen-h.patch  | 18 
  stubdom-linux/qemu-xen-hvm.patch| 36 
  6 files changed, 171 insertions(+)
  create mode 100644 stubdom-linux/.gitignore
  create mode 100644 stubdom-linux/Makefile
  create mode 100644 stubdom-linux/qemu-configure.patch
  create mode 100644 stubdom-linux/qemu-xen-common.patch
  create mode 100644 stubdom-linux/qemu-xen-h.patch
  create mode 100644 stubdom-linux/qemu-xen-hvm.patch
 
 diff --git a/stubdom-linux/.gitignore b/stubdom-linux/.gitignore
 new file mode 100644
 index 000..1b5ec08
 --- /dev/null
 +++ b/stubdom-linux/.gitignore
 @@ -0,0 +1,3 @@
 +/qemu-build/
 +/qemu-remote
 +/qemu-remote-remote/
 diff --git a/stubdom-linux/Makefile b/stubdom-linux/Makefile
 new file mode 100644
 index 000..4e84a61
 --- /dev/null
 +++ b/stubdom-linux/Makefile
 @@ -0,0 +1,55 @@
 +XEN_ROOT = $(CURDIR)/..
 +
 +-include $(XEN_ROOT)/config/Tools.mk
 +include $(XEN_ROOT)/Config.mk
 +
 +# Qemu tree used
 +QEMU_TREE=git://xenbits.xen.org/qemu-upstream-4.5-testing.git
 +QEMU_BRANCH=qemu-xen-4.5.0
 +
 +all:
 +
 +qemu-build/Makefile:
 + export GIT=$(GIT); \
 + $(XEN_ROOT)/scripts/git-checkout.sh $(QEMU_TREE) $(QEMU_BRANCH) 
 qemu-remote
 + cd qemu-remote  patch -p1  ../qemu-configure.patch
 + cd qemu-remote  patch -p1  ../qemu-xen-common.patch
 + cd qemu-remote  patch -p1  ../qemu-xen-h.patch
 + cd qemu-remote  patch -p1  ../qemu-xen-hvm.patch

Before having patches, I would like to try to get them upstream in QEMU.
If we really cannot do that, then I would still prefer to commit any
required workarounds to the qemu-xen rather than having them here as
patches.


 + mkdir -p qemu-build
 + cd qemu-build  ../qemu-remote/configure \
 + --target-list=i386-softmmu \
 + --enable-xen \
 + --extra-cflags=-I$(XEN_ROOT)/tools/include \
 + -I$(XEN_ROOT)/tools/libxc \
 + -I$(XEN_ROOT)/tools/xenstore \
 + -I$(XEN_ROOT)/tools/xenstore/compat \
 + -DDEBUG_XEN \
 + --extra-ldflags=-L$(XEN_ROOT)/tools/libxc 
 -L$(XEN_ROOT)/tools/xenstore \
 + --disable-werror \
 + --disable-sdl \
 + --disable-kvm \
 + --disable-gtk \
 + --disable-fdt \
 + --disable-bluez \
 + --disable-libusb \
 + --disable-slirp \
 + --disable-pie \
 + --disable-docs \
 + --disable-vhost-net \
 + --disable-spice \
 + --disable-guest-agent \
 + --audio-drv-list= \
 + --disable-smartcard-nss \
 + --enable-stubdom \
 + --disable-vnc \
 + --disable-spice \
 + --enable-trace-backend=stderr \
 + --disable-curses \
 + --python=$(PYTHON) \
 + --prefix=
 +
 +.PHONY:qemu-build
 +qemu-build: qemu-build/Makefile
 +qemu-build/i386-softmmu/qemu-system-i386: qemu-build
 + $(MAKE) -C qemu-build
 diff --git a/stubdom-linux/qemu-configure.patch 
 b/stubdom-linux/qemu-configure.patch
 new file mode 100644
 index 000..b93132d
 --- /dev/null
 +++ b/stubdom-linux/qemu-configure.patch
 @@ -0,0 +1,47 @@
 +--- a/configure  2015-01-21 23:48:23.76326 -0500
  b/configure  2015-01-21 23:52:30.32664 -0500
 +@@ -300,6 +300,7 @@
 + libusb=
 + usb_redir=
 + glx=
 ++stubdom=no
 + zlib=yes
 + lzo=no
 + snappy=no
 +@@ -1021,6 +1022,8 @@
 +   ;;
 +   --enable-usb-redir) usb_redir=yes
 +   ;;
 ++  --enable-stubdom) stubdom=yes
 ++  ;;
 +   --disable-zlib-test) zlib=no
 +   ;;
 +   --enable-lzo) lzo=yes
 +@@ -1329,6 +1332,7 @@
 +   --enable-usb-redir   enable usb network redirection support
 +   --enable-lzo enable the support of lzo compression library
 +   --enable-snappy  enable the support of snappy compression library
 ++  --enable-stubdom enable building the ioemu-stubdom
 +   --disable-guest-agentdisable building of the QEMU Guest Agent
 +   --enable-guest-agent enable building of the QEMU Guest Agent
 +   --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent
 +@@ -4122,6 +4126,7 @@
 + echo Target Sparc Arch $sparc_cpu
 + fi
 + echo xen support   $xen
 ++echo stubdom support   $stubdom
 + echo brlapi support$brlapi
 + echo bluez  support$bluez
 + echo Documentation $docs
 +@@ -4553,6 +4558,11 @@
 +   echo RBD_LIBS=$rbd_libs  

Re: [Xen-devel] [RFC 2/7] linux-stubdomain: Compile Linux

2015-02-06 Thread Stefano Stabellini
On Tue, 3 Feb 2015, Eric Shelton wrote:
 This patch adds rules to the Makefile to retrieve Linux and build a
 minimal kernel for the stubdomain.  Using Linux kernel 3.17.8.
 
 In order to work as a stubdomain, two patches are applied to the Linux
 kernel source.

Similarly to QEMU, we should get the changes upstream in Linux.
Failing that we could use a Linux tree on xenbits instead of a stable
kernel release and apply and needed workarounds there.


 Signed-off-by: Eric Shelton eshel...@pobox.com
 ---
  stubdom-linux/.gitignore   |3 +
  ...-Don-t-write-in-the-type-node-in-xenstore.patch |   30 +
  stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch |   38 +
  stubdom-linux/Makefile |   24 +-
  stubdom-linux/stubdom-linux-config-64b | 1510 
 
  5 files changed, 1604 insertions(+), 1 deletion(-)
  create mode 100644 
 stubdom-linux/0001-hvc_xen-Don-t-write-in-the-type-node-in-xenstore.patch
  create mode 100644 stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch
  create mode 100644 stubdom-linux/stubdom-linux-config-64b
 
 diff --git a/stubdom-linux/.gitignore b/stubdom-linux/.gitignore
 index 1b5ec08..891f0c8 100644
 --- a/stubdom-linux/.gitignore
 +++ b/stubdom-linux/.gitignore
 @@ -1,3 +1,6 @@
  /qemu-build/
  /qemu-remote
  /qemu-remote-remote/
 +/linux-*.tar.xz
 +/linux-*/
 +/vmlinuz-stubdom
 diff --git 
 a/stubdom-linux/0001-hvc_xen-Don-t-write-in-the-type-node-in-xenstore.patch 
 b/stubdom-linux/0001-hvc_xen-Don-t-write-in-the-type-node-in-xenstore.patch
 new file mode 100644
 index 000..24fac2f
 --- /dev/null
 +++ 
 b/stubdom-linux/0001-hvc_xen-Don-t-write-in-the-type-node-in-xenstore.patch
 @@ -0,0 +1,30 @@
 +From bc93f3b6d97b1376a5f5d1dbb746d82f8003e184 Mon Sep 17 00:00:00 2001
 +From: Anthony PERARD anthony.per...@citrix.com
 +Date: Tue, 20 Aug 2013 17:07:53 +0100
 +Subject: [PATCH] hvc_xen: Don't write in the type node in xenstore.
 +
 +Due to a recent commit in the Xen Project, writing to type is not
 +allowed any more.
 +
 +Signed-off-by: Anthony PERARD anthony.per...@citrix.com
 +---
 + drivers/tty/hvc/hvc_xen.c | 3 ---
 + 1 file changed, 3 deletions(-)
 +
 +diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
 +index 682210d..032add4 100644
 +--- a/drivers/tty/hvc/hvc_xen.c
  b/drivers/tty/hvc/hvc_xen.c
 +@@ -402,9 +402,6 @@ static int xencons_connect_backend(struct xenbus_device 
 *dev,
 + evtchn);
 + if (ret)
 + goto error_xenbus;
 +-ret = xenbus_printf(xbt, dev-nodename, type, ioemu);
 +-if (ret)
 +-goto error_xenbus;
 + ret = xenbus_transaction_end(xbt, 0);
 + if (ret) {
 + if (ret == -EAGAIN)

I think that this is already upstream


 +Anthony PERARD
 +
 diff --git a/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch 
 b/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch
 new file mode 100644
 index 000..e26b0da
 --- /dev/null
 +++ b/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch
 @@ -0,0 +1,38 @@
 +From 61cd574f29f41046f1c709cfa9da118156babf83 Mon Sep 17 00:00:00 2001
 +From: Anthony PERARD anthony.per...@citrix.com
 +Date: Fri, 1 Jun 2012 15:47:01 +0100
 +Subject: [PATCH 2/2] fix/remap_area_mfn_pte_fn
 +
 +---
 + arch/x86/xen/mmu.c | 13 -
 + 1 file changed, 12 insertions(+), 1 deletion(-)
 +
 +diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
 +index 69f5857..999fc82 100644
 +--- a/arch/x86/xen/mmu.c
  b/arch/x86/xen/mmu.c
 +@@ -2606,7 +2606,20 @@ static int remap_area_mfn_pte_fn(pte_t *ptep, 
 pgtable_t token,
 +  unsigned long addr, void *data)
 + {
 + struct remap_data *rmd = data;
 +-pte_t pte = pte_mkspecial(mfn_pte(rmd-mfn++, rmd-prot));
 ++
 ++/* Use the native_make_pte function because we are sure we don't
 ++ * have to do any pfn-mfn translations but at the same time we
 ++ * could in a stubdom so xen_initial_domain() would return false. */
 ++pte_t pte = pte_mkspecial(native_make_pte(((phys_addr_t)(rmd-mfn++)  
 PAGE_SHIFT)
 ++  | massage_pgprot(rmd-prot)));
 ++pteval_t val = pte_val_ma(pte);
 ++
 ++#if 0
 ++if (pat_enabled  !WARN_ON(val  _PAGE_PAT)) {
 ++if ((val  (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT)
 ++val = (val  ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT;
 ++}
 ++#endif

I don't think you need this change anymore with a more recent kernel.
In any case, a proper fix for this issue would certainly be welcome
upstream in Linux.


 + rmd-mmu_update-ptr = virt_to_machine(ptep).maddr;
 + rmd-mmu_update-val = pte_val_ma(pte);
 +-- 
 +Anthony PERARD
 +
 diff --git a/stubdom-linux/Makefile b/stubdom-linux/Makefile
 index 4e84a61..31bfbee 100644
 --- a/stubdom-linux/Makefile
 +++ b/stubdom-linux/Makefile
 @@ -7,7 +7,12 @@ include $(XEN_ROOT)/Config.mk
  QEMU_TREE=git://xenbits.xen.org/qemu-upstream-4.5-testing.git
  

Re: [Xen-devel] [PATCH 0/2] libxl: fix handling of fd and timer registrations

2015-02-06 Thread Anthony PERARD
On Mon, Feb 02, 2015 at 05:00:34PM -0700, Jim Fehlig wrote:
 This small series fixes some assertions we occasionally see in the
 libxl driver when running libvirt-TCK.  The assertions were due to
 races between destroying per-domain libxl_ctx and receiving fd and
 timer callbacks associated with them.  The races are masked by
 setting DEBUG loglevel in libvirtd.conf, so often missed by
 automated test setups that want DEBUG loglevel.
 
 Patch 1 actually fixes the assertions.  Patch2 fixes a stupid mistake.
 See the commit messages for details.
 
 Jim Fehlig (2):
   libxl: fix fd and timer event handling
   libxl: Move setup of child processing code to driver initialization
 
  src/libxl/libxl_domain.c | 244 
 +--
  src/libxl/libxl_driver.c | 212 +++-
  2 files changed, 212 insertions(+), 244 deletions(-)

Hi Jim,

I gave a try to those two patches with OpenStack. Assuming I haven't make any
mistake, it make things worse.

Environment:
  Ubuntu 14.04
  with Xen package install (xen 4.4)
  libvirt: master (47dd6c4)
  Installed OpenStack via DevStack

Test: ./run_tempest.sh tempest.api.compute

Result:
without the patches, the tests run fine, they all succeed.
with the patches, the tests fail AND libvirt became unresponsible.
  Running `virsh -c xen: list` does not return. (or any virsh command)

I have attach a backtrace, if that can help.

-- 
Anthony PERARD
Thread 30 (Thread 0x7fa9cad9f700 (LWP 5872)):
#0  __lll_lock_wait () at 
../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x7fa9cfc02657 in _L_lock_909 () from 
/lib/x86_64-linux-gnu/libpthread.so.0
#2  0x7fa9cfc02480 in __GI___pthread_mutex_lock (mutex=0x7fa9b8189470) at 
../nptl/pthread_mutex_lock.c:79
#3  0x7fa9cfeda44d in virMutexLock (m=m@entry=0x7fa9b8189470) at 
util/virthread.c:88
#4  0x7fa9cfec172e in virObjectLock (anyobj=anyobj@entry=0x7fa9b8189460) at 
util/virobject.c:323
#5  0x7fa9cfef8001 in virDomainObjListFindByName (doms=0x7fa9b8189460, 
name=0x7fa9a000d5e0 instance-0020) at conf/domain_conf.c:1114
#6  0x7fa9c118b786 in libxlDomainLookupByName (conn=0x7fa9a0007630, 
name=optimised out) at libxl/libxl_driver.c:954
#7  0x7fa9cff71356 in virDomainLookupByName (conn=0x7fa9a0007630, 
name=0x7fa9a000d5e0 instance-0020) at libvirt-domain.c:427
#8  0x7fa9d16fd492 in remoteDispatchDomainLookupByName (server=optimised 
out, msg=optimised out, ret=0x7fa9a0006770, args=0x7fa9af90, 
rerr=0x7fa9cad9ec40, 
client=0x7fa9d36470d0) at remote_dispatch.h:5429
#9  remoteDispatchDomainLookupByNameHelper (server=optimised out, 
client=0x7fa9d36470d0, msg=optimised out, rerr=0x7fa9cad9ec40, 
args=0x7fa9af90, ret=0x7fa9a0006770)
at remote_dispatch.h:5409
#10 0x7fa9d1717992 in virNetServerProgramDispatchCall (msg=0x7fa9d3645fb0, 
client=0x7fa9d36470d0, server=0x7fa9d362b2f0, prog=0x7fa9d363ee90)
at rpc/virnetserverprogram.c:437
#11 virNetServerProgramDispatch (prog=0x7fa9d363ee90, 
server=server@entry=0x7fa9d362b2f0, client=0x7fa9d36470d0, msg=0x7fa9d3645fb0) 
at rpc/virnetserverprogram.c:307
#12 0x7fa9d17119ed in virNetServerProcessMsg (msg=optimised out, 
prog=optimised out, client=optimised out, srv=0x7fa9d362b2f0) at 
rpc/virnetserver.c:172
#13 virNetServerHandleJob (jobOpaque=optimised out, opaque=0x7fa9d362b2f0) at 
rpc/virnetserver.c:193
#14 0x7fa9cfedad25 in virThreadPoolWorker 
(opaque=opaque@entry=0x7fa9d361c5f0) at util/virthreadpool.c:144
#15 0x7fa9cfeda21e in virThreadHelper (data=optimised out) at 
util/virthread.c:197
#16 0x7fa9cfc00182 in start_thread (arg=0x7fa9cad9f700) at 
pthread_create.c:312
#17 0x7fa9cf92b00d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 29 (Thread 0x7fa9ca59e700 (LWP 5873)):
#0  0x7fa9cf91dcbd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x7fa9cd452fff in ?? () from /usr/lib/libxenlight-4.4.so
#2  0x7fa9cd45441b in ?? () from /usr/lib/libxenlight-4.4.so
#3  0x7fa9cd438d27 in ?? () from /usr/lib/libxenlight-4.4.so
#4  0x7fa9cd439228 in libxl_domain_create_new () from 
/usr/lib/libxenlight-4.4.so
#5  0x7fa9c11846d8 in libxlDomainStart (driver=driver@entry=0x7fa9b818ff60, 
vm=vm@entry=0x7fa9b80f0770, start_paused=start_paused@entry=false, 
restore_fd=restore_fd@entry=-1) at libxl/libxl_domain.c:1044
#6  0x7fa9c1188134 in libxlDomainCreateWithFlags (dom=0x7fa9b0004440, 
flags=0) at libxl/libxl_driver.c:2587
#7  0x7fa9cff8466d in virDomainCreateWithFlags 
(domain=domain@entry=0x7fa9b0004440, flags=0) at libvirt-domain.c:6898
#8  0x7fa9d16ee4a8 in remoteDispatchDomainCreateWithFlags 
(server=optimised out, msg=optimised out, ret=0x7fa9b000a560, 
args=0x7fa9b00031d0, rerr=0x7fa9ca59dc40, 
client=optimised out) at remote_dispatch.h:3252
#9  remoteDispatchDomainCreateWithFlagsHelper (server=optimised out, 
client=optimised out, msg=optimised out, rerr=0x7fa9ca59dc40, 

[Xen-devel] [PATCH] x86/hvm: wait for at least one ioreq server to be enabled

2015-02-06 Thread Paul Durrant
In the case where a stub domain is providing emulation for an HVM
guest, there is no interlock in the toolstack to make sure that
the stub domain is up and running before the guest is unpaused.

Prior to the introduction of ioreq servers this was not a problem,
since there was only ever one emulator so ioreqs were simply
created anyway and the vcpu remained blocked until the stub domain
started and picked up the ioreq.

Since ioreq servers allow for multiple emulators for a single guest
it's not possible to know a priori which emulator will handle a
particular ioreq, so emulators must attach to a guest before the
guest runs.

This patch works around the lack of interlock in the toolstack for
stub domains by keeping the domain paused until at least one ioreq
server is created and enabled, which in practice means the stub
domain is indeed up and running.

Signed-off-by: Paul Durrant paul.durr...@citrix.com
Cc: Keir Fraser k...@xen.org
Cc: Jan Beulich jbeul...@suse.com
Cc: Andrew Cooper andrew.coop...@citrix.com
Cc: Wei Liu wei.l...@citrix.com
Cc: Ian Campbell ian.campb...@citrix.com
---

This patch also needs to be applied to stable-4.5

 xen/arch/x86/hvm/hvm.c   |   19 +++
 xen/include/asm-x86/hvm/domain.h |1 +
 2 files changed, 20 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index fd2314e..bf2c5fc 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -885,6 +885,12 @@ static void hvm_ioreq_server_enable(struct 
hvm_ioreq_server *s,
 
   done:
 spin_unlock(s-lock);
+
+if ( d-arch.hvm_domain.ioreq_server.waiting )
+{
+d-arch.hvm_domain.ioreq_server.waiting = 0;
+domain_unpause(d);
+}
 }
 
 static void hvm_ioreq_server_disable(struct hvm_ioreq_server *s,
@@ -1435,6 +1441,19 @@ int hvm_domain_initialise(struct domain *d)
 
 spin_lock_init(d-arch.hvm_domain.ioreq_server.lock);
 INIT_LIST_HEAD(d-arch.hvm_domain.ioreq_server.list);
+
+/*
+ * In the case where a stub domain is providing emulation for
+ * the guest, there is no interlock in the toolstack to prevent
+ * the guest from running before the stub domain is ready.
+ * Hence the domain must remain paused until at least one ioreq
+ * server is created and enabled.
+ */
+if ( !is_pvh_domain(d) ) {
+domain_pause(d);
+d-arch.hvm_domain.ioreq_server.waiting = 1;
+}
+
 spin_lock_init(d-arch.hvm_domain.irq_lock);
 spin_lock_init(d-arch.hvm_domain.uc_lock);
 
diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index 2757c7f..418262d 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -84,6 +84,7 @@ struct hvm_domain {
 spinlock_t   lock;
 ioservid_t   id;
 struct list_head list;
+bool_t   waiting;
 } ioreq_server;
 struct hvm_ioreq_server *default_ioreq_server;
 
-- 
1.7.10.4


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


Re: [Xen-devel] Xen Development for Dummies.

2015-02-06 Thread Jason Long
In your opinion, Can a normal user like me become a developer? 
I must first start learning C or Ocaml? Can you recommend a book for both to 
me? 
Can you tell me why developers choose Ocaml and C? and not C++ or Python?

Cheers.



On Friday, February 6, 2015 2:46 AM, Pasi Kärkkäinen pa...@iki.fi wrote:
On Fri, Feb 06, 2015 at 10:31:09AM +, Jason Long wrote:
 Can you tell me why Ocaml used? What is the features of this language? Why 
 not other?
 Excuse me, I'm a beginner in programming and can you show me some books or 
 reference step by step? I'm a dummies :(


There are two different versions of xenstore-daemon (xenstored). 
The earlier one, written in C, and the newer one, written in OCaml (oxenstored).

Note that this is just one of the many components in Xen. Most Xen components 
are written in C.

Here you have some slides about oxenstored:
http://gazagnaire.org/pub/GH09.pdf


-- Pasi


 Cheers.
 
 
 
 On Thursday, February 5, 2015 11:59 PM, Pasi Kärkkäinen pa...@iki.fi wrote:
 On Fri, Feb 06, 2015 at 06:46:23AM +, Jason Long wrote:
  Hello Folks.
  I want to become a Xen developer and I don't have any knowledge about 
  development. Can you tell me what programming language is needed? How can I 
  start and etc?
 
 
 Hello,
 
 Xen is mostly written in C language, but there are other languages being used 
 aswell.. obviously lowlevel assembly language for some architecture specific 
 lowlevel stuff, and some highler level languages (OCaml) for certain 
 components (oxenstored). Also various scripting languages are used, perl, 
 python, etc. 
 
 Also you need to know all the usual Linux/Unix commandline (development) 
 tools.
 
 -- Pasi
 
 
  
  Tnx.
  
  ___
  Xen-devel mailing list
  Xen-devel@lists.xen.org
  http://lists.xen.org/xen-devel

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


Re: [Xen-devel] [RFC 7/7] libxl: Wait for QEMU startup in stubdomain

2015-02-06 Thread Eric Shelton
On Fri, Feb 6, 2015 at 6:16 AM, Wei Liu wei.l...@citrix.com wrote:
 Thanks for posting.

 ...

 FWIW  we are now experiencing problem with this startup protocol (not
 Linux stubdom specific) -- that path that libxl waiting for is wrong.

I simply used the code already present in the QEMU upstream code,
which is writing to that particular ath to indicate running.  Since
it is distinct from the path used by the QEMU instance running in
Dom0, it works for my intended purpose: ensuring the device model is
running before unpausing the HVM guest.  When you say it is wrong,
is that just because you ultimately intend to rearchitect this and use
something different?  If so, maybe the path I am using is good
enough until that happens.  Otherwise, can you suggest a better path
or mechanism?

 Unfortunately this problem can't be solved without putting in
 significant effort and time (involves redesign of protocol and handle
 all the compatibility issues). We can't say for sure when the solution
 is going to land.

I noticed some discussion about this on xen-devel.  Unfortunately, I
was unable to find anything that laid out specifically what the
problems are - can you point me to a bug report or such?  The libxl
startup code - with callbacks on top of callbacks, callbacks within
callbacks, and callbacks stashed away in little places only to be
called _much_ later - is really convoluted, I suspect particularly so
for stubdom startup.  I am not surprised it got broken - who can
remember how it works?

While working on these patches reviving Anthony's work, I consistently
ran into HVM starup problems with QEMU upstream in a stub domain (it
always failed).  What I could not figure out is why QEMU-traditional
did not have a similar problem; it seemed to me that the same race
existed for QEMU-traditional stubdom.  I wrote it off as either (1)
MiniOS startup was so much faster than Linux that QEMU-traditional
always won the race, or (2) there was some implicit mechanism in
QEMU-traditional that ensured the HVM guest would wait for the device
model to be in place.  It sounds like maybe the race ctually is being
lost in 4.5.

If the problem you are contending with is that the HVM guest is being
unpaused before the device model is in place, I suggest that this
patch, or someting much like it, should address it.  I note that I
merely verified it did not break QEMU-traditional stubdom, but it is
just a matter of ensuring QEMU-traditional writes to _some_ xenstore
path when it is ready (it might do this already, in fact), and that
this patch waits on that path.  Also, it should be pretty easy to
extend this concept to ensure any additional stubdoms, such as vTPM,
are up and running before leaving the code im libxl_dm.c and unpausing
the HVM domain - we just chain through additional callbacks as needed.

There may be a desire to do a major rework of libxl_dm.c, etc., but
this patch might be a reasonable bandaid now for Xen 4.5.1.

 Also upstream QEMU stubdom, as you already notice, doesn't have a
 critical functionality -- save / restore. Adding that in might involve
 upstreaming some changes to QEMU, which has a time frame that is out of
 our control.

Xen maintains a separate repo for the QEMU code it uses.  I presume
this is because there is always something a little out of sync with
the mainstream QEMU release.  I do not understand why we cannot rely
on this to make available any needed changes to QEMU pending their
incorporation into QEMU proper.

 So my hunch is that we're not going to make it in time for
 4.6. :-/

 Wei.

4.5 was _just_ released, and Xen is on a ~10 month release cycle.  Why
can't this get done?  Someone just has to take a little time to sit
down and think about this.  I remain baffled why Xen did not
transition to QEMU-upstream stubdom 2 years ago.  Running the device
model directly in Dom0 is an obvious and significant security concern
- the QEMU codebase is in constant flux, is too big, and is too
complex to be allowed to be part of the TCB.  I do not think this, or
even chroot jailing the device model (which I understand has been done
for some Xen-based projects), meets the standards for security
demonstrated by the rest of the project.

Can we arrive at an agreement that a Linux-based QEMU-upstream stubdom
should _at least_ be a technical preview for Xen 4.6?  A year ago,
George kicked around the idea that QEMU-upstream stubdom should be a
blocker for Xen 4.5 - clearly this notion fell through the cracks.
For a reasonable number of users, specifically those wishing to use
Xen as a desktop solution, save/restore is not required, and could be
omitted in 4.6.  I understand that rumpkernel has been a preferred
route, but realistically that looks like a Xen 5.0 feature - I have
seen no indication we are anywhere near making that happen, whereas
Linux will work now, with very few technical hurdles to overcome
(right now, the main issues seem to be getting xenfb hooked up
correctly, and deciding how we wish to 

Re: [Xen-devel] [RFC PATCH V3 05/12] xen: Introduce vm_event

2015-02-06 Thread Andrew Cooper
On 06/02/15 13:54, Tamas K Lengyel wrote:
 Please clarify in the patch description whether this (and perhaps
 other) copied or cloned code is really just a plain copy with some
 renaming, or whether there are any other changes. Reviewing this
 as a non-renaming change isn't time well spent in the former case.
 Ack, this code is identical to mem_event beside the name.

Using git format-patch/diff -M will make this much more obvious by
creating a diff which looks something like:

--- a/xen/common/mem_event.c
+++ b/xen/common/vm_event.c

and contains hunks renaming the functions alone.

~Andrew

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


[Xen-devel] [PATCH v2] x86/hvm: wait for at least one ioreq server to be enabled

2015-02-06 Thread Paul Durrant
In the case where a stub domain is providing emulation for an HVM
guest, there is no interlock in the toolstack to make sure that
the stub domain is up and running before the guest is unpaused.

Prior to the introduction of ioreq servers this was not a problem,
since there was only ever one emulator so ioreqs were simply
created anyway and the vcpu remained blocked until the stub domain
started and picked up the ioreq.

Since ioreq servers allow for multiple emulators for a single guest
it's not possible to know a priori which emulator will handle a
particular ioreq, so emulators must attach to a guest before the
guest runs.

This patch works around the lack of interlock in the toolstack for
stub domains by keeping the domain paused until at least one ioreq
server is created and enabled, which in practice means the stub
domain is indeed up and running.

Signed-off-by: Paul Durrant paul.durr...@citrix.com
Cc: Keir Fraser k...@xen.org
Cc: Jan Beulich jbeul...@suse.com
Cc: Andrew Cooper andrew.coop...@citrix.com
Cc: Wei Liu wei.l...@citrix.com
Cc: Ian Campbell ian.campb...@citrix.com
---
v2:
 - Addressed comments from Jan Beulich

This patch also needs to be applied to stable-4.5

 xen/arch/x86/hvm/hvm.c   |   21 +
 xen/include/asm-x86/hvm/domain.h |1 +
 2 files changed, 22 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index fd2314e..2e78d1b 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -885,6 +885,13 @@ static void hvm_ioreq_server_enable(struct 
hvm_ioreq_server *s,
 
   done:
 spin_unlock(s-lock);
+
+/* This check is protected by the domain ioreq server lock */
+if ( d-arch.hvm_domain.ioreq_server.waiting )
+{
+d-arch.hvm_domain.ioreq_server.waiting = 0;
+domain_unpause(d);
+}
 }
 
 static void hvm_ioreq_server_disable(struct hvm_ioreq_server *s,
@@ -1435,6 +1442,20 @@ int hvm_domain_initialise(struct domain *d)
 
 spin_lock_init(d-arch.hvm_domain.ioreq_server.lock);
 INIT_LIST_HEAD(d-arch.hvm_domain.ioreq_server.list);
+
+/*
+ * In the case where a stub domain is providing emulation for
+ * the guest, there is no interlock in the toolstack to prevent
+ * the guest from running before the stub domain is ready.
+ * Hence the domain must remain paused until at least one ioreq
+ * server is created and enabled.
+ */
+if ( !is_pvh_domain(d) )
+{
+domain_pause(d);
+d-arch.hvm_domain.ioreq_server.waiting = 1;
+}
+
 spin_lock_init(d-arch.hvm_domain.irq_lock);
 spin_lock_init(d-arch.hvm_domain.uc_lock);
 
diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index 2757c7f..0702bf5 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -83,6 +83,7 @@ struct hvm_domain {
 struct {
 spinlock_t   lock;
 ioservid_t   id;
+bool_t   waiting;
 struct list_head list;
 } ioreq_server;
 struct hvm_ioreq_server *default_ioreq_server;
-- 
1.7.10.4


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


Re: [Xen-devel] [RFC 7/7] libxl: Wait for QEMU startup in stubdomain

2015-02-06 Thread Stefano Stabellini
On Fri, 6 Feb 2015, Wei Liu wrote:
   Unfortunately this problem can't be solved without putting in
   significant effort and time (involves redesign of protocol and handle
   all the compatibility issues). We can't say for sure when the solution
   is going to land.
  
  I noticed some discussion about this on xen-devel.  Unfortunately, I
  was unable to find anything that laid out specifically what the
  problems are - can you point me to a bug report or such?  The libxl
  startup code - with callbacks on top of callbacks, callbacks within
  callbacks, and callbacks stashed away in little places only to be
  called _much_ later - is really convoluted, I suspect particularly so
  for stubdom startup.  I am not surprised it got broken - who can
  remember how it works?
  
 
 It's not how libxl is coded. It's the startup protocol that is broken.
 The breakage of stubdom in Xen 4.5 is a latent bug exposed by a new
 feature. 
 
 I guess I should just send a bug report saying Device model startup
 protocol is broken. But I don't have much to say at this point, because
 thorough research for both qemu-trad and qemu-upstream is required to
 produce a sensible report.
 
  While working on these patches reviving Anthony's work, I consistently
  ran into HVM starup problems with QEMU upstream in a stub domain (it
  always failed).  What I could not figure out is why QEMU-traditional
  did not have a similar problem; it seemed to me that the same race
  existed for QEMU-traditional stubdom.  I wrote it off as either (1)
  MiniOS startup was so much faster than Linux that QEMU-traditional
  always won the race, or (2) there was some implicit mechanism in
 
 My bet is on 1).
 
  QEMU-traditional that ensured the HVM guest would wait for the device
  model to be in place.  It sounds like maybe the race ctually is being
 
 QEMU-trad stubdom is suffering from the same problem.
 
  lost in 4.5.
  
 
 So prior to 4.5, when there is emulation request issued by a guest vcpu,
 that request is put on a ring, guest vcpu is paused. When a DM shows up
 it processes that request, posts response, then guest vcpu is unpaused.
 So there is implicit dependency on Xen's behaviour for DM to work.
 
 In 4.5, a new feature called ioreq server is added. When Xen sees an
 io request which no backing DM, it returns immediately. Guest sees some
 wired value and crashes. That is, Xen's behaviour has changed and a
 latent bug in stubdom's startup protocol is exposed.

I don't think we can stall the development of a new feature like this
based on what can be seen as a regression.

If the bug cannot be fixed in a timely fashion we should revert to
previous behaviour as soon as possible.


  If the problem you are contending with is that the HVM guest is being
  unpaused before the device model is in place, I suggest that this
  patch, or someting much like it, should address it.  I note that I
  merely verified it did not break QEMU-traditional stubdom, but it is
  just a matter of ensuring QEMU-traditional writes to _some_ xenstore
  path when it is ready (it might do this already, in fact), and that
  this patch waits on that path.  Also, it should be pretty easy to
  extend this concept to ensure any additional stubdoms, such as vTPM,
  are up and running before leaving the code im libxl_dm.c and unpausing
  the HVM domain - we just chain through additional callbacks as needed.
  
 
 Yes, that's the basic idea, chaining things together.
 
  There may be a desire to do a major rework of libxl_dm.c, etc., but
  this patch might be a reasonable bandaid now for Xen 4.5.1.
  
   Also upstream QEMU stubdom, as you already notice, doesn't have a
   critical functionality -- save / restore. Adding that in might involve
   upstreaming some changes to QEMU, which has a time frame that is out of
   our control.
  
  Xen maintains a separate repo for the QEMU code it uses.  I presume
  this is because there is always something a little out of sync with
  the mainstream QEMU release.  I do not understand why we cannot rely
  on this to make available any needed changes to QEMU pending their
  incorporation into QEMU proper.
 
 ISTR our policy is upstream first. That is, though we maintain our own
 qemu tree those changesets are all upstream changesets. Arguably there
 might be some bandaid changesets that are not upstream but big changes
 like this needs to be upstreamed first.
 
 Stefano, could you clarify this and correct me if I'm wrong?

Yes, the policy is upstream first, however it doesn't need to land in a
QEMU release. Just be upstream.

There is still please of time for that: Eric just needs to send his
patches to qemu-devel, get the acks, and I'll apply to
qemu-xen-upstream.



   So my hunch is that we're not going to make it in time for
   4.6. :-/
  
   Wei.
  
  4.5 was _just_ released, and Xen is on a ~10 month release cycle.  Why
  can't this get done?  Someone just has to take a little time to sit
 
 Notably there are many months that are 

Re: [Xen-devel] [RFC 4/7] libxl: Add stubdomain_version to domain_build_info.

2015-02-06 Thread Stefano Stabellini
On Tue, 3 Feb 2015, Eric Shelton wrote:
 This enum gives the ability to select between a MiniOS-based QEMU
 traditional stub domain and a Linux-based QEMU upstream stub domain.  To
 use the Linux-based stubdomain, the following two lines should be
 included in the appropriate xl.cfg file:
 
 device_model_version=qemu-xen
 device_model_stubdomain_override=1
 
 To use the MiniOS-based stubdomain, the following is used instead:
 
 device_model_version=qemu-xen-traditional
 device_model_stubdomain_override=1
 
 Signed-off-by: Eric Shelton eshel...@pobox.com
 ---
  tools/libxl/libxl_create.c  | 34 +-
  tools/libxl/libxl_types.idl |  7 +++
  2 files changed, 36 insertions(+), 5 deletions(-)
 
 diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
 index 98687bd..15258fa 100644
 --- a/tools/libxl/libxl_create.c
 +++ b/tools/libxl/libxl_create.c
 @@ -181,12 +181,36 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
  }
  
  if (b_info-type == LIBXL_DOMAIN_TYPE_HVM 
 -b_info-device_model_version !=
 -LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL 
  libxl_defbool_val(b_info-device_model_stubdomain)) {
 -LIBXL__LOG(CTX, XTL_ERROR,
 -device model stubdomains require \qemu-xen-traditional\);
 -return ERROR_INVAL;
 +if (!b_info-stubdomain_version) {
 +switch (b_info-device_model_version) {
 +case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
 +b_info-stubdomain_version = LIBXL_STUBDOMAIN_VERSION_MINIOS;
 +break;
 +case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
 +b_info-stubdomain_version = LIBXL_STUBDOMAIN_VERSION_LINUX;
 +break;
 +default: abort();
 +}
 +}
 +
 +switch (b_info-device_model_version) {
 +case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
 +if (b_info-stubdomain_version != 
 LIBXL_STUBDOMAIN_VERSION_MINIOS) {
 +LIBXL__LOG(CTX, XTL_ERROR,
 +  \qemu-xen-traditional\ require \minios\ as 
 stubdomain);
 +return ERROR_INVAL;
 +}
 +break;
 +case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
 +if (b_info-stubdomain_version != 
 LIBXL_STUBDOMAIN_VERSION_LINUX) {
 +LIBXL__LOG(CTX, XTL_ERROR,
 +   \qemu-xen\ require \linux\ as stubdomain);
 +return ERROR_INVAL;
 +}
 +break;
 +default: abort();
 +}
  }
  
  if (!b_info-max_vcpus)
 diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
 index 02be466..8d0ac3b 100644
 --- a/tools/libxl/libxl_types.idl
 +++ b/tools/libxl/libxl_types.idl
 @@ -83,6 +83,12 @@ libxl_device_model_version = 
 Enumeration(device_model_version, [
  (2, QEMU_XEN), # Upstream based qemu-xen device model
  ])
  
 +# Give the kernel running in the stub-domain
 +libxl_stubdomain_version = Enumeration(stubdomain_version, [

This should just be called stubdomain_version.


 +(1, MINIOS),
 +(2, LINUX),
 +])
 +
  libxl_console_type = Enumeration(console_type, [
  (0, UNKNOWN),
  (1, SERIAL),
 @@ -379,6 +385,7 @@ libxl_domain_build_info = Struct(domain_build_info,[
  
  (device_model_version, libxl_device_model_version),
  (device_model_stubdomain, libxl_defbool),
 +(stubdomain_version, libxl_stubdomain_version),
  # if you set device_model you must set device_model_version too
  (device_model, string),
  (device_model_ssidref, uint32),
 -- 
 1.8.5.5
 

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


Re: [Xen-devel] [RFC 6/7] libxl: Build the domain with a Linux based stubdomain

2015-02-06 Thread Stefano Stabellini
On Tue, 3 Feb 2015, Eric Shelton wrote:
 This will build a Linux-based stubdomain with QEMU upstream.
 
 Signed-off-by: Eric Shelton eshel...@pobox.com
 ---
  tools/libxl/libxl.c  |  25 --
  tools/libxl/libxl_create.c   |   7 ++-
  tools/libxl/libxl_dm.c   | 108 
 ---
  tools/libxl/libxl_internal.c |  22 +
  tools/libxl/libxl_internal.h |   4 ++
  5 files changed, 145 insertions(+), 21 deletions(-)
 
 diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
 index 82227e8..85cf5eb 100644
 --- a/tools/libxl/libxl.c
 +++ b/tools/libxl/libxl.c
 @@ -1757,8 +1757,17 @@ static int libxl__primary_console_find(libxl_ctx *ctx, 
 uint32_t domid_vm,
  
  if (stubdomid) {
  *domid = stubdomid;
 -*cons_num = STUBDOM_CONSOLE_SERIAL;
  *type = LIBXL_CONSOLE_TYPE_PV;
 +switch (libxl__stubdomain_version_running(gc, stubdomid)) {
 +case LIBXL_STUBDOMAIN_VERSION_MINIOS:
 +*cons_num = STUBDOM_CONSOLE_SERIAL;
 +break;
 +case LIBXL_STUBDOMAIN_VERSION_LINUX:
 +*cons_num = 1;

You might want to introduce LINUX_STUBDOMAIN_CONSOLE_SERIAL and rename
the existing to MINIOS_STUBDOM_CONSOLE_SERIAL.

In any case I think you'll eventually want as many serial console in a
linux stubdom as you have in a minios stubdom.


 +break;
 +default:
 +abort();
 +}
  } else {
  switch (libxl__domain_type(gc, domid_vm)) {
  case LIBXL_DOMAIN_TYPE_HVM:
 @@ -4927,8 +4936,18 @@ int libxl_domain_need_memory(libxl_ctx *ctx, 
 libxl_domain_build_info *b_info,
  switch (b_info-type) {
  case LIBXL_DOMAIN_TYPE_HVM:
  *need_memkb += b_info-shadow_memkb + LIBXL_HVM_EXTRA_MEMORY;
 -if (libxl_defbool_val(b_info-device_model_stubdomain))
 -*need_memkb += 32 * 1024;
 +if (libxl_defbool_val(b_info-device_model_stubdomain)) {
 +switch (b_info-stubdomain_version) {
 +case LIBXL_STUBDOMAIN_VERSION_MINIOS:
 +*need_memkb += 32 * 1024;
 +break;
 +case LIBXL_STUBDOMAIN_VERSION_LINUX:
 +*need_memkb += LIBXL_LINUX_STUBDOM_MEM * 1024;
 +break;
 +default:
 +abort();
 +}
 +}
  break;
  case LIBXL_DOMAIN_TYPE_PV:
  *need_memkb += b_info-shadow_memkb + LIBXL_PV_EXTRA_MEMORY;
 diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
 index 15258fa..b2c903e 100644
 --- a/tools/libxl/libxl_create.c
 +++ b/tools/libxl/libxl_create.c
 @@ -1358,7 +1358,12 @@ static void domcreate_devmodel_started(libxl__egc *egc,
  if (dcs-dmss.dm.guest_domid) {
  if (d_config-b_info.device_model_version
  == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
 -libxl__qmp_initializations(gc, domid, d_config);
 +if 
 (!libxl_defbool_val(d_config-b_info.device_model_stubdomain)) {
 +libxl__qmp_initializations(gc, domid, d_config);
 +} else {
 +int stubdom_domid = dcs-dmss.pvqemu.guest_domid;
 +libxl__qmp_initializations(gc, stubdom_domid, d_config);
 +}
  }
  }
  
 diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
 index 68d5886..d03be4a 100644
 --- a/tools/libxl/libxl_dm.c
 +++ b/tools/libxl/libxl_dm.c
 @@ -1000,6 +1000,16 @@ retry_transaction:
  return 0;
  }
  
 +static int libxl__store_libxl_entry(libxl__gc *gc, uint32_t domid,
 +const char *name, const char *value)
 +{
 +char *path = NULL;
 +
 +path = libxl__xs_libxl_path(gc, domid);
 +path = libxl__sprintf(gc, %s/%s, path, name);
 +return libxl__xs_write(gc, XBT_NULL, path, %s, value);
 +}
 +
  static void spawn_stubdom_pvqemu_cb(libxl__egc *egc,
  libxl__dm_spawn_state *stubdom_dmss,
  int rc);
 @@ -1030,6 +1040,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, 
 libxl__stub_dm_spawn_state *sdss)
  char **args;
  struct xs_permissions perm[2];
  xs_transaction_t t;
 +libxl_device_disk disk_stub;
  
  /* convenience aliases */
  libxl_domain_config *const dm_config = sdss-dm_config;
 @@ -1038,10 +1049,14 @@ void libxl__spawn_stub_dm(libxl__egc *egc, 
 libxl__stub_dm_spawn_state *sdss)
  libxl__domain_build_state *const d_state = sdss-dm.build_state;
  libxl__domain_build_state *const stubdom_state = sdss-dm_state;
  
 -if (guest_config-b_info.device_model_version !=
 -LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) {
 -ret = ERROR_INVAL;
 -goto out;
 +assert(libxl_defbool_val(guest_config-b_info.device_model_stubdomain));
 +
 +if (guest_config-b_info.stubdomain_version == 
 LIBXL_STUBDOMAIN_VERSION_LINUX) {
 +if (d_state-saved_state) {
 +LOG(ERROR, Save/Restore not supported yet with 

Re: [Xen-devel] [RFC 7/7] libxl: Wait for QEMU startup in stubdomain

2015-02-06 Thread Eric Shelton
On Fri, Feb 6, 2015 at 10:36 AM, Stefano Stabellini
stefano.stabell...@eu.citrix.com wrote:
 On Fri, 6 Feb 2015, Wei Liu wrote:

 ISTR our policy is upstream first. That is, though we maintain our own
 qemu tree those changesets are all upstream changesets. Arguably there
 might be some bandaid changesets that are not upstream but big changes
 like this needs to be upstreamed first.

 Stefano, could you clarify this and correct me if I'm wrong?

 Yes, the policy is upstream first, however it doesn't need to land in a
 QEMU release. Just be upstream.

 There is still please of time for that: Eric just needs to send his
 patches to qemu-devel, get the acks, and I'll apply to
 qemu-xen-upstream.

Sounds good.  I think the main thing I am looking at before going to
qemu-devel is getting the xenfb-based display code up and running.
However, QEMU is a somewhat unfamiliar codebase for me, and it doesn't
help that QEMU's display pipeline seems to have been rearchitected a
time or two since QEMU 0.10, as it seems to limit QEMU-traditional's
utility as a prototype to follow.  If anyone was any ideas what the
missing links are for the display pipeline, I would appreciate any
pointers.

   So my hunch is that we're not going to make it in time for
   4.6. :-/
  
   Wei.
 
  4.5 was _just_ released, and Xen is on a ~10 month release cycle.  Why
  can't this get done?  Someone just has to take a little time to sit

 Notably there are many months that are code freeze.

 And due to our upstream first QEMU policy we would also need to upstream
 changes to QEMU.

 Getting the patches upstream in QEMU shouldn't take longer than getting
 them upstream in Xen.

 Also I think upstream QEMU stubdoms would be valuable even without
 save/restore support.

Good to hear.  As I mentioned when I posted the patches, I am guessing
QMP, which appears to be needed for save/restore among other things,
is going to present some headaches if there are any commands that will
require coordination of both the stubdom- and Dom0-side instances of
QEMU for completion.  Anyway, I doubt I am the right person to tackle
save/restore - it's not a feature I make use of at all.

  Can we arrive at an agreement that a Linux-based QEMU-upstream stubdom
  should _at least_ be a technical preview for Xen 4.6?  A year ago,

 I agree. Or rumpkernel-based QEMU-upstream stubdom. Or something.

 If we really want to make this happen before new protocol and
 implementation are in place.  That would be tech preview or
 experimental, whichever is the term for least mature technology. Note
 that this is not due to the route it chooses (Linux based), it's due to
 the fact that the protocol is broken and destined to be changed.

 I think we should not block the entire upstream stubdom effort, whether
 it is Linux, MiniOS or Rumpkernel based, waiting for the bootup protocol
 to be fixed.

 The two things can and should be done in parallel.

Great; I think we should be able to make this happen for 4.6.

One of the main issues outstanding from when Anthony originally posted
his patches is how we want to go about building this?  I honestly do
not know how well the current dracut-based approach to building the
root image will work across various Linux distributions; perhaps it
will be OK, since all of the libraries that dracut will siphon in will
have to be in place to meet the build requirements for QEMU to begin
with.  However, I have zero knowledge about ARM-based Xen or where
NetBSD is used for dom0, and how they might affect the decisionmaking.
I also do not know what lessons have been learned from building other
stubdoms, rumpkernel, or Mirage that might inform these decisions.

In other words, what do you see as a sensible build scheme?  The
approach taken in the patches strikes me as too hacky for release
quality, but maybe it is OK...

- Eric

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


Re: [Xen-devel] question about memory allocation for driver domain

2015-02-06 Thread Oleksandr Tyshchenko
Hi Julien

On Thu, Feb 5, 2015 at 6:36 PM, Oleksandr Tyshchenko
oleksandr.tyshche...@globallogic.com wrote:
 On Thu, Feb 5, 2015 at 5:24 PM, Julien Grall julien.gr...@linaro.org wrote:
 Hi Oleksandr,
 Hi Julien


 On 05/02/2015 21:49, Oleksandr Tyshchenko wrote:

 On Thu, Feb 5, 2015 at 3:12 PM, Ian Campbell ian.campb...@citrix.com
 wrote:

 On Wed, 2015-02-04 at 18:47 +0200, Oleksandr Tyshchenko wrote:

 Hi, all.

 We have begun to use the driver domain on OMAP5 platform.
 To make driver domain running on OMAP5 platform we need to have it
 memory 1 to 1 mapped because of lacking SMMU support on this platform.
 To satisfy this requirement we have done temporally solution which
 works but not entirely completed and looks not good from Xen
 perspective. The main question in memory allocator in Xen.

 We did next steps:
 1. toolstack:
 - allow to allocate 128/256/512 Mb memory chunks
 - add ability to set rambase_pfn via cfg file

 2. hypervisor:
 - alloc driver domain memory 1 to 1
- mark domain with id 1 as privileged
- update memory allocation logic for such domain
- allocate memory in the same way as for domain 0

 But we have encountered with one thing related to memory allocation
 algorithm.
 Let me describe what I mean.
 Our requirements is to allocate one specified chunk if it is present in
 domheap.
 We have this spec_mfn which are a rambase_pfn for driver domain we
 want to map 1 to 1. We can get it from extent_list. So, we need to
 alloc chunk which would be correspond to spec_mfn.
 In other world we need to allocate known chunk of memory. But if I
 understood correctly that the existing allocator doesn't allow us to
 do that directly.

 There are some thoughts how to do that. But, at first, we need to
 choose right direction:
 1. Add the separate memory allocator which allow us to alloc specified
 chunk if it is present. And use it in case when we need to allocate
 memory for driver domain 1:1 only. We can pass bool variable via cfg
 file to show what we want (1:1 or not).
 2. Don't add separate allocator. Modify existing allocator to add
 ability to alloc specified chunk.
 3. Don't add and modify anything. Let the allocator to work as usual.
 Return mfn of allocating chunk and correct the default rambase_pfn in
 toolstack.
 What we actually have in the moment but do that manually. We see what
 the mfn we got and corrected rambase_pfn property in cfg file.

 Could someone explain me what is a right way?


 The approach we've taken with dom0 is not to require specific addresses,
 but rather to tailor the address map to the contiguous region the
 allocator gives us.

 Since I presume you are using a 1:1 layout in the driver domain too I
 expect that approach should work there too (I think this is your #3?).

 yes


 Your #2 might be possible, but would probably involve a reasonably
 expensive scan of the various free pools in the hopes of finding the
 block you want, since it isn't designed to be looked up in this way.

 I suppose #1 would be something like Linux's CMA allocator -- i.e.
 carving out 1 or more regions on boot and keeping them away from the
 main allocator (but still in e.g. the frametable etc) and a simple way
 to allocate one of the chunks.

 This is interesting. Can I use /memreserve/ logic or something similar to
 keeping them away from the main allocator?
 But at the stages where we initialize domheap we know nothing about
 guest domain (domd) and how we need to allocate memory for it (1:1 or
 not).


 The first approach we had for DOM0 1:1 mapping was book-keeping memory at
 startup. The main allocator wasn't able to use it.

 But this turn out to be very hackish and not scalable (multiple memory
 banks...).


 So I think any of the approaches you suggest could work, I'd probably
 say #3, #1, #2 in decreasing order of preference.

 I got it.


 If I correctly understand the solution #3, it may end up to lots of small
 banks after domains has been created/destroyed multiple
 I do not quite understand why this can happen. Anyway, I need to check
 this assumption.
 I will let you know about result.

Let me describe in detail about solution #3 before answer to your
question. Maybe I missed something in
the first mail. Also the Ian's answer clarified to me some points.
We don't have complete solution for now. We only have temporally
solution in which
we relied on assumptions which might or not be acceptable, but it
seems that the approach in general could work.
If it is true the our target is to rewrite/rework this stuff, to make
it more cleaner and correct from XEN point of view for platforms which
doesn't have a SMMU
even in the case where this stuff never reaches upstream.

To run driver domain (domd) on OMAP5 platform with 1:1 mapping we did
next preparations:
(here I try to explain about memory allocation only, IRQ handling and
other things are out of scope for the current thread)
1. Since the domd can use 128/256/512 Mb of RAM we modified existing

Re: [Xen-devel] [RFC 7/7] libxl: Wait for QEMU startup in stubdomain

2015-02-06 Thread Stefano Stabellini
On Fri, 6 Feb 2015, Eric Shelton wrote:
 On Fri, Feb 6, 2015 at 10:36 AM, Stefano Stabellini
 stefano.stabell...@eu.citrix.com wrote:
  On Fri, 6 Feb 2015, Wei Liu wrote:
 
  ISTR our policy is upstream first. That is, though we maintain our own
  qemu tree those changesets are all upstream changesets. Arguably there
  might be some bandaid changesets that are not upstream but big changes
  like this needs to be upstreamed first.
 
  Stefano, could you clarify this and correct me if I'm wrong?
 
  Yes, the policy is upstream first, however it doesn't need to land in a
  QEMU release. Just be upstream.
 
  There is still please of time for that: Eric just needs to send his
  patches to qemu-devel, get the acks, and I'll apply to
  qemu-xen-upstream.
 
 Sounds good.  I think the main thing I am looking at before going to
 qemu-devel is getting the xenfb-based display code up and running.
 However, QEMU is a somewhat unfamiliar codebase for me, and it doesn't
 help that QEMU's display pipeline seems to have been rearchitected a
 time or two since QEMU 0.10, as it seems to limit QEMU-traditional's
 utility as a prototype to follow.  If anyone was any ideas what the
 missing links are for the display pipeline, I would appreciate any
 pointers.

Firstly I would check that xenfb is working without QEMU.

Then I would try to get access to QEMU to the framebuffer using
something like directfb:

https://lists.gnu.org/archive/html/qemu-devel/2010-05/msg01201.html

Or the directfb driver in libsdl.


So my hunch is that we're not going to make it in time for
4.6. :-/
   
Wei.
  
   4.5 was _just_ released, and Xen is on a ~10 month release cycle.  Why
   can't this get done?  Someone just has to take a little time to sit
 
  Notably there are many months that are code freeze.
 
  And due to our upstream first QEMU policy we would also need to upstream
  changes to QEMU.
 
  Getting the patches upstream in QEMU shouldn't take longer than getting
  them upstream in Xen.
 
  Also I think upstream QEMU stubdoms would be valuable even without
  save/restore support.
 
 Good to hear.  As I mentioned when I posted the patches, I am guessing
 QMP, which appears to be needed for save/restore among other things,
 is going to present some headaches if there are any commands that will
 require coordination of both the stubdom- and Dom0-side instances of
 QEMU for completion.  Anyway, I doubt I am the right person to tackle
 save/restore - it's not a feature I make use of at all.

fair enough


   Can we arrive at an agreement that a Linux-based QEMU-upstream stubdom
   should _at least_ be a technical preview for Xen 4.6?  A year ago,
 
  I agree. Or rumpkernel-based QEMU-upstream stubdom. Or something.
 
  If we really want to make this happen before new protocol and
  implementation are in place.  That would be tech preview or
  experimental, whichever is the term for least mature technology. Note
  that this is not due to the route it chooses (Linux based), it's due to
  the fact that the protocol is broken and destined to be changed.
 
  I think we should not block the entire upstream stubdom effort, whether
  it is Linux, MiniOS or Rumpkernel based, waiting for the bootup protocol
  to be fixed.
 
  The two things can and should be done in parallel.
 
 Great; I think we should be able to make this happen for 4.6.
 
 One of the main issues outstanding from when Anthony originally posted
 his patches is how we want to go about building this?  I honestly do
 not know how well the current dracut-based approach to building the
 root image will work across various Linux distributions; perhaps it
 will be OK, since all of the libraries that dracut will siphon in will
 have to be in place to meet the build requirements for QEMU to begin
 with. 

 However, I have zero knowledge about ARM-based Xen or where
 NetBSD is used for dom0, and how they might affect the decisionmaking.
 I also do not know what lessons have been learned from building other
 stubdoms, rumpkernel, or Mirage that might inform these decisions.
 In other words, what do you see as a sensible build scheme?  The
 approach taken in the patches strikes me as too hacky for release
 quality, but maybe it is OK...
 
It looks OK to me but I am not an expert in this kind of things. I'll
let Ian Campbell and Ian Jackson (CC'ed) comment on it.

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


Re: [Xen-devel] [RFC 1/7] linux-stubdomain: Compile QEMU

2015-02-06 Thread Eric Shelton
On Fri, Feb 6, 2015 at 10:46 AM, Stefano Stabellini
stefano.stabell...@eu.citrix.com wrote:
 On Tue, 3 Feb 2015, Eric Shelton wrote:

 Before having patches, I would like to try to get them upstream in QEMU.
 If we really cannot do that, then I would still prefer to commit any
 required workarounds to the qemu-xen rather than having them here as
 patches.

Absolutely; the intent is to upstream the changes to QEMU, and
eliminate the patching to QEMU being done in the patchset I sent out.
I just need to sort out all of the QEMU changes first...

 diff --git a/stubdom-linux/qemu-xen-common.patch 
 b/stubdom-linux/qemu-xen-common.patch
 new file mode 100644
 index 000..b473e36
 --- /dev/null
 +++ b/stubdom-linux/qemu-xen-common.patch
 @@ -0,0 +1,12 @@
 +--- a/xen-common.c   2015-01-25 20:42:36.32998 -0500
  b/xen-common.c   2015-01-25 20:43:20.34663 -0500
 +@@ -92,7 +92,8 @@
 + exit(1);
 + }
 +
 +-snprintf(path, sizeof (path), device-model/%u/state, xen_domid);
 ++snprintf(path, sizeof (path),
 ++ /local/domain/0/device-model/%u/state, xen_domid);

 Even if this counts as a workaround, I think it could go upstream in
 QEMU.

Agreed, although I will likely follow Wei's suggestion to use a
/local/domain/{stubdom-id}/... path, instead of under dom0's tree in
xenstore.

 diff --git a/stubdom-linux/qemu-xen-h.patch b/stubdom-linux/qemu-xen-h.patch
 new file mode 100644
 index 000..262b1d1
 --- /dev/null
 +++ b/stubdom-linux/qemu-xen-h.patch
 @@ -0,0 +1,18 @@
 +--- a/include/hw/xen/xen.h   2015-01-21 23:54:36.85662 -0500
  b/include/hw/xen/xen.h   2015-01-21 23:55:39.35667 -0500
 +@@ -28,6 +28,15 @@
 + return xen_allowed;
 + }
 +
 ++static inline int xen_stubdom_enable(void)
 ++{
 ++#ifdef CONFIG_STUBDOM
 ++return 1;
 ++#else
 ++return 0;
 ++#endif
 ++}

 As the STUBDOM related changes are small, I think we could avoid to
 introduce this config option altogether.

 Maybe we could figure out that we are running as stubdom with a runtime
 option, like a command line argument, something on xenstore or even our
 own domain id.

I will have to check - there may have been other preexisting uses of
CONFIG_STUBDOM is QEMU-upstream that might further encourage its use.
I'm also not sure if we get much benefit out of doing runtime checks
instead of ifdef's, since I think we'll end up having to do a separate
build of QEMU for stubdom anyways.

- Eric

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


Re: [Xen-devel] [RFC 1/7] linux-stubdomain: Compile QEMU

2015-02-06 Thread Stefano Stabellini
On Fri, 6 Feb 2015, Eric Shelton wrote:
 On Fri, Feb 6, 2015 at 10:46 AM, Stefano Stabellini
 stefano.stabell...@eu.citrix.com wrote:
  On Tue, 3 Feb 2015, Eric Shelton wrote:
 
  Before having patches, I would like to try to get them upstream in QEMU.
  If we really cannot do that, then I would still prefer to commit any
  required workarounds to the qemu-xen rather than having them here as
  patches.
 
 Absolutely; the intent is to upstream the changes to QEMU, and
 eliminate the patching to QEMU being done in the patchset I sent out.
 I just need to sort out all of the QEMU changes first...
 
  diff --git a/stubdom-linux/qemu-xen-common.patch 
  b/stubdom-linux/qemu-xen-common.patch
  new file mode 100644
  index 000..b473e36
  --- /dev/null
  +++ b/stubdom-linux/qemu-xen-common.patch
  @@ -0,0 +1,12 @@
  +--- a/xen-common.c   2015-01-25 20:42:36.32998 -0500
   b/xen-common.c   2015-01-25 20:43:20.34663 -0500
  +@@ -92,7 +92,8 @@
  + exit(1);
  + }
  +
  +-snprintf(path, sizeof (path), device-model/%u/state, xen_domid);
  ++snprintf(path, sizeof (path),
  ++ /local/domain/0/device-model/%u/state, xen_domid);
 
  Even if this counts as a workaround, I think it could go upstream in
  QEMU.
 
 Agreed, although I will likely follow Wei's suggestion to use a
 /local/domain/{stubdom-id}/... path, instead of under dom0's tree in
 xenstore.
 
  diff --git a/stubdom-linux/qemu-xen-h.patch 
  b/stubdom-linux/qemu-xen-h.patch
  new file mode 100644
  index 000..262b1d1
  --- /dev/null
  +++ b/stubdom-linux/qemu-xen-h.patch
  @@ -0,0 +1,18 @@
  +--- a/include/hw/xen/xen.h   2015-01-21 23:54:36.85662 -0500
   b/include/hw/xen/xen.h   2015-01-21 23:55:39.35667 -0500
  +@@ -28,6 +28,15 @@
  + return xen_allowed;
  + }
  +
  ++static inline int xen_stubdom_enable(void)
  ++{
  ++#ifdef CONFIG_STUBDOM
  ++return 1;
  ++#else
  ++return 0;
  ++#endif
  ++}
 
  As the STUBDOM related changes are small, I think we could avoid to
  introduce this config option altogether.
 
  Maybe we could figure out that we are running as stubdom with a runtime
  option, like a command line argument, something on xenstore or even our
  own domain id.
 
 I will have to check - there may have been other preexisting uses of
 CONFIG_STUBDOM is QEMU-upstream that might further encourage its use.
 I'm also not sure if we get much benefit out of doing runtime checks
 instead of ifdef's, since I think we'll end up having to do a separate
 build of QEMU for stubdom anyways.
 
The benefit would be avoiding the introduction of CONFIG_STUBDOM as the
QEMU community might not be too keen on it. But it is worth a try.

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


Re: [Xen-devel] [PATCH v4] tools: work around collision of -O0 and -D_FORTIFY_SOURCE

2015-02-06 Thread Ian Jackson
Don Slutz writes (Re: [PATCH v4] tools: work around collision of -O0 and 
-D_FORTIFY_SOURCE):
 On 02/06/15 06:04, Ian Jackson wrote:
  Some systems have python-config include -D_FORTIFY_SOURCE in the
  CFLAGS.  But -D_FORTIFY_SOURCE does not (currently) work with -O0, and
  -O0 is enabled in debug builds (since 1166ecf781).  As a result, on
  those systems, debug builds fail.
 
 Works for me so:
 
 Tested-by: Don Slutz dsl...@verizon.com

Thanks, I have pushed this to staging.

AFAICT 1166ecf781 (the thing which broke this) isn't in staging-4.5 so
there is no need for a backport.

Thanks,
Ian.

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


Re: [Xen-devel] [RFC PATCH V3 11/12] xen/vm_event: Decouple vm_event and mem_access.

2015-02-06 Thread Tamas K Lengyel
On Wed, Feb 4, 2015 at 10:47 AM, Jan Beulich jbeul...@suse.com wrote:
 On 29.01.15 at 22:46, tamas.leng...@zentific.com wrote:
 --- a/xen/common/Makefile
 +++ b/xen/common/Makefile
 @@ -52,9 +52,10 @@ obj-y += tmem_xen.o
  obj-y += radix-tree.o
  obj-y += rbtree.o
  obj-y += lzo.o
 +obj-y += vm_event.o
 +obj-y += monitor.o

 Please make the (not) sorting situation worse than it already is - the
 original intention was for entries to be alphabetically sorted here.

I'm just going to sort the list in this patch to have everything in
alphabetic order.


 --- /dev/null
 +++ b/xen/common/monitor.c
 @@ -0,0 +1,64 @@
 +/**
 + * monitor.c
 + *
 + * VM event monitor support.
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 + */
 +
 +#include xen/sched.h
 +#include xen/vm_event.h
 +#include xen/mem_access.h
 +
 +void monitor_resume(struct domain *d)
 +{
 +vm_event_response_t rsp;
 +
 +/* Pull all responses off the ring. */
 +while ( vm_event_get_response(d, d-vm_event-monitor, rsp) )
 +{
 +struct vcpu *v;
 +
 +if ( rsp.version != VM_EVENT_INTERFACE_VERSION )
 +continue;
 +
 +#ifndef NDEBUG
 +if ( rsp.flags  VM_EVENT_FLAG_DUMMY )
 +continue;
 +#endif

 This code was unconditional in the original function. Such a change
 needs mentioning in the description.

Ah, yes, the patch that makes this conditional has to be moved up
before this one.


 @@ -49,7 +53,7 @@ int mem_access_send_req(struct domain *d, 
 vm_event_request_t *req)
  return -ENOSYS;
  }

 -static inline void mem_access_resume(struct domain *d) {}
 +static inline void mem_access_resume(struct vcpu *vcpu, vm_event_response_t 
 *rsp) {}

 Long line.

 --- /dev/null
 +++ b/xen/include/xen/monitor.h
 @@ -0,0 +1,38 @@
 +/**
 + * monitor.h
 + *
 + * Monitor event support.
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 + */
 +
 +#ifndef _XEN_ASM_MONITOR_H
 +#define _XEN_ASM_MONITOR_H
 +
 +#include public/memory.h

 This can't be enough (nor can I see why it's needed here), or else ...

 +/* Resumes the running of the VCPU, restarting the last instruction */
 +void monitor_resume(struct domain *d);

 ... struct domain may end up being a forward reference (with scope
 restricted to monitor_resume()).

 Jan

I'll revisit the headers needed for this one but it did build fine.

Thanks,
Tamas

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


Re: [Xen-devel] [RFC PATCH V3 12/12] xen/vm_event: Check for VM_EVENT_FLAG_DUMMY only in Debug builds

2015-02-06 Thread Tamas K Lengyel
On Wed, Feb 4, 2015 at 6:59 AM, Tian, Kevin kevin.t...@intel.com wrote:
 From: Tamas K Lengyel [mailto:tamas.leng...@zentific.com]
 Sent: Friday, January 30, 2015 5:47 AM

 The flag is only used for debugging purposes, thus it should be only checked
 for in debug builds of Xen.

 Signed-off-by: Tamas K Lengyel tamas.leng...@zentific.com
 ---
  xen/arch/x86/mm/mem_sharing.c |  2 ++
  xen/arch/x86/mm/p2m.c |  2 ++
  xen/common/mem_access.c   | 31
 +++
  3 files changed, 35 insertions(+)

 diff --git a/xen/arch/x86/mm/mem_sharing.c
 b/xen/arch/x86/mm/mem_sharing.c
 index c487207..303c2fb 100644
 --- a/xen/arch/x86/mm/mem_sharing.c
 +++ b/xen/arch/x86/mm/mem_sharing.c
 @@ -604,8 +604,10 @@ int mem_sharing_sharing_resume(struct domain *d)
  if ( rsp.version != VM_EVENT_INTERFACE_VERSION )
  continue;

 +#ifndef NDEBUG
  if ( rsp.flags  VM_EVENT_FLAG_DUMMY )
  continue;
 +#endif

  /* Validate the vcpu_id in the response. */
  if ( (rsp.vcpu_id = d-max_vcpus) || !d-vcpu[rsp.vcpu_id] )
 diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
 index 3b58700..1d91000 100644
 --- a/xen/arch/x86/mm/p2m.c
 +++ b/xen/arch/x86/mm/p2m.c
 @@ -1305,8 +1305,10 @@ void p2m_mem_paging_resume(struct domain *d)
  if ( rsp.version != VM_EVENT_INTERFACE_VERSION )
  continue;

 +#ifndef NDEBUG
  if ( rsp.flags  VM_EVENT_FLAG_DUMMY )
  continue;
 +#endif

  /* Validate the vcpu_id in the response. */
  if ( (rsp.vcpu_id = d-max_vcpus) || !d-vcpu[rsp.vcpu_id] )
 diff --git a/xen/common/mem_access.c b/xen/common/mem_access.c
 index 3655165..e0a538f 100644
 --- a/xen/common/mem_access.c
 +++ b/xen/common/mem_access.c
 @@ -30,6 +30,37 @@
  #include asm/p2m.h
  #include xsm/xsm.h

 +void mem_access_resume(struct domain *d)

 so there is no caller of this new function?

This patch seems to got a bit mangled with the previous one so I'll
clean it up. The only thing I intended to have in this patch is the
#ifndef wrapper to be around the DUMMY check. Sorry for the noise.


 +{
 +vm_event_response_t rsp;
 +
 +/* Pull all responses off the ring. */
 +while ( vm_event_get_response(d, d-vm_event-monitor, rsp) )
 +{
 +struct vcpu *v;
 +
 +if ( rsp.version != VM_EVENT_INTERFACE_VERSION )
 +continue;
 +
 +#ifndef NDEBUG
 +if ( rsp.flags  VM_EVENT_FLAG_DUMMY )
 +continue;
 +#endif
 +
 +/* Validate the vcpu_id in the response. */
 +if ( (rsp.vcpu_id = d-max_vcpus) || !d-vcpu[rsp.vcpu_id] )
 +continue;
 +
 +v = d-vcpu[rsp.vcpu_id];
 +
 +p2m_vm_event_emulate_check(v, rsp);
 +
 +/* Unpause domain. */
 +if ( rsp.flags  VM_EVENT_FLAG_VCPU_PAUSED )
 +vm_event_vcpu_unpause(v);
 +}
 +}
 +
  int mem_access_memop(unsigned long cmd,

 XEN_GUEST_HANDLE_PARAM(xen_mem_access_op_t) arg)
  {
 --
 2.1.4


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


Re: [Xen-devel] [RFC PATCH V3 05/12] xen: Introduce vm_event

2015-02-06 Thread Tamas K Lengyel
On Tue, Feb 3, 2015 at 4:54 PM, Jan Beulich jbeul...@suse.com wrote:
 On 29.01.15 at 22:46, tamas.leng...@zentific.com wrote:
 --- a/docs/misc/xsm-flask.txt
 +++ b/docs/misc/xsm-flask.txt
 @@ -87,6 +87,7 @@ __HYPERVISOR_domctl (xen/include/public/domctl.h)
   * XEN_DOMCTL_set_machine_address_size
   * XEN_DOMCTL_debug_op
   * XEN_DOMCTL_gethvmcontext_partial
 + * XEN_DOMCTL_vm_event_op
   * XEN_DOMCTL_mem_event_op
   * XEN_DOMCTL_mem_sharing_op
   * XEN_DOMCTL_setvcpuextstate

 No - no additions here. You don't define XEN_DOMCTL_vm_event_op
 in this patch anyway. Once you rename the other one, replacing it
 here will be okay.

 --- /dev/null
 +++ b/xen/common/vm_event.c
 @@ -0,0 +1,739 @@

 Please clarify in the patch description whether this (and perhaps
 other) copied or cloned code is really just a plain copy with some
 renaming, or whether there are any other changes. Reviewing this
 as a non-renaming change isn't time well spent in the former case.

Ack, this code is identical to mem_event beside the name.


 --- a/xen/include/public/domctl.h
 +++ b/xen/include/public/domctl.h
 @@ -835,6 +835,84 @@ typedef struct xen_domctl_mem_event_op 
 xen_domctl_mem_event_op_t;
  DEFINE_XEN_GUEST_HANDLE(xen_domctl_mem_event_op_t);

  /*
 + * VM event operations
 + */
 +
 +/* XEN_DOMCTL_vm_event_op */
 +
 +/*
 + * Domain memory paging
 + * Page memory in and out.
 + * Domctl interface to set up and tear down the
 + * pager-hypervisor interface. Use XENMEM_paging_op*
 + * to perform per-page operations.
 + *
 + * The XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE domctl returns several
 + * non-standard error codes to indicate why paging could not be enabled:
 + * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest
 + * EMLINK - guest has iommu passthrough enabled
 + * EXDEV  - guest has PoD enabled
 + * EBUSY  - guest has or had paging enabled, ring buffer still active
 + */
 +#define XEN_DOMCTL_VM_EVENT_OP_PAGING1
 +
 +#define XEN_DOMCTL_VM_EVENT_OP_PAGING_ENABLE 0
 +#define XEN_DOMCTL_VM_EVENT_OP_PAGING_DISABLE1
 +
 +/*
 + * Monitor permissions.
 + *
 + * As with paging, use the domctl for teardown/setup of the
 + * helper-hypervisor interface.
 + *
 + * There are HVM hypercalls to set the per-page access permissions of every
 + * page in a domain.  When one of these permissions--independent, read,
 + * write, and execute--is violated, the VCPU is paused and a memory event
 + * is sent with what happened.  (See public/vm_event.h) .
 + *
 + * The memory event handler can then resume the VCPU and redo the access
 + * with a XENMEM_access_op_resume hypercall.
 + *
 + * The XEN_DOMCTL_VM_EVENT_OP_MONITOR_ENABLE domctl returns several
 + * non-standard error codes to indicate why access could not be enabled:
 + * EBUSY  - guest has or had access enabled, ring buffer still active
 + */
 +#define XEN_DOMCTL_VM_EVENT_OP_MONITOR2
 +
 +#define XEN_DOMCTL_VM_EVENT_OP_MONITOR_ENABLE 0
 +#define XEN_DOMCTL_VM_EVENT_OP_MONITOR_DISABLE1
 +#define XEN_DOMCTL_VM_EVENT_OP_MONITOR_ENABLE_INTROSPECTION   2
 +
 +/*
 + * Sharing ENOMEM helper.
 + *
 + * As with paging, use the domctl for teardown/setup of the
 + * helper-hypervisor interface.
 + *
 + * If setup, this ring is used to communicate failed allocations
 + * in the unshare path. XENMEM_sharing_op_resume is used to wake up
 + * vcpus that could not unshare.
 + *
 + * Note that shring can be turned on (as per the domctl below)
 + * *without* this ring being setup.
 + */
 +#define XEN_DOMCTL_VM_EVENT_OP_SHARING   3
 +
 +#define XEN_DOMCTL_VM_EVENT_OP_SHARING_ENABLE0
 +#define XEN_DOMCTL_VM_EVENT_OP_SHARING_DISABLE   1
 +
 +/* Use for teardown/setup of helper-hypervisor interface for paging,
 + * access and sharing.*/
 +struct xen_domctl_vm_event_op {
 +uint32_t   op;   /* XEN_DOMCTL_VM_EVENT_OP_*_* */
 +uint32_t   mode; /* XEN_DOMCTL_VM_EVENT_OP_* */
 +
 +uint32_t port;  /* OUT: event channel for ring */
 +};
 +typedef struct xen_domctl_vm_event_op xen_domctl_vm_event_op_t;
 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_vm_event_op_t);

 I doubt it is the best approach to do this via add and remove steps,
 rather than just a single renaming step (where likely much on the
 commentary would remain untouched). Or if staying with that model,
 maybe interleaving the additions with the to be replaced code might
 be a workable approach.

 @@ -216,6 +217,8 @@ struct vcpu

  /* VCPU paused for mem_event replies. */
  atomic_t mem_event_pause_count;
 +/* VCPU paused for vm_event replies. */
 +atomic_t vm_event_pause_count;

 Or, to avoid odd changes like this, don't hook up the new source file(s)
 to the make system yet.

 Jan

The last one I think is the most workable, I'll only hook vm_event
into the build system when it is getting used (next patch in the
series). That avoids a bunch of weird additions we see here.


[Xen-devel] [qemu-mainline test] 34188: regressions - FAIL

2015-02-06 Thread xen . org
flight 34188 qemu-mainline real [real]
http://www.chiark.greenend.org.uk/~xensrcts/logs/34188/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-amd64-i386-xl-qemuu-debianhvm-amd64 7 debian-hvm-install fail REGR. vs. 
33480
 test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 7 windows-install fail REGR. vs. 33480
 test-amd64-amd64-xl-win7-amd64  7 windows-install fail REGR. vs. 33480
 test-amd64-i386-xl-win7-amd64  7 windows-install  fail REGR. vs. 33480
 test-amd64-i386-xl-winxpsp3   7 windows-install   fail REGR. vs. 33480
 test-amd64-amd64-xl-winxpsp3  7 windows-install   fail REGR. vs. 33480
 test-amd64-i386-xl-qemuu-winxpsp3  7 windows-install  fail REGR. vs. 33480
 test-amd64-i386-xl-qemuu-ovmf-amd64  7 debian-hvm-install fail REGR. vs. 33480
 test-amd64-i386-xl-winxpsp3-vcpus1  7 windows-install fail REGR. vs. 33480
 test-amd64-amd64-xl-qemuu-ovmf-amd64 7 debian-hvm-install fail REGR. vs. 33480
 test-amd64-i386-qemuu-rhel6hvm-intel  7 redhat-installfail REGR. vs. 33480
 test-amd64-i386-xl-qemuu-win7-amd64  7 windows-installfail REGR. vs. 33480
 test-amd64-i386-freebsd10-amd64  8 guest-startfail REGR. vs. 33480
 test-amd64-amd64-xl-qemuu-debianhvm-amd64 7 debian-hvm-install fail REGR. vs. 
33480
 test-amd64-i386-rhel6hvm-amd  7 redhat-installfail REGR. vs. 33480
 test-amd64-i386-freebsd10-i386  8 guest-start fail REGR. vs. 33480
 test-amd64-i386-qemuu-rhel6hvm-amd  7 redhat-install  fail REGR. vs. 33480
 test-amd64-amd64-xl-qemuu-winxpsp3  7 windows-install fail REGR. vs. 33480
 test-amd64-amd64-xl-qemuu-win7-amd64  7 windows-install   fail REGR. vs. 33480
 test-amd64-i386-rhel6hvm-intel  7 redhat-install  fail REGR. vs. 33480

Regressions which are regarded as allowable (not blocking):
 test-amd64-i386-pair17 guest-migrate/src_host/dst_host fail like 33480

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-xl-pvh-intel  9 guest-start  fail  never pass
 test-armhf-armhf-xl-midway   10 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-sedf 10 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-sedf-pin 10 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  10 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-pvh-amd   9 guest-start  fail   never pass
 test-armhf-armhf-xl  10 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 10 migrate-support-checkfail  never pass
 test-amd64-amd64-libvirt 10 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt 10 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-pcipt-intel  9 guest-start fail never pass
 test-armhf-armhf-xl-credit2   5 xen-boot fail   never pass
 test-amd64-i386-xl-qemut-win7-amd64 14 guest-stop  fail never pass
 test-amd64-i386-xl-qemut-winxpsp3-vcpus1 14 guest-stop fail never pass
 test-amd64-amd64-xl-qemut-winxpsp3 14 guest-stop   fail never pass
 test-amd64-amd64-xl-qemut-win7-amd64 14 guest-stop fail never pass
 test-amd64-i386-xl-qemut-winxpsp3 14 guest-stopfail never pass

version targeted for testing:
 qemuuec6f25e788ef57ce1e9f734984ef8885172fd9e2
baseline version:
 qemuu1e42c353469cb58ca4f3b450eea4211af7d0b147


People who touched revisions under test:
  Alex Suykov alex.suy...@gmail.com
  Alexander Graf ag...@suse.de
  Amit Shah amit.s...@redhat.com
  Andreas Färber afaer...@suse.de
  Aurelien Jarno aurel...@aurel32.net
  Avi Kivity avi.kiv...@gmail.com
  Bastian Koppelmann kbast...@mail.uni-paderborn.de
  Ben Taylor bentaylor.sol...@gmail.com
  Benjamin Herrenschmidt b...@kernel.crashing.org
  Bharata B Rao bhar...@linux.vnet.ibm.com
  Blue Swirl blauwir...@gmail.com
  Christian Borntraeger borntrae...@de.ibm.com
  Christophe Lyon christophe.l...@st.com
  Cornelia Huck cornelia.h...@de.ibm.com
  Dinar Valeev dval...@suse.com
  Don Koch dk...@verizon.com
  Ed Swierk eswi...@skyportsystems.com
  Eduardo Habkost ehabk...@redhat.com
  Eduardo Otubo eduardo.ot...@profitbricks.com
  Fabrice Bellard fabr...@bellard.org
  Fam Zheng f...@redhat.com
  Felix Janda felix.ja...@posteo.de
  Frank Blaschka blasc...@linux.vnet.ibm.com
  Gerd Hoffmann kra...@redhat.com
  Gonglei arei.gong...@huawei.com
  Guan Xuetao g...@mprc.pku.edu.cn
  Igor Mammedov imamm...@redhat.com
  Jan Kiszka jan.kis...@siemens.com
  Jeff Cody jc...@redhat.com
  Jiri Slaby jsl...@suse.cz
  Juan Quintela quint...@redhat.com
  Kevin Wolf kw...@redhat.com
  Marc-André Lureau marcandre.lur...@gmail.com
  Mark Cave-Ayland mark.cave-ayl...@ilande.co.uk
  Markus Armbruster arm...@redhat.com
  Max Filippov jcmvb...@gmail.com
  

Re: [Xen-devel] [PATCH v3 03/13] xen/dt: Extend dt_device_match to possibly store data

2015-02-06 Thread Stefano Stabellini
On Fri, 30 Jan 2015, Julien Grall wrote:
 Some drivers may want to configure differently the device depending on
 the compatible string. For this purpose, add a new field in the
 dt_device_match to store the data.
 
 Also modify the return type of dt_match_node to return the matching
 structure.
 
 Signed-off-by: Julien Grall julien.gr...@linaro.org

Acked-by: Stefano Stabellini stefano.stabell...@eu.citrix.com


 ---
 Changes in v3:
 - Make clear in the commit message that we add a new field...
 ---
  xen/arch/arm/platform.c   |  2 +-
  xen/common/device_tree.c  | 12 ++--
  xen/include/xen/device_tree.h |  6 --
  3 files changed, 11 insertions(+), 9 deletions(-)
 
 diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c
 index cb4cda8..a79a098 100644
 --- a/xen/arch/arm/platform.c
 +++ b/xen/arch/arm/platform.c
 @@ -157,7 +157,7 @@ bool_t platform_device_is_blacklisted(const struct 
 dt_device_node *node)
  if ( platform  platform-blacklist_dev )
  blacklist = platform-blacklist_dev;
  
 -return dt_match_node(blacklist, node);
 +return (dt_match_node(blacklist, node) != NULL);
  }
  
  unsigned int platform_dom0_evtchn_ppi(void)
 diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
 index f72b2e9..34a1b9e 100644
 --- a/xen/common/device_tree.c
 +++ b/xen/common/device_tree.c
 @@ -290,11 +290,12 @@ struct dt_device_node *dt_find_node_by_alias(const char 
 *alias)
  return NULL;
  }
  
 -bool_t dt_match_node(const struct dt_device_match *matches,
 - const struct dt_device_node *node)
 +const struct dt_device_match *
 +dt_match_node(const struct dt_device_match *matches,
 +  const struct dt_device_node *node)
  {
  if ( !matches )
 -return 0;
 +return NULL;
  
  while ( matches-path || matches-type ||
  matches-compatible || matches-not_available )
 @@ -314,12 +315,11 @@ bool_t dt_match_node(const struct dt_device_match 
 *matches,
  match = !dt_device_is_available(node);
  
  if ( match )
 -return match;
 -
 +return matches;
  matches++;
  }
  
 -return 0;
 +return NULL;
  }
  
  const struct dt_device_node *dt_get_parent(const struct dt_device_node *node)
 diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
 index 08db8bc..6502369 100644
 --- a/xen/include/xen/device_tree.h
 +++ b/xen/include/xen/device_tree.h
 @@ -28,6 +28,7 @@ struct dt_device_match {
  const char *type;
  const char *compatible;
  const bool_t not_available;
 +const void *data;
  };
  
  #define DT_MATCH_PATH(p){ .path = p }
 @@ -547,8 +548,9 @@ bool_t dt_device_is_available(const struct dt_device_node 
 *device);
   *
   * Returns true if the device node match one of dt_device_match.
   */
 -bool_t dt_match_node(const struct dt_device_match *matches,
 - const struct dt_device_node *node);
 +const struct dt_device_match *
 +dt_match_node(const struct dt_device_match *matches,
 +  const struct dt_device_node *node);
  
  /**
   * dt_find_matching_node - Find a node based on an dt_device_match match 
 table
 -- 
 2.1.4
 

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


[Xen-devel] [PATCH] libxc: arm: use INVALID_P2M_ENTRY

2015-02-06 Thread Wei Liu
Albeit INVALID_P2M_ENTRY and INVALID_MFN are both ~0UL, conceptually
speaking we should use INVALID_P2M_ENTRY for setting P2M values.

Signed-off-by: Wei Liu wei.l...@citrix.com
Cc: Ian Campbell ian.campb...@citrix.com
Cc: Ian Jackson ian.jack...@eu.citrix.com
Cc: Stefano Stabellini stefano.stabell...@eu.citrix.com
CC: Julien Grall julien.gr...@citrix.com
---
 tools/libxc/xc_dom_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index 9b31b1f..c7feca7 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -453,7 +453,7 @@ int arch_setup_meminit(struct xc_dom_image *dom)
 if ( dom-p2m_host == NULL )
 return -EINVAL;
 for ( pfn = 0; pfn  p2m_size; pfn++ )
-dom-p2m_host[pfn] = INVALID_MFN;
+dom-p2m_host[pfn] = INVALID_P2M_ENTRY;
 
 /* setup initial p2m and allocate guest memory */
 for ( i = 0; dom-rambank_size[i]  i  GUEST_RAM_BANKS; i++ )
-- 
1.9.1


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


Re: [Xen-devel] [PATCH v3 04/13] xen/arm: device: Rename device_type into device_class

2015-02-06 Thread Stefano Stabellini
On Fri, 30 Jan 2015, Julien Grall wrote:
 This enum was used for matching a specific class of device and not to get the
 type of device.
 
 Hence the name device_type will be used for another purpose later.
 
 Also rename device_get_type into device_get_class to reflect the change.
 
 Signed-off-by: Julien Grall julien.gr...@linaro.org

Acked-by: Stefano Stabellini stefano.stabell...@eu.citrix.com


 ---
 Changes in v3:
 - Use device_class rather than device_match
 - Rename device_get_type to device_class
 ---
  xen/arch/arm/device.c|  8 
  xen/arch/arm/domain_build.c  |  2 +-
  xen/include/asm-arm/device.h | 16 
  3 files changed, 13 insertions(+), 13 deletions(-)
 
 diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
 index 59e94c0..1f9dbf7 100644
 --- a/xen/arch/arm/device.c
 +++ b/xen/arch/arm/device.c
 @@ -40,7 +40,7 @@ static bool_t __init device_is_compatible(const struct 
 device_desc *desc,
  return 0;
  }
  
 -int __init device_init(struct dt_device_node *dev, enum device_type type,
 +int __init device_init(struct dt_device_node *dev, enum device_class class,
 const void *data)
  {
  const struct device_desc *desc;
 @@ -52,7 +52,7 @@ int __init device_init(struct dt_device_node *dev, enum 
 device_type type,
  
  for ( desc = _sdevice; desc != _edevice; desc++ )
  {
 -if ( desc-type != type )
 +if ( desc-class != class )
  continue;
  
  if ( device_is_compatible(desc, dev) )
 @@ -67,7 +67,7 @@ int __init device_init(struct dt_device_node *dev, enum 
 device_type type,
  return -EBADF;
  }
  
 -enum device_type device_get_type(const struct dt_device_node *dev)
 +enum device_class device_get_class(const struct dt_device_node *dev)
  {
  const struct device_desc *desc;
  
 @@ -76,7 +76,7 @@ enum device_type device_get_type(const struct 
 dt_device_node *dev)
  for ( desc = _sdevice; desc != _edevice; desc++ )
  {
  if ( device_is_compatible(desc, dev) )
 -return desc-type;
 +return desc-class;
  }
  
  return DEVICE_UNKNOWN;
 diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
 index c2dcb49..7b923e0 100644
 --- a/xen/arch/arm/domain_build.c
 +++ b/xen/arch/arm/domain_build.c
 @@ -1084,7 +1084,7 @@ static int handle_node(struct domain *d, struct 
 kernel_info *kinfo,
  /* Even if the IOMMU device is not used by Xen, it should not be
   * passthrough to DOM0
   */
 -if ( device_get_type(node) == DEVICE_IOMMU )
 +if ( device_get_class(node) == DEVICE_IOMMU )
  {
  DPRINT( IOMMU, skip it\n);
  return 0;
 diff --git a/xen/include/asm-arm/device.h b/xen/include/asm-arm/device.h
 index 74a80c6..b6b32bc 100644
 --- a/xen/include/asm-arm/device.h
 +++ b/xen/include/asm-arm/device.h
 @@ -4,7 +4,7 @@
  #include xen/init.h
  #include xen/device_tree.h
  
 -enum device_type
 +enum device_class
  {
  DEVICE_SERIAL,
  DEVICE_IOMMU,
 @@ -16,8 +16,8 @@ enum device_type
  struct device_desc {
  /* Device name */
  const char *name;
 -/* Device type */
 -enum device_type type;
 +/* Device class */
 +enum device_class class;
  /* Array of device tree 'compatible' strings */
  const char *const *compatible;
  /* Device initialization */
 @@ -27,12 +27,12 @@ struct device_desc {
  /**
   *  device_init - Initialize a device
   *  @dev: device to initialize
 - *  @type: type of the device (serial, network...)
 + *  @class: class of the device (serial, network...)
   *  @data: specific data for initializing the device
   *
   *  Return 0 on success.
   */
 -int __init device_init(struct dt_device_node *dev, enum device_type type,
 +int __init device_init(struct dt_device_node *dev, enum device_class class,
 const void *data);
  
  /**
 @@ -41,13 +41,13 @@ int __init device_init(struct dt_device_node *dev, enum 
 device_type type,
   *
   * Return the device type on success or DEVICE_ANY on failure
   */
 -enum device_type device_get_type(const struct dt_device_node *dev);
 +enum device_class device_get_class(const struct dt_device_node *dev);
  
 -#define DT_DEVICE_START(_name, _namestr, _type) \
 +#define DT_DEVICE_START(_name, _namestr, _class)\
  static const struct device_desc __dev_desc_##_name __used   \
  __attribute__((__section__(.dev.info))) = {   \
  .name = _namestr,   \
 -.type = _type,  \
 +.class = _class,\
  
  #define DT_DEVICE_END   \
  };
 -- 
 2.1.4
 

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


Re: [Xen-devel] [PATCH v3 06/13] xen/arm: Introduce a generic way to describe device

2015-02-06 Thread Stefano Stabellini
On Fri, 30 Jan 2015, Julien Grall wrote:
 Currently, Xen is supporting PCI and Platform device (based on Device Tree).
 
 While Xen only supports Platform device on ARM, Xen will gain support of
 PCI soon.
 
 Some drivers, such as IOMMU drivers, may handle PCI and platform device in
 the same way. Only few lines of code differs.
 
 Rather than requesting to provide 2 set of functions (one for PCI and
 one for platform device), introduce a generic structure device which
 is embedded in each specialized device.
 
 As x86 only supports PCI, introduce a new type device_t which will be an
 alias to pci_dev for this architecture. It will avoid to add a new field
 for this place.
 
 Signed-off-by: Julien Grall julien.gr...@linaro.org
 CC: Jan Beulich jbeul...@suse.com
 CC: Keir Fraser k...@xen.org
 CC: Andrew Cooper andrew.coop...@citrix.com

Acked-by: Stefano Stabellini stefano.stabell...@eu.citrix.com


 ---
 Changes in v3:
 - Drop common/device.c as it wasn't used after v1
 
 Changes in v2:
 - As x86 will only support PCI, only introduce the generic
 device on ARM
 - Introduce a typedef device_t to be used in common code
 - Drop the PCI code for ARM for now. It will be reintroduced
 when PCI support will be added
 - s#asm/device.h#xen/device.h# is not anymore needed
 ---
  xen/common/device_tree.c  |  3 +++
  xen/include/asm-arm/device.h  | 26 ++
  xen/include/asm-x86/device.h  | 25 +
  xen/include/xen/device_tree.h | 13 +
  xen/include/xen/iommu.h   |  1 +
  xen/include/xen/pci.h |  1 +
  6 files changed, 69 insertions(+)
  create mode 100644 xen/include/asm-x86/device.h
 
 diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
 index 34a1b9e..d1c716f 100644
 --- a/xen/common/device_tree.c
 +++ b/xen/common/device_tree.c
 @@ -1454,6 +1454,9 @@ static unsigned long __init unflatten_dt_node(const 
 void *fdt,
  ((char *)pp-value)[sz - 1] = 0;
  dt_dprintk(fixed up name for %s - %s\n, pathp,
 (char *)pp-value);
 +/* Generic device initialization */
 +np-dev.type = DEV_DT;
 +np-dev.of_node = np;
  }
  }
  if ( allnextpp )
 diff --git a/xen/include/asm-arm/device.h b/xen/include/asm-arm/device.h
 index b6b32bc..a3d45dd 100644
 --- a/xen/include/asm-arm/device.h
 +++ b/xen/include/asm-arm/device.h
 @@ -2,8 +2,34 @@
  #define __ASM_ARM_DEVICE_H
  
  #include xen/init.h
 +
 +enum device_type
 +{
 +DEV_DT,
 +};
 +
 +struct dev_archdata {
 +void *iommu;/* IOMMU private data */
 +};
 +
 +/* struct device - The basic device structure */
 +struct device
 +{
 +enum device_type type;
 +#ifdef HAS_DEVICE_TREE
 +struct dt_device_node *of_node; /* Used by drivers imported from Linux */
 +#endif
 +struct dev_archdata archdata;
 +};
 +
 +typedef struct device device_t;
 +
  #include xen/device_tree.h
  
 +/* TODO: Correctly implement dev_is_pci when PCI will be supported on ARM */
 +#define dev_is_pci(dev) ((void)(dev), 0)
 +#define dev_is_dt(dev)  ((dev-type == DEV_DT)
 +
  enum device_class
  {
  DEVICE_SERIAL,
 diff --git a/xen/include/asm-x86/device.h b/xen/include/asm-x86/device.h
 new file mode 100644
 index 000..a016112
 --- /dev/null
 +++ b/xen/include/asm-x86/device.h
 @@ -0,0 +1,25 @@
 +#ifndef __ASM_X86_DEVICE_H
 +#define __ASM_X86_DEVICE_H
 +
 +#include xen/pci.h
 +
 +/*
 + * x86 is only supported PCI. Therefore it's possible to directly use
 + * pci_dev to avoid adding new field.
 + */
 +
 +typedef struct pci_dev device_t;
 +
 +#define dev_is_pci(dev) ((void)(dev), 1)
 +#define pci_to_dev(pci) (pci)
 +
 +#endif /* __ASM_X86_DEVICE_H */
 +
 +/*
 + * Local variables:
 + * mode: C
 + * c-file-style: BSD
 + * c-basic-offset: 4
 + * indent-tabs-mode: nil
 + * End:
 + */
 diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
 index 6502369..c8a0375 100644
 --- a/xen/include/xen/device_tree.h
 +++ b/xen/include/xen/device_tree.h
 @@ -11,7 +11,9 @@
  #define __XEN_DEVICE_TREE_H__
  
  #include asm/byteorder.h
 +#include asm/device.h
  #include public/xen.h
 +#include xen/kernel.h
  #include xen/init.h
  #include xen/string.h
  #include xen/types.h
 @@ -80,8 +82,19 @@ struct dt_device_node {
  /* IOMMU specific fields */
  bool is_protected;
  struct list_head domain_list;
 +
 +struct device dev;
  };
  
 +#define dt_to_dev(dt_node)  ((dt_node)-dev)
 +
 +static inline struct dt_device_node *dev_to_dt(struct device *dev)
 +{
 +ASSERT(dev-type == DEV_DT);
 +
 +return container_of(dev, struct dt_device_node, dev);
 +}
 +
  #define MAX_PHANDLE_ARGS 16
  struct dt_phandle_args {
  struct dt_device_node *np;
 diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
 index 8eb764a..ecb2627 100644
 --- a/xen/include/xen/iommu.h
 +++ b/xen/include/xen/iommu.h
 @@ -25,6 +25,7 @@
  #include xen/pci.h
  

Re: [Xen-devel] [RFC PATCH V3 12/12] xen/vm_event: Check for VM_EVENT_FLAG_DUMMY only in Debug builds

2015-02-06 Thread Tamas K Lengyel
On Wed, Feb 4, 2015 at 10:49 AM, Jan Beulich jbeul...@suse.com wrote:
 On 29.01.15 at 22:46, tamas.leng...@zentific.com wrote:
 The flag is only used for debugging purposes, thus it should be only checked
 for in debug builds of Xen.

 So this should be where the respective conditional I just complained
 about should get added.


 --- a/xen/common/mem_access.c
 +++ b/xen/common/mem_access.c
 @@ -30,6 +30,37 @@
  #include asm/p2m.h
  #include xsm/xsm.h

 +void mem_access_resume(struct domain *d)
 +{

 Why is this being re-added, and how do things build with the other
 (inline) mem_access_resume() added in an earlier patch?

 Jan

Yes, this patch got a bit mixed up with the previous one.

To answer your question nevertheless, mem_access_resume is redefined
to be only doing mem_access related work. Previously it was
responsible to pulling all the responses off the ring, even if these
were not mem_access related. Now the monitor is pulling the responses
off the ring, and issues mem_access_resume if the response is to a
mem_access request.

Tamas

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


Re: [Xen-devel] Xen Development for Dummies.

2015-02-06 Thread Pasi Kärkkäinen
On Fri, Feb 06, 2015 at 01:35:58PM +, Jason Long wrote:
 In your opinion, Can a normal user like me become a developer? 
 I must first start learning C or Ocaml? Can you recommend a book for both to 
 me? 
 Can you tell me why developers choose Ocaml and C? and not C++ or Python?


Xen hypervisor, like any other hypervisor, is a very low level piece of 
software.
Lowlevel software tends to be written in lowlevel languages, such as C and 
assembler.

Like said most of Xen is written in C, so you need to learn/know C.

You should first start with learning programming with C language, and the 
generic concepts of computer hardware,
operating systems, kernels, memory management, etc.

Something like a hypervisor, or an operating system kernel, is a quite complex 
beast,
so you should probably first start with something much easier and learn C 
properly in an easier project.
When you know C and Linux/Unix internals well you can continue working on Xen 
aswell.


-- Pasi
 
 Cheers.
 
 
 
 On Friday, February 6, 2015 2:46 AM, Pasi Kärkkäinen pa...@iki.fi wrote:
 On Fri, Feb 06, 2015 at 10:31:09AM +, Jason Long wrote:
  Can you tell me why Ocaml used? What is the features of this language? Why 
  not other?
  Excuse me, I'm a beginner in programming and can you show me some books or 
  reference step by step? I'm a dummies :(
 
 
 There are two different versions of xenstore-daemon (xenstored). 
 The earlier one, written in C, and the newer one, written in OCaml 
 (oxenstored).
 
 Note that this is just one of the many components in Xen. Most Xen components 
 are written in C.
 
 Here you have some slides about oxenstored:
 http://gazagnaire.org/pub/GH09.pdf
 
 
 -- Pasi
 
 
  Cheers.
  
  
  
  On Thursday, February 5, 2015 11:59 PM, Pasi Kärkkäinen pa...@iki.fi 
  wrote:
  On Fri, Feb 06, 2015 at 06:46:23AM +, Jason Long wrote:
   Hello Folks.
   I want to become a Xen developer and I don't have any knowledge about 
   development. Can you tell me what programming language is needed? How can 
   I start and etc?
  
  
  Hello,
  
  Xen is mostly written in C language, but there are other languages being 
  used aswell.. obviously lowlevel assembly language for some architecture 
  specific lowlevel stuff, and some highler level languages (OCaml) for 
  certain components (oxenstored). Also various scripting languages are used, 
  perl, python, etc. 
  
  Also you need to know all the usual Linux/Unix commandline (development) 
  tools.
  
  -- Pasi
  
  
   
   Tnx.
   
   ___
   Xen-devel mailing list
   Xen-devel@lists.xen.org
   http://lists.xen.org/xen-devel

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


Re: [Xen-devel] [PATCH] x86/hvm: wait for at least one ioreq server to be enabled

2015-02-06 Thread Paul Durrant
 -Original Message-
 From: Jan Beulich [mailto:jbeul...@suse.com]
 Sent: 06 February 2015 14:45
 To: Paul Durrant
 Cc: Andrew Cooper; Ian Campbell; Wei Liu; xen-devel@lists.xen.org; Keir
 (Xen.org)
 Subject: Re: [PATCH] x86/hvm: wait for at least one ioreq server to be
 enabled
 
  On 06.02.15 at 13:27, paul.durr...@citrix.com wrote:
  In the case where a stub domain is providing emulation for an HVM
  guest, there is no interlock in the toolstack to make sure that
  the stub domain is up and running before the guest is unpaused.
 
  Prior to the introduction of ioreq servers this was not a problem,
  since there was only ever one emulator so ioreqs were simply
  created anyway and the vcpu remained blocked until the stub domain
  started and picked up the ioreq.
 
  Since ioreq servers allow for multiple emulators for a single guest
  it's not possible to know a priori which emulator will handle a
  particular ioreq, so emulators must attach to a guest before the
  guest runs.
 
  This patch works around the lack of interlock in the toolstack for
  stub domains by keeping the domain paused until at least one ioreq
  server is created and enabled, which in practice means the stub
  domain is indeed up and running.
 
 Do I understand correctly that this only deals correctly with the
 single server case, and the multi server case becoming functional
 depends on the tool stack change to be done?
 

Yes, and that was deemed too invasive for backport to stable; plus xl/libxl 
have not yet been taught about multiple emulators.

  --- a/xen/arch/x86/hvm/hvm.c
  +++ b/xen/arch/x86/hvm/hvm.c
  @@ -885,6 +885,12 @@ static void hvm_ioreq_server_enable(struct
 hvm_ioreq_server *s,
 
 done:
   spin_unlock(s-lock);
  +
  +if ( d-arch.hvm_domain.ioreq_server.waiting )
  +{
  +d-arch.hvm_domain.ioreq_server.waiting = 0;
  +domain_unpause(d);
  +}
   }
 
 So it takes looking up all callers to understand that this doesn't need
 to be atomic. This would have been avoided by mentioning this in
 the description or in a comment.

Ok, I'll stick a comment in.

 
  @@ -1435,6 +1441,19 @@ int hvm_domain_initialise(struct domain *d)
 
   spin_lock_init(d-arch.hvm_domain.ioreq_server.lock);
   INIT_LIST_HEAD(d-arch.hvm_domain.ioreq_server.list);
  +
  +/*
  + * In the case where a stub domain is providing emulation for
  + * the guest, there is no interlock in the toolstack to prevent
  + * the guest from running before the stub domain is ready.
  + * Hence the domain must remain paused until at least one ioreq
  + * server is created and enabled.
  + */
  +if ( !is_pvh_domain(d) ) {
 
 Coding style.
 

Ok.

  --- a/xen/include/asm-x86/hvm/domain.h
  +++ b/xen/include/asm-x86/hvm/domain.h
  @@ -84,6 +84,7 @@ struct hvm_domain {
   spinlock_t   lock;
   ioservid_t   id;
   struct list_head list;
  +bool_t   waiting;
 
 At least non normal non-debug builds you've got a slot of 32 bits
 between id and list - please fill such gaps when adding new
 members rather than adding further slack space.

True, I'll re-order.

   Paul

 
 Jan


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


Re: [Xen-devel] [RFC 7/7] libxl: Wait for QEMU startup in stubdomain

2015-02-06 Thread Wei Liu
On Fri, Feb 06, 2015 at 08:56:40AM -0500, Eric Shelton wrote:
 On Fri, Feb 6, 2015 at 6:16 AM, Wei Liu wei.l...@citrix.com wrote:
  Thanks for posting.
 
  ...
 
  FWIW  we are now experiencing problem with this startup protocol (not
  Linux stubdom specific) -- that path that libxl waiting for is wrong.
 
 I simply used the code already present in the QEMU upstream code,
 which is writing to that particular ath to indicate running.  Since
 it is distinct from the path used by the QEMU instance running in
 Dom0, it works for my intended purpose: ensuring the device model is
 running before unpausing the HVM guest.  When you say it is wrong,
 is that just because you ultimately intend to rearchitect this and use
 something different?  If so, maybe the path I am using is good
 enough until that happens.  Otherwise, can you suggest a better path
 or mechanism?
 

It is not good enough. It just happens to be working.

Currently the path is hardcoded /local/domain/0/BLAH. It's wrong,
because the QEMU in stubdom is not running in 0. The correct prefix
should be /local/domain/$stubdom_id.

Consider there is another QEMU process that runs in Dom0 that provides
some kind of backend directly to the guest, it will also write to the
same /local/domain/0/BLAH address. This gives us a situation that both
QEMU in stubdom and QEMU in Dom0 write to the same xenstore path, which
is of course wrong.

We would still rely on xenstore as basic mechanism to present device
model state, but the protocol as-is is broken.  Since this is broken
anyway we might as well consider redesigning that protocol to make it
work both properly and future proof.

  Unfortunately this problem can't be solved without putting in
  significant effort and time (involves redesign of protocol and handle
  all the compatibility issues). We can't say for sure when the solution
  is going to land.
 
 I noticed some discussion about this on xen-devel.  Unfortunately, I
 was unable to find anything that laid out specifically what the
 problems are - can you point me to a bug report or such?  The libxl
 startup code - with callbacks on top of callbacks, callbacks within
 callbacks, and callbacks stashed away in little places only to be
 called _much_ later - is really convoluted, I suspect particularly so
 for stubdom startup.  I am not surprised it got broken - who can
 remember how it works?
 

It's not how libxl is coded. It's the startup protocol that is broken.
The breakage of stubdom in Xen 4.5 is a latent bug exposed by a new
feature. 

I guess I should just send a bug report saying Device model startup
protocol is broken. But I don't have much to say at this point, because
thorough research for both qemu-trad and qemu-upstream is required to
produce a sensible report.

 While working on these patches reviving Anthony's work, I consistently
 ran into HVM starup problems with QEMU upstream in a stub domain (it
 always failed).  What I could not figure out is why QEMU-traditional
 did not have a similar problem; it seemed to me that the same race
 existed for QEMU-traditional stubdom.  I wrote it off as either (1)
 MiniOS startup was so much faster than Linux that QEMU-traditional
 always won the race, or (2) there was some implicit mechanism in

My bet is on 1).

 QEMU-traditional that ensured the HVM guest would wait for the device
 model to be in place.  It sounds like maybe the race ctually is being

QEMU-trad stubdom is suffering from the same problem.

 lost in 4.5.
 

So prior to 4.5, when there is emulation request issued by a guest vcpu,
that request is put on a ring, guest vcpu is paused. When a DM shows up
it processes that request, posts response, then guest vcpu is unpaused.
So there is implicit dependency on Xen's behaviour for DM to work.

In 4.5, a new feature called ioreq server is added. When Xen sees an
io request which no backing DM, it returns immediately. Guest sees some
wired value and crashes. That is, Xen's behaviour has changed and a
latent bug in stubdom's startup protocol is exposed.

 If the problem you are contending with is that the HVM guest is being
 unpaused before the device model is in place, I suggest that this
 patch, or someting much like it, should address it.  I note that I
 merely verified it did not break QEMU-traditional stubdom, but it is
 just a matter of ensuring QEMU-traditional writes to _some_ xenstore
 path when it is ready (it might do this already, in fact), and that
 this patch waits on that path.  Also, it should be pretty easy to
 extend this concept to ensure any additional stubdoms, such as vTPM,
 are up and running before leaving the code im libxl_dm.c and unpausing
 the HVM domain - we just chain through additional callbacks as needed.
 

Yes, that's the basic idea, chaining things together.

 There may be a desire to do a major rework of libxl_dm.c, etc., but
 this patch might be a reasonable bandaid now for Xen 4.5.1.
 
  Also upstream QEMU stubdom, as you already notice, doesn't have a
  

[Xen-devel] [xen-4.3-testing test] 34190: tolerable FAIL - PUSHED

2015-02-06 Thread xen . org
flight 34190 xen-4.3-testing real [real]
http://www.chiark.greenend.org.uk/~xensrcts/logs/34190/

Failures :-/ but no regressions.

Regressions which are regarded as allowable (not blocking):
 test-amd64-amd64-xl-qemut-winxpsp3  7 windows-install  fail like 33687

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-i386-xl-qemuu-ovmf-amd64  7 debian-hvm-install  fail never pass
 test-amd64-i386-libvirt  10 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64  7 debian-hvm-install fail never pass
 test-amd64-amd64-libvirt 10 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-pcipt-intel  9 guest-start fail never pass
 build-amd64-rumpuserxen   6 xen-buildfail   never pass
 test-armhf-armhf-xl-credit2   5 xen-boot fail   never pass
 test-armhf-armhf-xl-sedf  5 xen-boot fail   never pass
 test-armhf-armhf-libvirt  5 xen-boot fail   never pass
 test-armhf-armhf-xl   5 xen-boot fail   never pass
 test-armhf-armhf-xl-sedf-pin  5 xen-boot fail   never pass
 test-armhf-armhf-xl-multivcpu  5 xen-boot fail  never pass
 test-armhf-armhf-xl-midway5 xen-boot fail   never pass
 build-i386-rumpuserxen6 xen-buildfail   never pass
 test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 14 guest-stop fail never pass
 test-amd64-amd64-xl-qemuu-winxpsp3 14 guest-stop   fail never pass
 test-amd64-i386-xl-winxpsp3-vcpus1 14 guest-stop   fail never pass
 test-amd64-i386-xend-qemut-winxpsp3 17 leak-check/checkfail never pass
 test-amd64-i386-xl-qemut-win7-amd64 14 guest-stop  fail never pass
 test-amd64-i386-xl-qemuu-win7-amd64 14 guest-stop  fail never pass
 test-amd64-amd64-xl-winxpsp3 14 guest-stop   fail   never pass
 test-amd64-amd64-xl-qemuu-win7-amd64 14 guest-stop fail never pass
 test-amd64-amd64-xl-qemut-win7-amd64 14 guest-stop fail never pass
 test-amd64-amd64-xl-win7-amd64 14 guest-stop   fail never pass
 test-amd64-i386-xl-qemut-winxpsp3-vcpus1 14 guest-stop fail never pass
 test-amd64-i386-xend-winxpsp3 17 leak-check/check fail  never pass
 test-amd64-i386-xl-win7-amd64 14 guest-stop   fail  never pass

version targeted for testing:
 xen  ef73de2a84a3042c3481c9a521e8e0c756b793f2
baseline version:
 xen  f70c066bb55ed967a8e98bf30a50cf0a7a6155f9


People who touched revisions under test:
  Andrew Cooper andrew.coop...@citrix.com
  Boris Ostrovsky boris.ostrov...@oracle.com
  Dan Carpenter dan.carpen...@oracle.com
  Daniel De Graaf dgde...@tycho.nsa.gov
  Ian Campbell ian.campb...@citrix.com
  Jan Beulich jbeul...@suse.com
  Kevin Tian kevin.t...@intel.com
  Konrad Rzeszutek Wilk konrad.w...@oracle.com
  Tim Deegan t...@xen.org


jobs:
 build-amd64  pass
 build-armhf  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-armhf-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-armhf-pvopspass
 build-i386-pvops pass
 build-amd64-rumpuserxen  fail
 build-i386-rumpuserxen   fail
 test-amd64-amd64-xl  pass
 test-armhf-armhf-xl  fail
 test-amd64-i386-xl   pass
 test-amd64-i386-rhel6hvm-amd pass
 test-amd64-i386-qemut-rhel6hvm-amd   pass
 test-amd64-i386-qemuu-rhel6hvm-amd   pass
 test-amd64-amd64-xl-qemut-debianhvm-amd64pass
 test-amd64-i386-xl-qemut-debianhvm-amd64 pass
 test-amd64-amd64-xl-qemuu-debianhvm-amd64pass
 test-amd64-i386-xl-qemuu-debianhvm-amd64 pass
 test-amd64-i386-freebsd10-amd64  pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 fail
 

Re: [Xen-devel] [PATCH] tools: work around collision of -O0 and -D_FORTIFY_SOURCE [and 1 more messages]

2015-02-06 Thread Don Slutz
On 02/06/15 06:04, Ian Jackson wrote:
 Jan Beulich writes (Re: [PATCH] tools: work around collision of -O0 and 
 -D_FORTIFY_SOURCE):
 Attached the patch I used for testing. While it works okay for me,
 I guess the configure part will need further taking care of the
 -Wp,-D... variant Don is seeing.
 
 Thanks.  I'm going to pretend my first one was v2, you called your
 version v3 and will send out a v4 in just a moment.
 
 Don, can you please test it ?
 

Will test it soon.
   -Don Slutz

 Thanks,
 Ian.
 

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


Re: [Xen-devel] [RESEND Patch V2 1/4] xen: build infrastructure for generating hypercall depending symbols

2015-02-06 Thread Juergen Gross

Hey, x86 maintainers!

could you please comment?


Juergen

On 01/28/2015 06:11 AM, Juergen Gross wrote:

*Ping*

David wants a comment from the x86 maintainers.


Juergen

On 01/21/2015 08:49 AM, Juergen Gross wrote:

Today there are several places in the kernel which build tables
containing one entry for each possible Xen hypercall. Create an
infrastructure to be able to generate these tables at build time.

Based-on-patch-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Juergen Gross jgr...@suse.com
Reviewed-by: David Vrabel david.vra...@citrix.com
---
  arch/x86/syscalls/Makefile |  9 +
  scripts/xen-hypercalls.sh  | 12 
  2 files changed, 21 insertions(+)
  create mode 100644 scripts/xen-hypercalls.sh

diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile
index 3323c27..a55abb9 100644
--- a/arch/x86/syscalls/Makefile
+++ b/arch/x86/syscalls/Makefile
@@ -19,6 +19,9 @@ quiet_cmd_syshdr = SYSHDR  $@
  quiet_cmd_systbl = SYSTBL  $@
cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $ $@

+quiet_cmd_hypercalls = HYPERCALLS $@
+  cmd_hypercalls = $(CONFIG_SHELL) '$' $@ $(filter-out $,$^)
+
  syshdr_abi_unistd_32 := i386
  $(uapi)/unistd_32.h: $(syscall32) $(syshdr)
  $(call if_changed,syshdr)
@@ -47,10 +50,16 @@ $(out)/syscalls_32.h: $(syscall32) $(systbl)
  $(out)/syscalls_64.h: $(syscall64) $(systbl)
  $(call if_changed,systbl)

+$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh
+$(call if_changed,hypercalls)
+
+$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
+
  uapisyshdr-y+= unistd_32.h unistd_64.h unistd_x32.h
  syshdr-y+= syscalls_32.h
  syshdr-$(CONFIG_X86_64)+= unistd_32_ia32.h unistd_64_x32.h
  syshdr-$(CONFIG_X86_64)+= syscalls_64.h
+syshdr-$(CONFIG_XEN)+= xen-hypercalls.h

  targets+= $(uapisyshdr-y) $(syshdr-y)

diff --git a/scripts/xen-hypercalls.sh b/scripts/xen-hypercalls.sh
new file mode 100644
index 000..676d922
--- /dev/null
+++ b/scripts/xen-hypercalls.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+out=$1
+shift
+in=$@
+
+for i in $in; do
+eval $CPP $LINUXINCLUDE -dD -imacros $i -x c /dev/null
+done | \
+awk '$1 == #define  $2 ~ /__HYPERVISOR_[a-z][a-z_0-9]*/ { v[$3] =
$2 }
+END {   print /* auto-generated by scripts/xen-hypercall.sh */
+for (i in v) if (!(v[i] in v))
+print HYPERCALL(substr(v[i], 14))}' | sort -u $out



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/





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


  1   2   >