Re: [Xen-devel] [PATCH] x86/apicv: enhance posted-interrupt processing
On February 23, 2017 8:27 PM, Jan Beulich wrote: On 23.02.17 at 12:55, wrote: >> On February 23, 2017 7:01 PM, Jan Beulich wrote: >> On 23.02.17 at 11:53, wrote: IOW, which vcpu does the 'current' refer to? which cpu does the ' smp_processor_id()' refer to? >>> >>>current: currently running vCPU >> >> in a SMP machine, are there more than one currently running vCPU? > >Of course. "current" obviously is the one running on the CPU we're on. > Jan, Another question, it 'd be the _main_gap_.. If the pCPU runs __vmx_deliver_posted_interrupt() here, in a hyperver-context, _iiuc_, all of vCPUs , waiting in the run queue, are scheduled out.. So the 'current' is NULL, as there is no running vCPU.. correct me!! Quan >> I think so, the condition "if ( running && (in_irq() || (v != >> current)) )", in >> __vmx_deliver_posted_interrupt() looks strange -- when vCPU is >> running, why to check ' v != current '.. >> >> >>>smp_processor_id(): processor ID of the CPU we're running on >>> >> I think if vcpu is running, ' cpu != smp_processor_id() ' should be true. >> >> >> I think we could simplify __vmx_deliver_posted_interrupt(): >> >>1. set VCPU_KICK_SOFTIRQ bit of v->processor. >>2. IF vcpu is running: >> - send_IPI >> ELSE >> - vcpu_kick > >If this can be done in a race free manner (after all, the running state of a >vCPU >running on another pCPU may change at any >time) ... > >Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [xen-4.7-testing test] 106028: regressions - trouble: blocked/broken/fail/pass
flight 106028 xen-4.7-testing real [real] http://logs.test-lab.xenproject.org/osstest/logs/106028/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-amd64-xl-credit2 17 guest-localmigrate/x10 fail REGR. vs. 105855 Tests which are failing intermittently (not blocking): test-amd64-amd64-libvirt-pair 3 host-install/src_host(3) broken in 105998 pass in 106028 test-amd64-i386-xl 3 host-install(3) broken in 105998 pass in 106028 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 3 host-install(3) broken in 105998 pass in 106028 test-amd64-i386-xl-qemut-stubdom-debianhvm-amd64-xsm 3 host-install(3) broken in 105998 pass in 106028 test-amd64-i386-migrupgrade 3 host-install/src_host(3) broken in 105998 pass in 106028 test-amd64-amd64-xl-multivcpu 3 host-install(3) broken in 105998 pass in 106028 test-amd64-i386-libvirt 3 host-install(3) broken pass in 105998 test-amd64-i386-xl-qemut-debianhvm-amd64 3 host-install(3) broken pass in 105998 test-amd64-amd64-xl-qemuu-winxpsp3 3 host-install(3)broken pass in 105998 test-amd64-i386-xl-qemuu-debianhvm-amd64-xsm 6 xen-boot fail in 105998 pass in 106028 test-amd64-amd64-xl-rtds 6 xen-boot fail in 105998 pass in 106028 test-armhf-armhf-xl-arndale 6 xen-boot fail in 105998 pass in 106028 test-amd64-i386-xl-xsm6 xen-boot fail pass in 105998 test-amd64-i386-xl-qemut-debianhvm-amd64-xsm 15 guest-localmigrate/x10 fail pass in 105998 Regressions which are regarded as allowable (not blocking): test-amd64-i386-xl-qemut-stubdom-debianhvm-amd64-xsm 15 guest-localmigrate/x10 fail like 105833 test-armhf-armhf-libvirt 13 saverestore-support-checkfail like 105855 test-armhf-armhf-libvirt-xsm 13 saverestore-support-checkfail like 105855 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail like 105855 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stopfail like 105855 test-amd64-i386-xl-qemut-win7-amd64 16 guest-stop fail like 105855 test-armhf-armhf-libvirt-raw 12 saverestore-support-checkfail like 105855 test-amd64-amd64-xl-rtds 9 debian-install fail like 105855 Tests which did not succeed, but are not blocking: test-arm64-arm64-libvirt-xsm 1 build-check(1) blocked n/a test-arm64-arm64-xl 1 build-check(1) blocked n/a build-arm64-libvirt 1 build-check(1) blocked n/a test-arm64-arm64-libvirt-qcow2 1 build-check(1) blocked n/a test-arm64-arm64-libvirt 1 build-check(1) blocked n/a test-arm64-arm64-xl-credit2 1 build-check(1) blocked n/a test-arm64-arm64-xl-rtds 1 build-check(1) blocked n/a test-arm64-arm64-xl-multivcpu 1 build-check(1) blocked n/a test-arm64-arm64-xl-xsm 1 build-check(1) blocked n/a test-amd64-i386-libvirt 12 migrate-support-check fail in 105998 never pass build-arm64 5 xen-buildfail never pass test-amd64-amd64-xl-pvh-intel 11 guest-start fail never pass test-amd64-amd64-xl-pvh-amd 11 guest-start fail never pass test-amd64-amd64-libvirt 12 migrate-support-checkfail never pass test-amd64-i386-libvirt-xsm 12 migrate-support-checkfail never pass test-amd64-amd64-libvirt-xsm 12 migrate-support-checkfail never pass build-arm64-xsm 5 xen-buildfail never pass test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check fail never pass test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check fail never pass build-arm64-pvops 5 kernel-build fail never pass test-amd64-amd64-libvirt-vhd 11 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 12 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 13 saverestore-support-checkfail never pass test-amd64-amd64-qemuu-nested-amd 16 debian-hvm-install/l1/l2 fail never pass test-armhf-armhf-xl-multivcpu 12 migrate-support-checkfail never pass test-armhf-armhf-xl-multivcpu 13 saverestore-support-checkfail never pass test-armhf-armhf-xl 12 migrate-support-checkfail never pass test-armhf-armhf-xl-credit2 12 migrate-support-checkfail never pass test-armhf-armhf-xl 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-xsm 12 migrate-support-checkfail never pass test-armhf-armhf-xl-xsm 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit2 13 saverestore-support-checkfail never pass test-armhf-armhf-libvirt 12 migrate-support-checkfail never pass test-armhf-armhf-xl-cubietruck 12 migrate-support-c
Re: [Xen-devel] [PATCH] x86/apicv: enhance posted-interrupt processing
>>> On 24.02.17 at 09:02, wrote: > Another question, it 'd be the _main_gap_.. > If the pCPU runs __vmx_deliver_posted_interrupt() here, in a > hyperver-context, > _iiuc_, all of vCPUs , waiting in the run queue, are scheduled out.. So the > 'current' is NULL, as there is no running vCPU.. Excuse me, but these are fundamentals. "current" can never be NULL. If no guest vCPU is running, the idle vCPU for the pCPU would be. And switching to hypervisor context _does not_ mean the current vCPU changes. In particular, vlapic_set_irq() (which is a few call stack layers up from __vmx_deliver_posted_interrupt()) can run in various contexts afaics. Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [ovmf test] 106029: trouble: broken/pass
flight 106029 ovmf real [real] http://logs.test-lab.xenproject.org/osstest/logs/106029/ Failures and problems with tests :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-i386-xl-qemuu-ovmf-amd64 3 host-install(3) broken REGR. vs. 105963 version targeted for testing: ovmf fc7bd8939d56da5da24ec8ddc9976245ffc42b69 baseline version: ovmf e0307a7dad02aa8c0cd8b3b0b9edce8ddb3fef2e Last test of basis 105963 2017-02-21 21:43:31 Z2 days Failing since105980 2017-02-22 10:03:53 Z1 days3 attempts Testing same since 106029 2017-02-23 18:31:38 Z0 days1 attempts People who touched revisions under test: Anthony PERARD Ard Biesheuvel Jeff Fan Jiewen Yao Laszlo Ersek Paolo Bonzini Star Zeng Yonghong Zhu Zhang Lubo jobs: build-amd64-xsm pass build-i386-xsm pass build-amd64 pass build-i386 pass build-amd64-libvirt pass build-i386-libvirt pass build-amd64-pvopspass build-i386-pvops pass test-amd64-amd64-xl-qemuu-ovmf-amd64 pass test-amd64-i386-xl-qemuu-ovmf-amd64 broken sg-report-flight on osstest.test-lab.xenproject.org logs: /home/logs/logs images: /home/logs/images Logs, config files, etc. are available at http://logs.test-lab.xenproject.org/osstest/logs Explanation of these reports, and of osstest in general, is at http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master Test harness code can be found at http://xenbits.xen.org/gitweb?p=osstest.git;a=summary broken-step test-amd64-i386-xl-qemuu-ovmf-amd64 host-install(3) Not pushing. (No revision log; it would be 744 lines long.) ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v2] iommu: Elaborate the usage of RMRR specification on the command line
>>> On 23.02.17 at 18:03, wrote: > As some users have suggested, elaborate the usage of RMRR specification > on the command line, and provide a usage example. > > Also, always treat the specified page numbers as hexadecimal values. > > Signed-off-by: Venu Busireddy Reviewed-by: Jan Beulich > --- > > Changes in v2: >- Provide a better usage example. >- Treat input page numbers as hexadecimal values. For this second aspect you should have Cc-ed the VT-d maintainer (now added to Cc). Jan > docs/misc/xen-command-line.markdown | 10 ++ > xen/drivers/passthrough/vtd/dmar.c | 4 ++-- > 2 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/docs/misc/xen-command-line.markdown > b/docs/misc/xen-command-line.markdown > index 3acbb33..a035c3f 100644 > --- a/docs/misc/xen-command-line.markdown > +++ b/docs/misc/xen-command-line.markdown > @@ -1406,6 +1406,16 @@ If segment of the first device is not specified, > segment zero will be used. > If other segments are not specified, first device segment will be used. > If a segment is specified for other than the first device and it does not > match > the one specified for the first one, an error will be reported. > + > +'start' and 'end' values are page numbers (not full physical addresses), > +in hexadecimal format (can optionally be preceded by "0x"). > + > +Usage example: If device 0:0:1d.0 requires one page (0xd5d45) to be > +reserved, and device 0:0:1a.0 requires three pages (0xd5d46 thru 0xd5d48) > +to be reserved, one usage would be: > + > +rmrr=d5d45=0:0:1d.0;0xd5d46-0xd5d48=0:0:1a.0 > + > Note: grub2 requires to escape or use quotations if special characters are > used, > namely ';', refer to the grub2 documentation if multiple ranges are > specified. > > diff --git a/xen/drivers/passthrough/vtd/dmar.c > b/xen/drivers/passthrough/vtd/dmar.c > index 9484f3b..436a533 100644 > --- a/xen/drivers/passthrough/vtd/dmar.c > +++ b/xen/drivers/passthrough/vtd/dmar.c > @@ -1097,13 +1097,13 @@ static void __init parse_rmrr_param(const char *str) > unsigned long start, end; > > do { > -start = simple_strtoul(cur = s, &s, 0); > +start = simple_strtoul(cur = s, &s, 16); > if ( cur == s ) > break; > > if ( *s == '-' ) > { > -end = simple_strtoul(cur = s + 1, &s, 0); > +end = simple_strtoul(cur = s + 1, &s, 16); > if ( cur == s ) > break; > } ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] XEN_DOMCTL_getvcpuextstate libxc wrapper?
Hello, Having a XEN_DOMCTL_getvcpuextstate libxc wrapper would help introspection get the state of SSE registers, and it looks trivial to do at a glance. Are there specific reasons why it hasn't been exposed already, or is it fine to try to submit a patch? Thanks, Razvan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] XEN_DOMCTL_getvcpuextstate libxc wrapper?
On 24/02/2017 09:44, Razvan Cojocaru wrote: > Hello, > > Having a XEN_DOMCTL_getvcpuextstate libxc wrapper would help > introspection get the state of SSE registers, and it looks trivial to do > at a glance. > > Are there specific reasons why it hasn't been exposed already, or is it > fine to try to submit a patch? Probably because no-one has found a usecase for it until now. I suspect that the migration logic is the only current use of these hypercalls at the moment. ~Andrew ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v4 3/6] xenstore: enhance control command support
On Fri, Feb 24, 2017 at 07:21:42AM +0100, Juergen Gross wrote: > The Xenstore protocol supports the XS_CONTROL command for triggering > various actions in the Xenstore daemon. Enhance that support by using > a command table and adding a help function. > > Support multiple control commands in the associated xenstore-control > program used to issue XS_CONTROL commands. > > Signed-off-by: Juergen Gross Reviewed-by: Wei Liu ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [linux-linus test] 104684: regressions - FAIL
Hi, On 02/22/2017 02:11 PM, Julien Grall wrote: On 22/02/17 13:19, Ian Jackson wrote: Julien Grall writes ("Re: [Xen-devel] [linux-linus test] 104684: regressions - FAIL"): On 14/02/17 17:42, Wei Liu wrote: (test-lab)liuw@osstest:~/testing.git$ ./mg-hosts showprops | grep DTUART | grep arndale arndale-bluewater XenDTUARTPath /serial@12C2 arndale-lakeside XenDTUARTPath /serial@12C2 arndale-metrocentre XenDTUARTPath /serial@12C2 arndale-westfield XenDTUARTPath /serial@12C2 That's a property of this kind of hosts in osstest. It needs to be updated by the administrator (Ian). Ian, could you change the XenDTUARTPath property for the arndale from "/serial@12C2" to "serial0"? Done. This should hopefully fix boot of Linux upstream on the board and keep compatibility with the previous version of Linux. Let's hope it doesn't break anything :-). Thank you! I will watch next flights on osstest. Sounds like this trick didn't work ([1]) and we also lost xen log for the other the flights (see xen-unstable-smoke [2]) thought they are still passing. Looking at the device-tree again, I thought the serial aliases were existing in 3.16.7-ctk one but it seems that I looked at the wrong DT. Sorry for that. This means that the path to the serial is different between 3.16 and 4.10 and we have no common one. For now, I would revert it. A per-flight override sounds quite ugly, so I am not sure how to solve this in the future. Any opinions? Regardless that I gave the wrong alias on the previous e-mail for 4.10. Below the list of serial alias: serial0 = "/soc/serial@12C0"; serial1 = "/soc/serial@12C1"; serial2 = "/soc/serial@12C2"; serial3 = "/soc/serial@12C3"; So for the alias should be serial2. Cheers, [1] http://logs.test-lab.xenproject.org/osstest/logs/106009/test-armhf- armhf-xl/info.html [2] http://logs.test-lab.xenproject.org/osstest/logs/106021/test-armhf-armhf-xl/info.html -- Julien Grall ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [xen-unstable-smoke test] 106060: tolerable trouble: broken/fail/pass - PUSHED
flight 106060 xen-unstable-smoke real [real] http://logs.test-lab.xenproject.org/osstest/logs/106060/ Failures :-/ but no regressions. Tests which did not succeed, but are not blocking: test-arm64-arm64-xl-xsm 1 build-check(1) blocked n/a build-arm64 5 xen-buildfail never pass build-arm64-pvops 5 kernel-build fail never pass test-armhf-armhf-xl 12 migrate-support-checkfail never pass test-armhf-armhf-xl 13 saverestore-support-checkfail never pass test-amd64-amd64-libvirt 12 migrate-support-checkfail never pass version targeted for testing: xen cf5e1a74b9687be3d146e59ab10c26be6da9d0d4 baseline version: xen 5258ab0fcc67587d802e33bcc5bf89048d184a73 Last test of basis 106032 2017-02-23 19:04:32 Z0 days Testing same since 106060 2017-02-24 09:04:58 Z0 days1 attempts People who touched revisions under test: Julien Grall jobs: build-amd64 pass build-arm64 fail build-armhf pass build-amd64-libvirt pass build-arm64-pvopsfail test-armhf-armhf-xl pass test-arm64-arm64-xl-xsm broken test-amd64-amd64-xl-qemuu-debianhvm-i386 pass test-amd64-amd64-libvirt pass sg-report-flight on osstest.test-lab.xenproject.org logs: /home/logs/logs images: /home/logs/images Logs, config files, etc. are available at http://logs.test-lab.xenproject.org/osstest/logs Explanation of these reports, and of osstest in general, is at http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master Test harness code can be found at http://xenbits.xen.org/gitweb?p=osstest.git;a=summary Pushing revision : + branch=xen-unstable-smoke + revision=cf5e1a74b9687be3d146e59ab10c26be6da9d0d4 + . ./cri-lock-repos ++ . ./cri-common +++ . ./cri-getconfig +++ umask 002 +++ getrepos getconfig Repos perl -e ' use Osstest; readglobalconfig(); print $c{"Repos"} or die $!; ' +++ local repos=/home/osstest/repos +++ '[' -z /home/osstest/repos ']' +++ '[' '!' -d /home/osstest/repos ']' +++ echo /home/osstest/repos ++ repos=/home/osstest/repos ++ repos_lock=/home/osstest/repos/lock ++ '[' x '!=' x/home/osstest/repos/lock ']' ++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock ++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push xen-unstable-smoke cf5e1a74b9687be3d146e59ab10c26be6da9d0d4 + branch=xen-unstable-smoke + revision=cf5e1a74b9687be3d146e59ab10c26be6da9d0d4 + . ./cri-lock-repos ++ . ./cri-common +++ . ./cri-getconfig +++ umask 002 +++ getrepos getconfig Repos perl -e ' use Osstest; readglobalconfig(); print $c{"Repos"} or die $!; ' +++ local repos=/home/osstest/repos +++ '[' -z /home/osstest/repos ']' +++ '[' '!' -d /home/osstest/repos ']' +++ echo /home/osstest/repos ++ repos=/home/osstest/repos ++ repos_lock=/home/osstest/repos/lock ++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']' + . ./cri-common ++ . ./cri-getconfig ++ umask 002 + select_xenbranch + case "$branch" in + tree=xen + xenbranch=xen-unstable-smoke + qemuubranch=qemu-upstream-unstable + '[' xxen = xlinux ']' + linuxbranch= + '[' xqemu-upstream-unstable = x ']' + select_prevxenbranch ++ ./cri-getprevxenbranch xen-unstable-smoke + prevxenbranch=xen-4.8-testing + '[' xcf5e1a74b9687be3d146e59ab10c26be6da9d0d4 = x ']' + : tested/2.6.39.x + . ./ap-common ++ : osst...@xenbits.xen.org +++ getconfig OsstestUpstream +++ perl -e ' use Osstest; readglobalconfig(); print $c{"OsstestUpstream"} or die $!; ' ++ : ++ : git://xenbits.xen.org/xen.git ++ : osst...@xenbits.xen.org:/home/xen/git/xen.git ++ : git://xenbits.xen.org/qemu-xen-traditional.git ++ : git://git.kernel.org ++ : git://git.kernel.org/pub/scm/linux/kernel/git ++ : git ++ : git://xenbits.xen.org/xtf.git ++ : osst...@xenbits.xen.org:/home/xen/git/xtf.git ++ : git://xenbits.xen.org/xtf.git ++ : git://xenbits.xen.org/libvirt.git ++ : osst...@xenbits.xen.org:/home/xen/git/libvirt.git ++ : git://xenbits.xen.org/libvirt.git ++ : git://xenbits.xen.org/osstest/rumprun.git ++ : git ++ : git://xenbits.xen.org/osstest/rumprun.git ++ : osst...@xenbits.xen.org:/home/xen/git/osstest/rumprun.git ++ : git://git.seabios.org/
[Xen-devel] [PATCH 1/7] xen/mce: adjust comment of callback register functions
c/s e966818264908e842e2847f579ca4d94e586eaac added mce_need_clearbank_register below the comment of x86_mce_callback_register(). This commit (1) adjusts the first paragraph of comment to be a general statement of all callback register functions, and (2) moves the second paragraph to the front of x86_mce_callback_register(). Signed-off-by: Haozhong Zhang --- Cc: Christoph Egger Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/cpu/mcheck/mce.h | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/mce.h b/xen/arch/x86/cpu/mcheck/mce.h index e83d431..42bb782 100644 --- a/xen/arch/x86/cpu/mcheck/mce.h +++ b/xen/arch/x86/cpu/mcheck/mce.h @@ -128,24 +128,24 @@ extern void mcheck_mca_clearbanks(struct mca_banks *); extern mctelem_cookie_t mcheck_mca_logout(enum mca_source, struct mca_banks *, struct mca_summary *, struct mca_banks *); -/* Register a callback to be made during bank telemetry logout. - * This callback is only available to those machine check handlers +/* Register callbacks to be made during bank telemetry logout. + * Those callbacks are only available to those machine check handlers * that call to the common mcheck_cmn_handler or who use the common * telemetry logout function mcheck_mca_logout in error polling. - * - * This can be used to collect additional information (typically non- - * architectural) provided by newer CPU families/models without the need - * to duplicate the whole handler resulting in various handlers each with - * its own tweaks and bugs. The callback receives an struct mc_info pointer - * which it can use with x86_mcinfo_add to add additional telemetry, - * the current MCA bank number we are reading telemetry from, and the - * MCi_STATUS value for that bank. */ /* Register a handler for judging whether the bank need to be cleared */ typedef int (*mce_need_clearbank_t)(enum mca_source who, u64 status); extern void mce_need_clearbank_register(mce_need_clearbank_t); +/* Register a callback to collect additional information (typically non- + * architectural) provided by newer CPU families/models without the need + * to duplicate the whole handler resulting in various handlers each with + * its own tweaks and bugs. The callback receives an struct mc_info pointer + * which it can use with x86_mcinfo_add to add additional telemetry, + * the current MCA bank number we are reading telemetry from, and the + * MCi_STATUS value for that bank. + */ typedef struct mcinfo_extended *(*x86_mce_callback_t) (struct mc_info *, uint16_t, uint64_t); extern void x86_mce_callback_register(x86_mce_callback_t); -- 2.10.1 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 3/7] x86/mce: set mcinfo_comm.type and .size in x86_mcinfo_reserve()
All existing calls to x86_mcinfo_reserve() are followed by statements that set the size and the type of the reserved space, so move them into x86_mcinfo_reserve() to simplify the code. Signed-off-by: Haozhong Zhang --- Cc: Christoph Egger Cc: Jan Beulich Cc: Andrew Cooper Changes: * Use "unsigned int" for arguments "size" and "type" of x86_mcinfo_reserve(). --- xen/arch/x86/cpu/mcheck/mcaction.c | 4 +--- xen/arch/x86/cpu/mcheck/mce.c | 17 + xen/arch/x86/cpu/mcheck/mce.h | 3 ++- xen/arch/x86/cpu/mcheck/mce_amd.c | 4 +--- xen/arch/x86/cpu/mcheck/mce_intel.c | 6 +- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/mcaction.c b/xen/arch/x86/cpu/mcheck/mcaction.c index 322163a..32056f2 100644 --- a/xen/arch/x86/cpu/mcheck/mcaction.c +++ b/xen/arch/x86/cpu/mcheck/mcaction.c @@ -13,14 +13,12 @@ mci_action_add_pageoffline(int bank, struct mc_info *mi, if (!mi) return NULL; -rec = x86_mcinfo_reserve(mi, sizeof(*rec)); +rec = x86_mcinfo_reserve(mi, sizeof(*rec), MC_TYPE_RECOVERY); if (!rec) { mi->flags |= MCINFO_FLAGS_UNCOMPLETE; return NULL; } -rec->common.type = MC_TYPE_RECOVERY; -rec->common.size = sizeof(*rec); rec->mc_bank = bank; rec->action_types = MC_ACTION_PAGE_OFFLINE; rec->action_info.page_retire.mfn = mfn; diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index aa9304f..53ca29c 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -205,7 +205,7 @@ static void mca_init_bank(enum mca_source who, if (!mi) return; -mib = x86_mcinfo_reserve(mi, sizeof(*mib)); +mib = x86_mcinfo_reserve(mi, sizeof(*mib), MC_TYPE_BANK); if (!mib) { mi->flags |= MCINFO_FLAGS_UNCOMPLETE; @@ -214,8 +214,6 @@ static void mca_init_bank(enum mca_source who, mib->mc_status = mca_rdmsr(MSR_IA32_MCx_STATUS(bank)); -mib->common.type = MC_TYPE_BANK; -mib->common.size = sizeof (struct mcinfo_bank); mib->mc_bank = bank; mib->mc_domid = DOMID_INVALID; @@ -251,8 +249,6 @@ static int mca_init_global(uint32_t flags, struct mcinfo_global *mig) const struct vcpu *curr = current; /* Set global information */ -mig->common.type = MC_TYPE_GLOBAL; -mig->common.size = sizeof (struct mcinfo_global); status = mca_rdmsr(MSR_IA32_MCG_STATUS); mig->mc_gstatus = status; mig->mc_domid = DOMID_INVALID; @@ -349,7 +345,7 @@ mcheck_mca_logout(enum mca_source who, struct mca_banks *bankmask, if ( (mctc = mctelem_reserve(which)) != NULL ) { mci = mctelem_dataptr(mctc); mcinfo_clear(mci); -mig = x86_mcinfo_reserve(mci, sizeof(*mig)); +mig = x86_mcinfo_reserve(mci, sizeof(*mig), MC_TYPE_GLOBAL); /* mc_info should at least hold up the global information */ ASSERT(mig); mca_init_global(mc_flags, mig); @@ -805,7 +801,8 @@ static void mcinfo_clear(struct mc_info *mi) x86_mcinfo_nentries(mi) = 0; } -void *x86_mcinfo_reserve(struct mc_info *mi, int size) +void *x86_mcinfo_reserve(struct mc_info *mi, + unsigned int size, unsigned int type) { int i; unsigned long end1, end2; @@ -832,7 +829,11 @@ void *x86_mcinfo_reserve(struct mc_info *mi, int size) /* there's enough space. add entry. */ x86_mcinfo_nentries(mi)++; -return memset(mic_index, 0, size); +memset(mic_index, 0, size); +mic_index->size = size; +mic_index->type = type; + +return mic_index; } static void x86_mcinfo_apei_save( diff --git a/xen/arch/x86/cpu/mcheck/mce.h b/xen/arch/x86/cpu/mcheck/mce.h index a28e862..b479b20 100644 --- a/xen/arch/x86/cpu/mcheck/mce.h +++ b/xen/arch/x86/cpu/mcheck/mce.h @@ -150,7 +150,8 @@ typedef struct mcinfo_extended *(*x86_mce_callback_t) (struct mc_info *, uint16_t, uint64_t); extern void x86_mce_callback_register(x86_mce_callback_t); -void *x86_mcinfo_reserve(struct mc_info *mi, int size); +void *x86_mcinfo_reserve(struct mc_info *mi, + unsigned int size, unsigned int type); void x86_mcinfo_dump(struct mc_info *mi); static inline int mce_vendor_bank_msr(const struct vcpu *v, uint32_t msr) diff --git a/xen/arch/x86/cpu/mcheck/mce_amd.c b/xen/arch/x86/cpu/mcheck/mce_amd.c index 599e465..fe51be9 100644 --- a/xen/arch/x86/cpu/mcheck/mce_amd.c +++ b/xen/arch/x86/cpu/mcheck/mce_amd.c @@ -218,15 +218,13 @@ amd_f10_handler(struct mc_info *mi, uint16_t bank, uint64_t status) if ( !(status & MCi_STATUS_MISCV) ) return NULL; -mc_ext = x86_mcinfo_reserve(mi, sizeof(*mc_ext)); +mc_ext = x86_mcinfo_reserve(mi, sizeof(*mc_ext), MC_TYPE_EXTENDED); if ( !mc_ext ) { mi->flags |= MCINFO_FLAGS_UNCOMPLETE; return NULL; } -mc_ext->common.type = MC_TYPE_EXTENDED; -mc_ext->c
[Xen-devel] [PATCH 4/7] x86/vmce: fill MSR_IA32_MCG_STATUS on all vcpus in broadcast case
The current implementation only fills MC MSRs on vcpu0 and leaves MC MSRs on other vcpus empty in the broadcast case. When guest reads 0 from MSR_IA32_MCG_STATUS on vcpuN (N > 0), it may think it's not possible to recover the execution on that vcpu and then get panic, although MSR_IA32_MCG_STATUS filled on vcpu0 may imply the injected vMCE is actually recoverable. To avoid such unnecessary guest panic, set MSR_IA32_MCG_STATUS on vcpuN (N > 0) to MCG_STATUS_MCIP|MCG_STATUS_RIPV. In addition, fill_vmsr_data(mc_bank, ...) is changed to return -EINVAL rather than 0, if an invalid domain ID is contained in mc_bank. Signed-off-by: Haozhong Zhang --- Cc: Christoph Egger Cc: Jan Beulich Cc: Andrew Cooper Changes: * Fix the return value check of fill_vmsr_data() in mc_memerr_dhandler(). * Include the behavior change in the commit message. * Compare by vcpu id rather than vcpu structure in fill_vmsr_data() * Exlpain vMCEs injected to each vCPU in the code comment. * Update MC MSRs for *all* vCPUs and return the last error (if any). * Remove "goto" in fill_vmsr_data(). --- xen/arch/x86/cpu/mcheck/mcaction.c | 16 - xen/arch/x86/cpu/mcheck/vmce.c | 74 ++ xen/arch/x86/cpu/mcheck/vmce.h | 2 +- 3 files changed, 60 insertions(+), 32 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/mcaction.c b/xen/arch/x86/cpu/mcheck/mcaction.c index 32056f2..dab9eac 100644 --- a/xen/arch/x86/cpu/mcheck/mcaction.c +++ b/xen/arch/x86/cpu/mcheck/mcaction.c @@ -88,22 +88,22 @@ mc_memerr_dhandler(struct mca_binfo *binfo, goto vmce_failed; } +if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL || +global->mc_vcpuid == XEN_MC_VCPUID_INVALID) +vmce_vcpuid = VMCE_INJECT_BROADCAST; +else +vmce_vcpuid = global->mc_vcpuid; + bank->mc_addr = gfn << PAGE_SHIFT | (bank->mc_addr & (PAGE_SIZE -1 )); -if ( fill_vmsr_data(bank, d, - global->mc_gstatus) == -1 ) +if (fill_vmsr_data(bank, d, global->mc_gstatus, + vmce_vcpuid == VMCE_INJECT_BROADCAST)) { mce_printk(MCE_QUIET, "Fill vMCE# data for DOM%d " "failed\n", bank->mc_domid); goto vmce_failed; } -if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL || -global->mc_vcpuid == XEN_MC_VCPUID_INVALID) -vmce_vcpuid = VMCE_INJECT_BROADCAST; -else -vmce_vcpuid = global->mc_vcpuid; - /* We will inject vMCE to DOMU*/ if ( inject_vmce(d, vmce_vcpuid) < 0 ) { diff --git a/xen/arch/x86/cpu/mcheck/vmce.c b/xen/arch/x86/cpu/mcheck/vmce.c index 13b692c..2caccae 100644 --- a/xen/arch/x86/cpu/mcheck/vmce.c +++ b/xen/arch/x86/cpu/mcheck/vmce.c @@ -381,38 +381,66 @@ int inject_vmce(struct domain *d, int vcpu) return ret; } -int fill_vmsr_data(struct mcinfo_bank *mc_bank, struct domain *d, - uint64_t gstatus) +static int vcpu_fill_mc_msrs(struct vcpu *v, uint64_t mcg_status, + uint64_t mci_status, uint64_t mci_addr, + uint64_t mci_misc) { -struct vcpu *v = d->vcpu[0]; - -if ( mc_bank->mc_domid != DOMID_INVALID ) +if ( v->arch.vmce.mcg_status & MCG_STATUS_MCIP ) { -if ( v->arch.vmce.mcg_status & MCG_STATUS_MCIP ) -{ -mce_printk(MCE_QUIET, "MCE: guest has not handled previous" - " vMCE yet!\n"); -return -1; -} +mce_printk(MCE_QUIET, "MCE: %pv: guest has not handled previous" + " vMCE yet!\n", v); +return -EBUSY; +} -spin_lock(&v->arch.vmce.lock); +spin_lock(&v->arch.vmce.lock); -v->arch.vmce.mcg_status = gstatus; -/* - * 1. Skip bank 0 to avoid 'bank 0 quirk' of old processors - * 2. Filter MCi_STATUS MSCOD model specific error code to guest - */ -v->arch.vmce.bank[1].mci_status = mc_bank->mc_status & - MCi_STATUS_MSCOD_MASK; -v->arch.vmce.bank[1].mci_addr = mc_bank->mc_addr; -v->arch.vmce.bank[1].mci_misc = mc_bank->mc_misc; +v->arch.vmce.mcg_status = mcg_status; +/* + * 1. Skip bank 0 to avoid 'bank 0 quirk' of old processors + * 2. Filter MCi_STATUS MSCOD model specific error code to guest + */ +v->arch.vmce.bank[1].mci_status = mci_status & MCi_STATUS_MSCOD_MASK; +v->arch.vmce.bank[1].mci_addr = mci_addr; +v->arch.vmce.bank[1].mci_misc = mci_misc; -spin_unlock(&v->arch.vmce.lock); -} +spin_unlock(&v->arch.vmce.lock); return 0; } +int fill_vmsr_data(struct mcinfo_bank *mc_bank, struct
[Xen-devel] [PATCH 0/7] MCE code cleanup and bugfix
This patch series separates the uncommitted code cleanup and bugfix patches from my previous patch series "[PATCH 00/19] MCE code cleanup and add LMCE support" with other new fixes. * This patch series is based on Jan's patch "x86/MCE: sanitize domain/vcpu ID handling". * Patch 1 & 6 are new ones. * Patch 2 is the previous patch 4 w/ the same title. * Patch 3 - 5 are the previous patch 8 - 10 w/ the last one renamed. * Patch 7 is the previous patch 11 w/ the same title. * Individual changes are logged in each patch. Haozhong Zhang (7): 1/7 xen/mce: adjust comment of callback register functions 2/7 xen/mce: remove unused x86_mcinfo_add() 3/7 x86/mce: set mcinfo_comm.type and .size in x86_mcinfo_reserve() 4/7 x86/vmce: fill MSR_IA32_MCG_STATUS on all vcpus in broadcast case 5/7 x86/mce: clear MSR_IA32_MCG_STATUS by writing 0 6/7 xen/mce: make ASSERT's about mce_dhandler_num in mce_action() Intel only 7/7 tools/xen-mceinj: fix the type of cpu number tools/tests/mce-test/tools/xen-mceinj.c | 12 +++--- xen/arch/x86/cpu/mcheck/mcaction.c | 20 - xen/arch/x86/cpu/mcheck/mce.c | 40 ++ xen/arch/x86/cpu/mcheck/mce.h | 24 +-- xen/arch/x86/cpu/mcheck/mce_amd.c | 4 +- xen/arch/x86/cpu/mcheck/mce_intel.c | 6 +-- xen/arch/x86/cpu/mcheck/vmce.c | 74 +++-- xen/arch/x86/cpu/mcheck/vmce.h | 2 +- 8 files changed, 95 insertions(+), 87 deletions(-) -- 2.10.1 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 2/7] xen/mce: remove unused x86_mcinfo_add()
c/s 9d13fd9fd320a7740c6446c048ff6a2990095966 turned to update the mcinfo buffer in-place instead of using x86_mcinfo_add(). The last uses of x86_mcinfo_add() were removed by that commit as well. Therefore, x86_mcinfo_add() was deprecated in fact. Signed-off-by: Haozhong Zhang --- Cc: Christoph Egger Cc: Jan Beulich Cc: Andrew Cooper Changes: * Explain the reason in the commit message. * Update the code comment mentioning x86_mcinfo_add. --- xen/arch/x86/cpu/mcheck/mce.c | 16 xen/arch/x86/cpu/mcheck/mce.h | 3 +-- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index e41989d..aa9304f 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -835,22 +835,6 @@ void *x86_mcinfo_reserve(struct mc_info *mi, int size) return memset(mic_index, 0, size); } -void *x86_mcinfo_add(struct mc_info *mi, void *mcinfo) -{ -struct mcinfo_common *mic, *buf; - -mic = (struct mcinfo_common *)mcinfo; -buf = x86_mcinfo_reserve(mi, mic->size); - -if ( !buf ) -mce_printk(MCE_CRITICAL, - "mcinfo_add: No space left in mc_info\n"); -else -memcpy(buf, mic, mic->size); - -return buf; -} - static void x86_mcinfo_apei_save( struct mcinfo_global *mc_global, struct mcinfo_bank *mc_bank) { diff --git a/xen/arch/x86/cpu/mcheck/mce.h b/xen/arch/x86/cpu/mcheck/mce.h index 42bb782..a28e862 100644 --- a/xen/arch/x86/cpu/mcheck/mce.h +++ b/xen/arch/x86/cpu/mcheck/mce.h @@ -142,7 +142,7 @@ extern void mce_need_clearbank_register(mce_need_clearbank_t); * architectural) provided by newer CPU families/models without the need * to duplicate the whole handler resulting in various handlers each with * its own tweaks and bugs. The callback receives an struct mc_info pointer - * which it can use with x86_mcinfo_add to add additional telemetry, + * which it can use with x86_mcinfo_reserve to add additional telemetry, * the current MCA bank number we are reading telemetry from, and the * MCi_STATUS value for that bank. */ @@ -150,7 +150,6 @@ typedef struct mcinfo_extended *(*x86_mce_callback_t) (struct mc_info *, uint16_t, uint64_t); extern void x86_mce_callback_register(x86_mce_callback_t); -void *x86_mcinfo_add(struct mc_info *mi, void *mcinfo); void *x86_mcinfo_reserve(struct mc_info *mi, int size); void x86_mcinfo_dump(struct mc_info *mi); -- 2.10.1 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 6/7] xen/mce: make ASSERT's about mce_dhandler_num in mce_action() Intel only
mce_dhandlers[] and its array size mce_dhandler_num are not used and set on non-Intel platforms, so the corresponding ASSERT's in mce_action() should be valid only for Intel. Signed-off-by: Haozhong Zhang --- Cc: Christoph Egger Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/cpu/mcheck/mce.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index 5a7e2ba..81d0902 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -1621,8 +1621,8 @@ static enum mce_result mce_action(const struct cpu_user_regs *regs, handlers = mce_uhandlers; } -/* At least a default handler should be registerd */ -ASSERT(handler_num); +/* At least a default handler should be registered for Intel CPU. */ +ASSERT(handler_num || boot_cpu_data.x86_vendor != X86_VENDOR_INTEL); local_mi = (struct mc_info*)mctelem_dataptr(mctc); x86_mcinfo_lookup(mic, local_mi, MC_TYPE_GLOBAL); @@ -1656,7 +1656,8 @@ static enum mce_result mce_action(const struct cpu_user_regs *regs, break; } } -ASSERT(i != handler_num); +ASSERT(i != handler_num || + boot_cpu_data.x86_vendor != X86_VENDOR_INTEL); } return worst_result; -- 2.10.1 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 7/7] tools/xen-mceinj: fix the type of cpu number
Use "unsigned int" rather than "int" to align to the type "uint32_t" of xen_mc_physcpuinfo.ncpus. Signed-off-by: Haozhong Zhang --- Cc: Ian Jackson Cc: Wei Liu Cc: Jan Beulich Changes: * Replace "uint32_t" by "unsigned int". --- tools/tests/mce-test/tools/xen-mceinj.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/tests/mce-test/tools/xen-mceinj.c b/tools/tests/mce-test/tools/xen-mceinj.c index 51abc8a..bae5a46 100644 --- a/tools/tests/mce-test/tools/xen-mceinj.c +++ b/tools/tests/mce-test/tools/xen-mceinj.c @@ -161,7 +161,7 @@ static int flush_msr_inj(xc_interface *xc_handle) return xc_mca_op(xc_handle, &mc); } -static int mca_cpuinfo(xc_interface *xc_handle) +static unsigned int mca_cpuinfo(xc_interface *xc_handle) { struct xen_mc mc; @@ -176,16 +176,18 @@ static int mca_cpuinfo(xc_interface *xc_handle) return 0; } -static int inject_cmci(xc_interface *xc_handle, int cpu_nr) +static int inject_cmci(xc_interface *xc_handle, unsigned int cpu_nr) { struct xen_mc mc; -int nr_cpus; +unsigned int nr_cpus; memset(&mc, 0, sizeof(struct xen_mc)); nr_cpus = mca_cpuinfo(xc_handle); if (!nr_cpus) err(xc_handle, "Failed to get mca_cpuinfo"); +if (cpu_nr >= nr_cpus) +err(xc_handle, "-c %u is larger than %u", cpu_nr, nr_cpus - 1); mc.cmd = XEN_MC_inject_v2; mc.interface_version = XEN_MCA_INTERFACE_VERSION; @@ -420,7 +422,7 @@ int main(int argc, char *argv[]) int c, opt_index; uint32_t domid; xc_interface *xc_handle; -int cpu_nr; +unsigned int cpu_nr; uint64_t gaddr, max_gpa; /* Default Value */ @@ -444,7 +446,7 @@ int main(int argc, char *argv[]) dump=1; break; case 'c': -cpu_nr = strtol(optarg, &optarg, 10); +cpu_nr = strtoul(optarg, &optarg, 10); if ( strlen(optarg) != 0 ) err(xc_handle, "Please input a digit parameter for CPU"); break; -- 2.10.1 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 5/7] x86/mce: clear MSR_IA32_MCG_STATUS by writing 0
On Intel CPU, an attemp to write to MSR_IA32_MCG_STATUS with any non-zero value would result in #GP. This commit writes 0 on AMD CPU as well instead of just clearing MCIP bit, because all non-reserved bits of MSR_IA32_MCG_STATUS have been handled at this point. Signed-off-by: Haozhong Zhang --- Cc: Christoph Egger Cc: Jan Beulich Cc: Andrew Cooper Cc: Boris Ostrovsky Cc: Suravee Suthikulpanit Changes: * Write 0 on AMD as well. * Change the patch title to reflect the above change. --- xen/arch/x86/cpu/mcheck/mce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index 53ca29c..5a7e2ba 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -539,7 +539,7 @@ void mcheck_cmn_handler(const struct cpu_user_regs *regs) gstatus = mca_rdmsr(MSR_IA32_MCG_STATUS); if ((gstatus & MCG_STATUS_MCIP) != 0) { mce_printk(MCE_CRITICAL, "MCE: Clear MCIP@ last step"); -mca_wrmsr(MSR_IA32_MCG_STATUS, gstatus & ~MCG_STATUS_MCIP); +mca_wrmsr(MSR_IA32_MCG_STATUS, 0); } mce_barrier_exit(&mce_trap_bar); -- 2.10.1 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH] x86/hvm: Don't let hvm_set_efer() raise #GP behind the emulators back
c/s 49de10f3c "x86/hvm: Don't raise #GP behind the emulators back for MSR accesses" missed an edge case. hvm_set_efer() raises #GP itself, so deliberately avoided the goto gp_fault path in hvm_msr_write_intercept(). With the above change, guest updates to MSR_EFER which end up faulting raises hvm_msr_write_intercept() returning X86EMUL_EXCEPTION. The second #GP gets combined to #DF and handed back to the guest. Update hvm_set_efer() to avoid raising #GP, requiring its callers to do so. Signed-off-by: Andrew Cooper CC: Jan Beulich --- CC: Boris Ostrovsky CC: Suravee Suthikulpanit --- xen/arch/x86/hvm/hvm.c | 2 -- xen/arch/x86/hvm/svm/nestedsvm.c | 4 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 5372a9a..9eeb0a2 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1989,7 +1989,6 @@ int hvm_set_efer(uint64_t value) printk(XENLOG_G_WARNING "%pv: Invalid EFER update: %#"PRIx64" -> %#"PRIx64" - %s\n", v, v->arch.hvm_vcpu.guest_efer, value, errstr); -hvm_inject_hw_exception(TRAP_gp_fault, 0); return X86EMUL_EXCEPTION; } @@ -1998,7 +1997,6 @@ int hvm_set_efer(uint64_t value) { gdprintk(XENLOG_WARNING, "Trying to change EFER.LME with paging enabled\n"); -hvm_inject_hw_exception(TRAP_gp_fault, 0); return X86EMUL_EXCEPTION; } diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c index ca11b96..5979b56 100644 --- a/xen/arch/x86/hvm/svm/nestedsvm.c +++ b/xen/arch/x86/hvm/svm/nestedsvm.c @@ -278,6 +278,8 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs) /* EFER */ v->arch.hvm_vcpu.guest_efer = n1vmcb->_efer; rc = hvm_set_efer(n1vmcb->_efer); +if ( rc == X86EMUL_EXCEPTION ) +hvm_inject_hw_exception(TRAP_gp_fault, 0); if (rc != X86EMUL_OKAY) gdprintk(XENLOG_ERR, "hvm_set_efer failed, rc: %u\n", rc); @@ -538,6 +540,8 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs) /* EFER */ v->arch.hvm_vcpu.guest_efer = ns_vmcb->_efer; rc = hvm_set_efer(ns_vmcb->_efer); +if ( rc == X86EMUL_EXCEPTION ) +hvm_inject_hw_exception(TRAP_gp_fault, 0); if (rc != X86EMUL_OKAY) gdprintk(XENLOG_ERR, "hvm_set_efer failed, rc: %u\n", rc); -- 2.1.4 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH] libxl/libxl_pci.c: Fix reverse logic when detaching device
On Fri, Feb 24, 2017 at 07:12:10AM +0800, Chao Gao wrote: > Commit 20b75251d97 ("libxl/libxl_pci.c: used LOG*D functions") reverses the > logic to call xc_deassign_device(). It makes the device unusable. > > Signed-off-by: Chao Gao Acked + applied. > --- > tools/libxl/libxl_pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c > index 8395352..b14df16 100644 > --- a/tools/libxl/libxl_pci.c > +++ b/tools/libxl/libxl_pci.c > @@ -1370,7 +1370,7 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid, > int hvm = 0, rc, num; > int stubdomid = 0; > uint32_t domainid = domid; > -bool isstubdom = !libxl_is_stubdom(ctx, domid, &domainid); > +bool isstubdom = libxl_is_stubdom(ctx, domid, &domainid); > > > assigned = libxl_device_pci_list(ctx, domid, &num); > -- > 1.8.3.1 > ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [linux-linus test] 104684: regressions - FAIL
Julien Grall writes ("Re: [Xen-devel] [linux-linus test] 104684: regressions - FAIL"): > This means that the path to the serial is different between 3.16 and > 4.10 and we have no common one. For now, I would revert it. Done. > A per-flight override sounds quite ugly, so I am not sure how to solve > this in the future. Any opinions? I'll look at the code and think of something. Ian. ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] nobling1 (was Re: [xen-4.8-testing test] 106011: tolerable trouble: blocked/broken/fail/pass - PUSHED)
osstest service owner writes ("[xen-4.8-testing test] 106011: tolerable trouble: blocked/broken/fail/pass - PUSHED"): > flight 106011 xen-4.8-testing real [real] > http://logs.test-lab.xenproject.org/osstest/logs/106011/ > > Failures :-/ but no regressions. > > Tests which are failing intermittently (not blocking): ... > test-amd64-amd64-xl-qemut-debianhvm-amd64-xsm 3 host-install(3) broken pass > in 105989 ... nobling1 seems bust. It says: L2/L3 Cache error was detected on the RAID controller. Please contact technical support to resolve this issue. Press 'X' to continue or else power off the system, replace the controller and reboot. Ian. ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [distros-debian-jessie test] 68613: tolerable trouble: blocked/broken/pass
flight 68613 distros-debian-jessie real [real] http://osstest.xs.citrite.net/~osstest/testlogs/logs/68613/ Failures :-/ but no regressions. Tests which did not succeed, but are not blocking: test-arm64-arm64-armhf-jessie-netboot-pygrub 1 build-check(1) blocked n/a build-arm64 2 hosts-allocate broken never pass build-arm64-pvops 2 hosts-allocate broken never pass build-arm64 3 capture-logs broken never pass build-arm64-pvops 3 capture-logs broken never pass test-armhf-armhf-armhf-jessie-netboot-pygrub 11 migrate-support-check fail never pass test-armhf-armhf-armhf-jessie-netboot-pygrub 12 saverestore-support-check fail never pass baseline version: flight 68573 jobs: build-amd64 pass build-arm64 broken build-armhf pass build-i386 pass build-amd64-pvopspass build-arm64-pvopsbroken build-armhf-pvopspass build-i386-pvops pass test-amd64-amd64-amd64-jessie-netboot-pvgrub pass test-amd64-i386-i386-jessie-netboot-pvgrub pass test-amd64-i386-amd64-jessie-netboot-pygrub pass test-arm64-arm64-armhf-jessie-netboot-pygrub blocked test-armhf-armhf-armhf-jessie-netboot-pygrub pass test-amd64-amd64-i386-jessie-netboot-pygrub pass sg-report-flight on osstest.xs.citrite.net logs: /home/osstest/logs images: /home/osstest/images Logs, config files, etc. are available at http://osstest.xs.citrite.net/~osstest/testlogs/logs Test harness code can be found at http://xenbits.xensource.com/gitweb?p=osstest.git;a=summary Push not applicable. ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [ovmf bisection] complete test-amd64-amd64-xl-qemuu-ovmf-amd64
branch xen-unstable xenbranch xen-unstable job test-amd64-amd64-xl-qemuu-ovmf-amd64 testid debian-hvm-install Tree: linux git://xenbits.xen.org/linux-pvops.git Tree: linuxfirmware git://xenbits.xen.org/osstest/linux-firmware.git Tree: ovmf https://github.com/tianocore/edk2.git Tree: qemu git://xenbits.xen.org/qemu-xen-traditional.git Tree: qemuu git://xenbits.xen.org/qemu-xen.git Tree: xen git://xenbits.xen.org/xen.git *** Found and reproduced problem changeset *** Bug is in tree: ovmf https://github.com/tianocore/edk2.git Bug introduced: dc4c770763d05297c7de6893a1e34b76499d0b09 Bug not present: ed1a2d42d5d54b6096b6e5121b0e5b7410b24108 Last fail repro: http://logs.test-lab.xenproject.org/osstest/logs/106067/ commit dc4c770763d05297c7de6893a1e34b76499d0b09 Author: Yonghong Zhu Date: Mon Feb 20 18:49:32 2017 +0800 BaseTools: add error check for Macro usage in the INF file Use of MACRO statements in the EDK II INF files is limited to local usage only; global or external macros are not permitted. This patch add the check for not defined macros. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao For bisection revision-tuple graph see: http://logs.test-lab.xenproject.org/osstest/results/bisect/ovmf/test-amd64-amd64-xl-qemuu-ovmf-amd64.debian-hvm-install.html Revision IDs in each graph node refer, respectively, to the Trees above. Running cs-bisection-step --graph-out=/home/logs/results/bisect/ovmf/test-amd64-amd64-xl-qemuu-ovmf-amd64.debian-hvm-install --summary-out=tmp/106067.bisection-summary --basis-template=105963 --blessings=real,real-bisect ovmf test-amd64-amd64-xl-qemuu-ovmf-amd64 debian-hvm-install Searching for failure / basis pass: 105980 fail [host=elbling1] / 105963 [host=godello0] 105949 [host=godello1] 105937 [host=nocera1] 105920 [host=huxelrebe0] 105878 [host=fiano1] 105865 [host=fiano0] 105854 [host=pinot1] 105837 [host=elbling0] 105814 [host=rimava1] 105808 [host=nobling1] 105782 [host=italia0] 105760 [host=merlot0] 105696 [host=chardonnay1] 105679 [host=baroque0] 105658 [host=huxelrebe1] 105652 [host=chardonnay0] 105636 [host=baroque1] 105631 [host=godello0] 105627 [host=italia1] 105604 [host=nobling0] 105599 ok. Failure / basis pass flights: 105980 / 105599 (tree with no url: minios) (tree with no url: seabios) Tree: linux git://xenbits.xen.org/linux-pvops.git Tree: linuxfirmware git://xenbits.xen.org/osstest/linux-firmware.git Tree: ovmf https://github.com/tianocore/edk2.git Tree: qemu git://xenbits.xen.org/qemu-xen-traditional.git Tree: qemuu git://xenbits.xen.org/qemu-xen.git Tree: xen git://xenbits.xen.org/xen.git Latest b65f2f457c49b2cfd7967c34b7a0b04c25587f13 c530a75c1e6a472b0eb9558310b518f0dfcd8860 88dab294d249f2cc22a72a0c2aa307d8432492b9 b669e922b37b8957248798a5eb7aa96a666cd3fe 57e8fbb2f702001a18bd81e9fe31b26d94247ac9 2f5af2c962c05b789bdd65b46c74711e903f86d0 Basis pass b65f2f457c49b2cfd7967c34b7a0b04c25587f13 c530a75c1e6a472b0eb9558310b518f0dfcd8860 7c609a144b6636577dd60fbaa5fc64efeecd7baf b669e922b37b8957248798a5eb7aa96a666cd3fe 5cd2e1739763915e6b4c247eef71f948dc808bd5 55a04feaa1f8ab6ef7d723fbb1d39c6b96ad184a Generating revisions with ./adhoc-revtuple-generator git://xenbits.xen.org/linux-pvops.git#b65f2f457c49b2cfd7967c34b7a0b04c25587f13-b65f2f457c49b2cfd7967c34b7a0b04c25587f13 git://xenbits.xen.org/osstest/linux-firmware.git#c530a75c1e6a472b0eb9558310b518f0dfcd8860-c530a75c1e6a472b0eb9558310b518f0dfcd8860 https://github.com/tianocore/edk2.git#7c609a144b6636577dd60fbaa5fc64efeecd7baf-88dab294d249f2cc22a72a0c2aa307d8432492b9 git://xenbits.xen.org/qemu-xen-traditional.git#b669e922b37b8957248798a5eb7aa96a666cd3fe-b669e922b37b8957248798a5eb7aa96a666cd3fe git://xenbits.xen.org/qemu-xen.git#5cd2e1739763915e6b4c247eef71f948dc808bd5-57e8fbb2f702001a18bd81e9fe31b26d94247ac9 git://xenbits.xen.org/xen.git#55a04feaa1f8ab6ef7d723fbb1d39c6b96ad184a-2f5af2c962c05b789bdd65b46c74711e903f86d0 Loaded 3005 nodes in revision graph Searching for test results: 105599 pass b65f2f457c49b2cfd7967c34b7a0b04c25587f13 c530a75c1e6a472b0eb9558310b518f0dfcd8860 7c609a144b6636577dd60fbaa5fc64efeecd7baf b669e922b37b8957248798a5eb7aa96a666cd3fe 5cd2e1739763915e6b4c247eef71f948dc808bd5 55a04feaa1f8ab6ef7d723fbb1d39c6b96ad184a 105604 [host=nobling0] 105627 [host=italia1] 105631 [host=godello0] 105652 [host=chardonnay0] 105636 [host=baroque1] 105658 [host=huxelrebe1] 105679 [host=baroque0] 105696 [host=chardonnay1] 105760 [host=merlot0] 105782 [host=italia0] 105808 [host=nobling1] 105814 [host=rimava1] 105837 [host=elbling0] 105878 [host=fiano1] 105854 [host=pinot1] 105865 [host=fiano0] 105920 [host=huxelrebe0] 105949 [host=godello1] 105937 [host=nocera1] 106035 pass b65f2f457c49b2cfd7967c34b7a0b04c25587f13 c530a75c1e6a472b0eb9558310b518f0dfcd8860 c035
Re: [Xen-devel] [PATCH 5/7] x86/mce: clear MSR_IA32_MCG_STATUS by writing 0
On 02/24/2017 05:52 AM, Haozhong Zhang wrote: > On Intel CPU, an attemp to write to MSR_IA32_MCG_STATUS with any > non-zero value would result in #GP. > > This commit writes 0 on AMD CPU as well instead of just clearing MCIP > bit, because all non-reserved bits of MSR_IA32_MCG_STATUS have been > handled at this point. > > Signed-off-by: Haozhong Zhang Reviewed-by: Boris Ostrovsky ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH] x86/hvm: Don't let hvm_set_efer() raise #GP behind the emulators back
On 02/24/2017 05:59 AM, Andrew Cooper wrote: > c/s 49de10f3c "x86/hvm: Don't raise #GP behind the emulators back for MSR > accesses" missed an edge case. > > hvm_set_efer() raises #GP itself, so deliberately avoided the goto gp_fault > path in hvm_msr_write_intercept(). > > With the above change, guest updates to MSR_EFER which end up faulting raises > hvm_msr_write_intercept() returning X86EMUL_EXCEPTION. The second #GP gets > combined to #DF and handed back to the guest. > > Update hvm_set_efer() to avoid raising #GP, requiring its callers to do so. > > Signed-off-by: Andrew Cooper > CC: Jan Beulich Reviewed-by: Boris Ostrovsky ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [xen-unstable test] 106034: regressions - trouble: blocked/broken/fail/pass
flight 106034 xen-unstable real [real] http://logs.test-lab.xenproject.org/osstest/logs/106034/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-i386-xl-qemuu-winxpsp3 3 host-install(3) broken REGR. vs. 105933 test-amd64-amd64-i386-pvgrub 3 host-install(3)broken REGR. vs. 105933 test-amd64-i386-qemuu-rhel6hvm-intel 6 xen-boot fail REGR. vs. 105933 test-amd64-amd64-xl-qemut-stubdom-debianhvm-amd64-xsm 6 xen-boot fail REGR. vs. 105933 test-amd64-i386-rumprun-i386 6 xen-boot fail REGR. vs. 105933 test-amd64-i386-libvirt 8 leak-check/basis(8) fail REGR. vs. 105933 test-amd64-i386-xl-qemut-debianhvm-amd64-xsm 6 xen-boot fail REGR. vs. 105933 test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 6 xen-boot fail REGR. vs. 105933 test-amd64-i386-migrupgrade 10 xen-boot/dst_hostfail REGR. vs. 105933 test-amd64-i386-xl-xsm9 debian-install fail REGR. vs. 105933 test-armhf-armhf-libvirt-raw 7 host-ping-check-xen fail REGR. vs. 105933 test-amd64-amd64-qemuu-nested-amd 13 xen-boot/l1 fail REGR. vs. 105933 test-armhf-armhf-xl 9 debian-install fail REGR. vs. 105933 test-amd64-i386-xl6 xen-boot fail REGR. vs. 105933 Regressions which are regarded as allowable (not blocking): test-armhf-armhf-libvirt-xsm 13 saverestore-support-checkfail like 105933 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-stopfail like 105933 test-amd64-i386-xl-qemut-win7-amd64 16 guest-stop fail like 105933 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail like 105933 test-armhf-armhf-libvirt 13 saverestore-support-checkfail like 105933 test-amd64-amd64-xl-rtds 9 debian-install fail like 105933 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stopfail like 105933 Tests which did not succeed, but are not blocking: test-arm64-arm64-libvirt-xsm 1 build-check(1) blocked n/a test-arm64-arm64-xl 1 build-check(1) blocked n/a build-arm64-libvirt 1 build-check(1) blocked n/a test-arm64-arm64-libvirt-qcow2 1 build-check(1) blocked n/a test-arm64-arm64-libvirt 1 build-check(1) blocked n/a test-arm64-arm64-xl-credit2 1 build-check(1) blocked n/a test-arm64-arm64-xl-rtds 1 build-check(1) blocked n/a test-arm64-arm64-xl-multivcpu 1 build-check(1) blocked n/a test-arm64-arm64-xl-xsm 1 build-check(1) blocked n/a test-amd64-amd64-xl-pvh-amd 11 guest-start fail never pass test-amd64-amd64-libvirt-xsm 12 migrate-support-checkfail never pass test-amd64-amd64-xl-pvh-intel 11 guest-start fail never pass test-amd64-i386-libvirt-xsm 12 migrate-support-checkfail never pass build-arm64-xsm 5 xen-buildfail never pass build-arm64 5 xen-buildfail never pass test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check fail never pass test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check fail never pass test-amd64-amd64-libvirt-vhd 11 migrate-support-checkfail never pass build-arm64-pvops 5 kernel-build fail never pass test-armhf-armhf-xl-multivcpu 12 migrate-support-checkfail never pass test-armhf-armhf-xl-multivcpu 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit2 12 migrate-support-checkfail never pass test-armhf-armhf-xl-credit2 13 saverestore-support-checkfail never pass test-armhf-armhf-libvirt-xsm 12 migrate-support-checkfail never pass test-armhf-armhf-xl-cubietruck 12 migrate-support-checkfail never pass test-armhf-armhf-xl-cubietruck 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-vhd 11 migrate-support-checkfail never pass test-armhf-armhf-xl-vhd 12 saverestore-support-checkfail never pass test-amd64-amd64-libvirt 12 migrate-support-checkfail never pass test-armhf-armhf-xl-xsm 12 migrate-support-checkfail never pass test-armhf-armhf-xl-xsm 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-arndale 12 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 13 saverestore-support-checkfail never pass test-armhf-armhf-libvirt 12 migrate-support-checkfail never pass test-armhf-armhf-xl-rtds 12 migrate-support-checkfail never pass test-armhf-armhf-xl-rtds 13 saverestore-support-checkfail never pass version targeted for testing: xen d97ce3614ba5d5e70a39d28a64de684e3b27c9dc baseline version: xen
Re: [Xen-devel] Enabling #VE for a domain from dom0
On 24/02/17 14:14, Vlad-Ioan TOPAN wrote: > Hello, > > We are trying to use the #VE support in Xen to monitor memory accesses > to certain pages from a kernel module in Windows. > > As it is written now, the #VE-enabling code appears to enforce being > called by a domain for itself (by each VCPU for itself, actually), which > severely limits its usefulness. Is there an architectural reasoning for > this or some other factor I'm missing? > > The process of enabling #VE as I understand it starts from > xc_altp2m_set_vcpu_enable_notify(); further along, when the > HVMOP_altp2m_vcpu_enable_notify message is handled, several checks are > made to ensure it's called for the current VCPU. > > Another check is in p2m.c in the function p2m_set_altp2m_mem_access(), > which clears the "suppress #VE" bit only for pages on the same domain: > > return ap2m->set_entry(ap2m, gfn_l, mfn, PAGE_ORDER_4K, t, a, > (current->domain != d)); > > The "(current->domain != d)" bit there is the sve parameter. > > Is there any reason not to allow cross-domain enabling of #VE? #VE, by design, raises an exception in non-root context, without breaking out to the hypervisor. The vcpu in question needs to set up a suitable #VE handler, so it is not safe for an external entity to chose when a vcpu should start receiving #VE's. ~Andrew ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] Enabling #VE for a domain from dom0
Hello, We are trying to use the #VE support in Xen to monitor memory accesses to certain pages from a kernel module in Windows. As it is written now, the #VE-enabling code appears to enforce being called by a domain for itself (by each VCPU for itself, actually), which severely limits its usefulness. Is there an architectural reasoning for this or some other factor I'm missing? The process of enabling #VE as I understand it starts from xc_altp2m_set_vcpu_enable_notify(); further along, when the HVMOP_altp2m_vcpu_enable_notify message is handled, several checks are made to ensure it's called for the current VCPU. Another check is in p2m.c in the function p2m_set_altp2m_mem_access(), which clears the "suppress #VE" bit only for pages on the same domain: return ap2m->set_entry(ap2m, gfn_l, mfn, PAGE_ORDER_4K, t, a, (current->domain != d)); The "(current->domain != d)" bit there is the sve parameter. Is there any reason not to allow cross-domain enabling of #VE? Thank you, -- Vlad-Ioan TOPAN Linux Kernel Development Lead Bitdefender ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH] x86/hvm: Don't let hvm_set_efer() raise #GP behind the emulators back
>>> On 24.02.17 at 11:59, wrote: > c/s 49de10f3c "x86/hvm: Don't raise #GP behind the emulators back for MSR > accesses" missed an edge case. > > hvm_set_efer() raises #GP itself, so deliberately avoided the goto gp_fault > path in hvm_msr_write_intercept(). > > With the above change, guest updates to MSR_EFER which end up faulting raises > hvm_msr_write_intercept() returning X86EMUL_EXCEPTION. The second #GP gets > combined to #DF and handed back to the guest. > > Update hvm_set_efer() to avoid raising #GP, requiring its callers to do so. > > Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [linux-linus test] 106009: regressions - trouble: blocked/broken/fail/pass
On 02/23/2017 08:20 PM, osstest service owner wrote: > flight 106009 linux-linus real [real] > http://logs.test-lab.xenproject.org/osstest/logs/106009/ > > Regressions :-( > > Tests which did not succeed and are blocking, > including tests which could not be run: > test-amd64-i386-xl-qemuu-ovmf-amd64 3 host-install(3) broken REGR. vs. > 59254 > test-amd64-i386-xl-qemut-debianhvm-amd64 3 host-install(3) broken REGR. vs. > 59254 > test-amd64-amd64-xl-pvh-intel 11 guest-start fail REGR. vs. > 59254 Ian, Can you change PVH test to use device_model_version="none" instead of pvh=1 I think this needs something like diff --git a/make-flight b/make-flight index f513b80..604b96b 100755 --- a/make-flight +++ b/make-flight @@ -646,7 +646,7 @@ test_matrix_do_one () { *) test_xend=n ;; esac - # PVH tests for versions >= 4.5 only + # PVH tests for versions >= 4.9 only case "$xenbranch" in xen-3.*-testing) test_pvh=n ;; xen-4.0-testing) test_pvh=n ;; @@ -654,6 +654,10 @@ test_matrix_do_one () { xen-4.2-testing) test_pvh=n ;; xen-4.3-testing) test_pvh=n ;; xen-4.4-testing) test_pvh=n ;; + xen-4.5-testing) test_pvh=n ;; + xen-4.6-testing) test_pvh=n ;; + xen-4.7-testing) test_pvh=n ;; + xen-4.8-testing) test_pvh=n ;; *) test_pvh=y ;; esac @@ -738,7 +742,7 @@ test_matrix_do_one () { # which would need looking at. fi - if [ x$test_pvh = xy -a $xenarch = amd64 -a $dom0arch = amd64 ]; then + if [ x$test_pvh = xy -a $xenarch = amd64 ]; then for cpuvendor in amd intel; do diff --git a/ts-debian-fixup b/ts-debian-fixup index cc779a3..f869c2c 100755 --- a/ts-debian-fixup +++ b/ts-debian-fixup @@ -136,7 +136,8 @@ sub otherfixupcfg () { my $pvh = guest_var($gho,'pvh',undef); if ($pvh) { $cfg =~ s/^pvh\b.*//mg; - $cfg .= "\npvh=$pvh\n"; + $cfg .= "\nbuilder='hvm'\n" + $cfg .= "\ndevice_model_version='none'\n" } # PCI passthrough -boris ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [xen-4.5-testing baseline-only test] 68612: regressions - FAIL
This run is configured for baseline tests only. flight 68612 xen-4.5-testing real [real] http://osstest.xs.citrite.net/~osstest/testlogs/logs/68612/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-armhf-armhf-xl 15 guest-start/debian.repeat fail REGR. vs. 68572 test-amd64-i386-qemuu-rhel6hvm-amd 9 redhat-install fail REGR. vs. 68572 Regressions which are regarded as allowable (not blocking): test-xtf-amd64-amd64-3 20 xtf/test-hvm32-invlpg~shadow fail like 68572 test-xtf-amd64-amd64-3 33 xtf/test-hvm32pae-invlpg~shadow fail like 68572 test-xtf-amd64-amd64-3 44 xtf/test-hvm64-invlpg~shadow fail like 68572 test-armhf-armhf-libvirt 13 saverestore-support-checkfail like 68572 test-xtf-amd64-amd64-2 20 xtf/test-hvm32-invlpg~shadow fail like 68572 test-xtf-amd64-amd64-2 33 xtf/test-hvm32pae-invlpg~shadow fail like 68572 test-xtf-amd64-amd64-2 44 xtf/test-hvm64-invlpg~shadow fail like 68572 test-xtf-amd64-amd64-4 54 leak-check/check fail like 68572 test-amd64-amd64-xl-rtds 6 xen-boot fail like 68572 test-xtf-amd64-amd64-3 54 leak-check/check fail like 68572 test-xtf-amd64-amd64-1 54 leak-check/check fail like 68572 test-xtf-amd64-amd64-5 54 leak-check/check fail like 68572 test-xtf-amd64-amd64-2 54 leak-check/check fail like 68572 test-amd64-amd64-qemuu-nested-intel 13 xen-boot/l1 fail like 68572 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-stop fail like 68572 test-amd64-amd64-xl-qemuu-win7-amd64 15 guest-localmigrate/x10 fail like 68572 test-amd64-amd64-xl-qemut-winxpsp3 9 windows-install fail like 68572 Tests which did not succeed, but are not blocking: test-amd64-amd64-xl-pvh-intel 11 guest-start fail never pass test-armhf-armhf-xl-multivcpu 12 migrate-support-checkfail never pass test-armhf-armhf-xl-multivcpu 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit2 12 migrate-support-checkfail never pass test-armhf-armhf-xl-credit2 13 saverestore-support-checkfail never pass test-armhf-armhf-libvirt 12 migrate-support-checkfail never pass test-armhf-armhf-xl-midway 12 migrate-support-checkfail never pass test-armhf-armhf-xl-midway 13 saverestore-support-checkfail never pass test-armhf-armhf-xl 12 migrate-support-checkfail never pass test-armhf-armhf-xl 13 saverestore-support-checkfail never pass test-amd64-amd64-xl-pvh-amd 11 guest-start fail never pass test-xtf-amd64-amd64-4 53 xtf/test-hvm64-xsa-195 fail never pass test-amd64-i386-libvirt 12 migrate-support-checkfail never pass test-amd64-amd64-libvirt 12 migrate-support-checkfail never pass test-armhf-armhf-libvirt-raw 10 guest-start fail never pass test-xtf-amd64-amd64-3 53 xtf/test-hvm64-xsa-195 fail never pass test-xtf-amd64-amd64-1 53 xtf/test-hvm64-xsa-195 fail never pass test-xtf-amd64-amd64-5 53 xtf/test-hvm64-xsa-195 fail never pass test-xtf-amd64-amd64-2 53 xtf/test-hvm64-xsa-195 fail never pass test-armhf-armhf-xl-vhd 10 guest-start fail never pass test-amd64-amd64-libvirt-vhd 11 migrate-support-checkfail never pass test-amd64-amd64-qemuu-nested-amd 16 debian-hvm-install/l1/l2 fail never pass test-amd64-i386-xl-qemut-win7-amd64 16 guest-stop fail never pass test-armhf-armhf-xl-rtds 12 migrate-support-checkfail never pass test-armhf-armhf-xl-rtds 13 saverestore-support-checkfail never pass test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail never pass version targeted for testing: xen 83cb2dba9b98c4e340fe0b1f1859ddac16ad3fad baseline version: xen 43d06efb724d32a70b1cc9973d7cdcbbb5d96105 Last test of basis68572 2017-02-17 02:14:02 Z7 days Testing same since68612 2017-02-24 05:16:49 Z0 days1 attempts People who touched revisions under test: Ian Jackson jobs: build-amd64-xtf pass build-amd64 pass build-armhf pass build-i386 pass build-amd64-libvirt pass build-armhf-libvirt pass build-i386-libvirt pass build-amd64-prev pass build-i386-prev
Re: [Xen-devel] Enabling #VE for a domain from dom0
> #VE, by design, raises an exception in non-root context, without > breaking out to the hypervisor. > > The vcpu in question needs to set up a suitable #VE handler, so it is > not safe for an external entity to chose when a vcpu should start > receiving #VE's. The problem is that from a security solution standpoint, it isn't feasible in a Windows guest to use libxc to enable #VE. As it is implemented, libxc is required to allow sharing a structure between the guest and the host; the structure only contains the gfn of the #VE page and the domain id/vcpu id, which are useless since it can only be enabled on the current VCPU. Would a patch providing a simpler VMCALL (without sharing structures, only passing the gfn) to enable #VE be acceptable? Is there any reason for the other check I've mentioned, performed when setting the "suppres #VE" bit in PTEs? Unsuppressing #VEs for a page will only do anything if the guest has already enabled #VE, so the previous issue doesn't apply in this case. Thank you for the prompt answer! -- Vlad-Ioan TOPAN ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [xen-unstable-smoke test] 106032: tolerable trouble: broken/fail/pass - PUSHED
Hi Ian, On 23/02/17 20:53, osstest service owner wrote: flight 106032 xen-unstable-smoke real [real] http://logs.test-lab.xenproject.org/osstest/logs/106032/ Failures :-/ but no regressions. Tests which did not succeed, but are not blocking: test-arm64-arm64-xl-xsm 1 build-check(1) blocked n/a build-arm64 5 xen-buildfail never pass build-arm64-pvops 5 kernel-build fail never pass Looking at the log [1] , the kernel build is failing because the target dtbs_install does not exist on the revision used. However Linux 3.16 will unlikely boot on Seattle. IIRC a good kernel for this board would be 4.4, but we may want a more recent to accommodate Thunder-X. IIRC the support was added in Linux 4.9. Cheers, [1] http://logs.test-lab.xenproject.org/osstest/logs/106032/build-arm64-pvops/5.ts-kernel-build.log test-armhf-armhf-xl 12 migrate-support-checkfail never pass test-armhf-armhf-xl 13 saverestore-support-checkfail never pass test-amd64-amd64-libvirt 12 migrate-support-checkfail never pass version targeted for testing: xen 5258ab0fcc67587d802e33bcc5bf89048d184a73 baseline version: xen d97ce3614ba5d5e70a39d28a64de684e3b27c9dc Last test of basis 106016 2017-02-23 11:02:27 Z0 days Failing since106021 2017-02-23 14:01:51 Z0 days3 attempts Testing same since 106032 2017-02-23 19:04:32 Z0 days1 attempts People who touched revisions under test: Ian Jackson Marek Marczykowski-Górecki Paul Durrant Razvan Cojocaru Samuel Thibault Wei Liu jobs: build-amd64 pass build-arm64 fail build-armhf pass build-amd64-libvirt pass build-arm64-pvopsfail test-armhf-armhf-xl pass test-arm64-arm64-xl-xsm broken test-amd64-amd64-xl-qemuu-debianhvm-i386 pass test-amd64-amd64-libvirt pass sg-report-flight on osstest.test-lab.xenproject.org logs: /home/logs/logs images: /home/logs/images Logs, config files, etc. are available at http://logs.test-lab.xenproject.org/osstest/logs Explanation of these reports, and of osstest in general, is at http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master Test harness code can be found at http://xenbits.xen.org/gitweb?p=osstest.git;a=summary Pushing revision : + branch=xen-unstable-smoke + revision=5258ab0fcc67587d802e33bcc5bf89048d184a73 + . ./cri-lock-repos ++ . ./cri-common +++ . ./cri-getconfig +++ umask 002 +++ getrepos getconfig Repos perl -e ' use Osstest; readglobalconfig(); print $c{"Repos"} or die $!; ' +++ local repos=/home/osstest/repos +++ '[' -z /home/osstest/repos ']' +++ '[' '!' -d /home/osstest/repos ']' +++ echo /home/osstest/repos ++ repos=/home/osstest/repos ++ repos_lock=/home/osstest/repos/lock ++ '[' x '!=' x/home/osstest/repos/lock ']' ++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock ++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push xen-unstable-smoke 5258ab0fcc67587d802e33bcc5bf89048d184a73 + branch=xen-unstable-smoke + revision=5258ab0fcc67587d802e33bcc5bf89048d184a73 + . ./cri-lock-repos ++ . ./cri-common +++ . ./cri-getconfig +++ umask 002 +++ getrepos getconfig Repos perl -e ' use Osstest; readglobalconfig(); print $c{"Repos"} or die $!; ' +++ local repos=/home/osstest/repos +++ '[' -z /home/osstest/repos ']' +++ '[' '!' -d /home/osstest/repos ']' +++ echo /home/osstest/repos ++ repos=/home/osstest/repos ++ repos_lock=/home/osstest/repos/lock ++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']' + . ./cri-common ++ . ./cri-getconfig ++ umask 002 + select_xenbranch + case "$branch" in + tree=xen + xenbranch=xen-unstable-smoke + qemuubranch=qemu-upstream-unstable + '[' xxen = xlinux ']' + linuxbranch= + '[' xqemu-upstream-unstable = x ']' + select_prevxenbranch ++ ./cri-getprevxenbranch xen-unstable-smoke + prevxenbranch=xen-4.8-testing + '[' x5258ab0fcc67587d802e33bcc5bf89048d184a73 = x ']' + : tested/2.6.39.x + . ./ap-common ++ : osst...@xenbits.xen.org +++ getconfig OsstestUpstream +++ perl -e ' use Osstest; readglobalconfig(); print $c{"OsstestUpstream"} or die $!; ' ++ : ++ : git://xenbits.xen.org/xen.git +
[Xen-devel] [linux-linus test] 106042: regressions - trouble: blocked/broken/fail/pass
flight 106042 linux-linus real [real] http://logs.test-lab.xenproject.org/osstest/logs/106042/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: build-amd64-pvops 3 host-install(3) broken REGR. vs. 59254 test-amd64-i386-xl-qemuu-ovmf-amd64 3 host-install(3) broken REGR. vs. 59254 test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 3 host-install(3) broken REGR. vs. 59254 test-amd64-i386-xl-qemut-winxpsp3 3 host-install(3)broken REGR. vs. 59254 test-amd64-i386-freebsd10-i386 3 host-install(3) broken REGR. vs. 59254 test-armhf-armhf-xl-multivcpu 3 host-install(3)broken REGR. vs. 59254 test-armhf-armhf-xl 6 xen-boot fail REGR. vs. 59254 test-armhf-armhf-libvirt 6 xen-boot fail REGR. vs. 59254 test-armhf-armhf-xl-credit2 6 xen-boot fail REGR. vs. 59254 test-armhf-armhf-xl-xsm 6 xen-boot fail REGR. vs. 59254 test-armhf-armhf-xl-arndale 6 xen-boot fail REGR. vs. 59254 test-armhf-armhf-libvirt-xsm 6 xen-boot fail REGR. vs. 59254 Regressions which are regarded as allowable (not blocking): test-armhf-armhf-xl-rtds 6 xen-boot fail REGR. vs. 59254 test-armhf-armhf-xl-vhd 6 xen-bootfail baseline untested test-armhf-armhf-libvirt-raw 6 xen-bootfail baseline untested test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail like 59254 test-amd64-i386-xl-qemut-win7-amd64 16 guest-stop fail like 59254 Tests which did not succeed, but are not blocking: test-amd64-amd64-xl-qemuu-ovmf-amd64 1 build-check(1) blocked n/a test-amd64-amd64-libvirt-vhd 1 build-check(1) blocked n/a test-arm64-arm64-libvirt-xsm 1 build-check(1) blocked n/a test-amd64-amd64-xl-credit2 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemuu-debianhvm-amd64 1 build-check(1)blocked n/a test-amd64-amd64-qemuu-nested-intel 1 build-check(1) blocked n/a test-amd64-amd64-rumprun-amd64 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemuu-debianhvm-amd64-xsm 1 build-check(1)blocked n/a test-amd64-amd64-xl-pvh-intel 1 build-check(1) blocked n/a test-amd64-amd64-i386-pvgrub 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemut-winxpsp3 1 build-check(1) blocked n/a test-arm64-arm64-xl 1 build-check(1) blocked n/a build-arm64-libvirt 1 build-check(1) blocked n/a test-arm64-arm64-libvirt-qcow2 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemut-stubdom-debianhvm-amd64-xsm 1 build-check(1) blocked n/a test-amd64-amd64-libvirt-pair 1 build-check(1) blocked n/a test-arm64-arm64-libvirt 1 build-check(1) blocked n/a test-amd64-amd64-xl-multivcpu 1 build-check(1) blocked n/a test-amd64-amd64-libvirt-xsm 1 build-check(1) blocked n/a test-amd64-amd64-libvirt 1 build-check(1) blocked n/a test-amd64-amd64-xl-xsm 1 build-check(1) blocked n/a test-amd64-amd64-xl 1 build-check(1) blocked n/a test-amd64-amd64-xl-pvh-amd 1 build-check(1) blocked n/a test-arm64-arm64-xl-credit2 1 build-check(1) blocked n/a test-amd64-amd64-pair 1 build-check(1) blocked n/a test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a test-amd64-amd64-qemuu-nested-amd 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemuu-win7-amd64 1 build-check(1) blocked n/a test-amd64-amd64-pygrub 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemuu-winxpsp3 1 build-check(1) blocked n/a test-amd64-amd64-xl-qcow2 1 build-check(1) blocked n/a test-arm64-arm64-xl-rtds 1 build-check(1) blocked n/a test-amd64-amd64-amd64-pvgrub 1 build-check(1) blocked n/a test-arm64-arm64-xl-multivcpu 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemut-win7-amd64 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemut-debianhvm-amd64-xsm 1 build-check(1)blocked n/a test-amd64-amd64-xl-qemut-debianhvm-amd64 1 build-check(1)blocked n/a test-amd64-amd64-xl-rtds 1 build-check(1) blocked n/a test-arm64-arm64-xl-xsm 1 build-check(1) blocked n/a test-amd64-i386-libvirt 12 migrate-support-checkfail never pass build-arm64-xsm 5 xen-buildfail never pass build-arm64 5 xen-buildfail never pass test-armhf-armhf-xl-cubietruck 12 migrate-support-checkfail never pas
[Xen-devel] [xen-unstable-smoke test] 106071: regressions - trouble: broken/fail/pass
flight 106071 xen-unstable-smoke real [real] http://logs.test-lab.xenproject.org/osstest/logs/106071/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-amd64-xl-qemuu-debianhvm-i386 9 debian-hvm-install fail REGR. vs. 106060 Tests which did not succeed, but are not blocking: test-arm64-arm64-xl-xsm 1 build-check(1) blocked n/a build-arm64 5 xen-buildfail never pass build-arm64-pvops 5 kernel-build fail never pass test-armhf-armhf-xl 12 migrate-support-checkfail never pass test-armhf-armhf-xl 13 saverestore-support-checkfail never pass test-amd64-amd64-libvirt 12 migrate-support-checkfail never pass version targeted for testing: xen e55e6b641bba24fcaddb1914017b59197eaa92b9 baseline version: xen cf5e1a74b9687be3d146e59ab10c26be6da9d0d4 Last test of basis 106060 2017-02-24 09:04:58 Z0 days Testing same since 106071 2017-02-24 12:02:43 Z0 days1 attempts People who touched revisions under test: Chao Gao Wei Liu jobs: build-amd64 pass build-arm64 fail build-armhf pass build-amd64-libvirt pass build-arm64-pvopsfail test-armhf-armhf-xl pass test-arm64-arm64-xl-xsm broken test-amd64-amd64-xl-qemuu-debianhvm-i386 fail test-amd64-amd64-libvirt pass sg-report-flight on osstest.test-lab.xenproject.org logs: /home/logs/logs images: /home/logs/images Logs, config files, etc. are available at http://logs.test-lab.xenproject.org/osstest/logs Explanation of these reports, and of osstest in general, is at http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master Test harness code can be found at http://xenbits.xen.org/gitweb?p=osstest.git;a=summary Not pushing. commit e55e6b641bba24fcaddb1914017b59197eaa92b9 Author: Chao Gao Date: Fri Feb 24 07:12:10 2017 +0800 libxl/libxl_pci.c: Fix reverse logic when detaching device Commit 20b75251d97 ("libxl/libxl_pci.c: used LOG*D functions") reverses the logic to call xc_deassign_device(). It makes the device unusable. Signed-off-by: Chao Gao Acked-by: Wei Liu (qemu changes not included) ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] Error in Xen while booting for salvator-X (M3 Board)
On 21/02/17 12:03, George John wrote: Hi, Hello, I was trying out xen in salvator-X(M3 Board as described in https://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions/Salvator-X I ran in to following error: U-Boot 2015.04 (Feb 21 2017 - 14:24:48) CPU: Renesas Electronics R8A7796 rev 1.0 Board: Salvator-X I2C: ready DRAM: 3.9 GiB MMC: sh-sdhi: 0, sh-sdhi: 1, sh-sdhi: 2 In:serial Out: serial Err: serial Net: Board Net Initialization Failed No ethernet found. Hit any key to stop autoboot: 0 819584 bytes read in 89 ms (8.8 MiB/s) 64927 bytes read in 23 ms (2.7 MiB/s) 14038016 bytes read in 1188 ms (11.3 MiB/s) 10319 bytes read in 19 ms (530.3 KiB/s) ## Booting kernel from Legacy Image at 4808 ... Image Name: XEN Image Type: AArch64 Linux Kernel Image (uncompressed) Data Size:819520 Bytes = 800.3 KiB Load Address: 7808 Entry Point: 7808 Verifying Checksum ... OK ## Flattened Device Tree blob at 4800 Booting using the fdt blob at 0x4800 Loading Kernel Image ... OK Using Device Tree in place at 4800, end 48012d9e Starting kernel ... - UART enabled - - CPU booting - - Current EL 0008 - - Xen starting at EL2 - - Zero BSS - - Setting up control registers - - Turning on paging - - Ready - (XEN) Checking for initrd in /chosen (XEN) RAM: 4800 - 7fff (XEN) RAM: 0005 - 00053fff (XEN) RAM: 0006 - 00063fff (XEN) RAM: 0007 - 00073fff (XEN) (XEN) MODULE[0]: 4800 - 4801 Device Tree (XEN) MODULE[1]: 7a00 - 7c00 Kernel (XEN) MODULE[2]: 7c00 - 7c01 XSM (XEN) RESVD[0]: 4800 - 4801 (XEN) (XEN) Command line: dom0_mem=512M console=dtuart dtuart=serial0 dom0_max_vcpus=1 bootscrub=0 flask_enforcing=1 (XEN) Placing Xen at 0x7fe0-0x8000 (XEN) Update BOOTMOD_XEN from 7808-78196e01 => 7fe0-7ff16e01 Which kernel version is it? After this, it hangs. What could be the possible reason? Xen will initialize the heap and then continue into the boot. I would add more debug around setup_mm to see where it failed. Regards, -- Julien Grall ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 2/7] xen/mce: remove unused x86_mcinfo_add()
>>> On 24.02.17 at 11:52, wrote: > c/s 9d13fd9fd320a7740c6446c048ff6a2990095966 turned to update the > mcinfo buffer in-place instead of using x86_mcinfo_add(). The last > uses of x86_mcinfo_add() were removed by that commit as well. > Therefore, x86_mcinfo_add() was deprecated in fact. > > Signed-off-by: Haozhong Zhang Reviewed-by: Jan Beulich ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 3/7] x86/mce: set mcinfo_comm.type and .size in x86_mcinfo_reserve()
>>> On 24.02.17 at 11:52, wrote: > All existing calls to x86_mcinfo_reserve() are followed by statements > that set the size and the type of the reserved space, so move them into > x86_mcinfo_reserve() to simplify the code. > > Signed-off-by: Haozhong Zhang Reviewed-by: Jan Beulich ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 5/7] x86/mce: clear MSR_IA32_MCG_STATUS by writing 0
>>> On 24.02.17 at 11:52, wrote: > On Intel CPU, an attemp to write to MSR_IA32_MCG_STATUS with any > non-zero value would result in #GP. > > This commit writes 0 on AMD CPU as well instead of just clearing MCIP > bit, because all non-reserved bits of MSR_IA32_MCG_STATUS have been > handled at this point. > > Signed-off-by: Haozhong Zhang Reviewed-by: Jan Beulich ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 4/7] x86/vmce: fill MSR_IA32_MCG_STATUS on all vcpus in broadcast case
>>> On 24.02.17 at 11:52, wrote: > The current implementation only fills MC MSRs on vcpu0 and leaves MC > MSRs on other vcpus empty in the broadcast case. When guest reads 0 > from MSR_IA32_MCG_STATUS on vcpuN (N > 0), it may think it's not > possible to recover the execution on that vcpu and then get panic, > although MSR_IA32_MCG_STATUS filled on vcpu0 may imply the injected > vMCE is actually recoverable. To avoid such unnecessary guest panic, > set MSR_IA32_MCG_STATUS on vcpuN (N > 0) to MCG_STATUS_MCIP|MCG_STATUS_RIPV. > > In addition, fill_vmsr_data(mc_bank, ...) is changed to return -EINVAL > rather than 0, if an invalid domain ID is contained in mc_bank. > > Signed-off-by: Haozhong Zhang Reviewed-by: Jan Beulich ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] Enabling #VE for a domain from dom0
On 24/02/17 14:42, Vlad-Ioan TOPAN wrote: >> #VE, by design, raises an exception in non-root context, without >> breaking out to the hypervisor. >> >> The vcpu in question needs to set up a suitable #VE handler, so it is >> not safe for an external entity to chose when a vcpu should start >> receiving #VE's. > The problem is that from a security solution standpoint, it isn't > feasible in a Windows guest to use libxc to enable #VE. As it is > implemented, libxc is required to allow sharing a structure between the > guest and the host; the structure only contains the gfn of the #VE page > and the domain id/vcpu id, which are useless since it can only be > enabled on the current VCPU. Would a patch providing a simpler VMCALL > (without sharing structures, only passing the gfn) to enable #VE be > acceptable? /sigh The underlying hypercall is HVMOP_altp2m, which is supposed to have a stable ABI, as it is guest visible. However, it has a HVMOP_ALTP2M_INTERFACE_VERSION wedged in there, which is unacceptable, and broken, as it cannot be used correctly from within a guest. The only option we have to is freeze HVMOP_ALTP2M_INTERFACE_VERSION at its current value and force it to never change. I am sorry for not having picked up on this point during review of the series several releases ago. However, for your purposes, you don't need libxc. You should just be able to make HVMOP hypercalls directly to set up #VE from within the guest. > Is there any reason for the other check I've mentioned, performed when > setting the "suppres #VE" bit in PTEs? Unsuppressing #VEs for a page > will only do anything if the guest has already enabled #VE, so the > previous issue doesn't apply in this case. suppress #VE has a negative meaning. Once #VE is enabled, all frames need SVE for Xen to continue getting EPT_VIOLATION vmexits per usual. It is only whitelisted frames which should have SVE cleared on them. Having said that, by the time you have cooperation between several domains, I don't see a reason for excluding a remote domain updating SVE. ~Andrew ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 0/3] x86: remove PVHv1
Hello, This patch series removes the PVHv1 code, both from the hypervisor and the tools, and also gets rid of the has_hvm_container_{domain/vcpu} macro, since from Xen's point of view there are only two types of guests: PV or HVM. Last patch is a minor code movement to have all the domain build PVH related functions together. Thanks, Roger. ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] Error in Xen while booting for salvator-X (M3 Board)
Hi, Not 100% sure, but anyway... Can you recheck after squashing all memory nodes to a single one. --- I guess, you have following in your device tree: memory@4800 { device_type = "memory"; /* first 128MB is reserved for secure area. */ reg = <0x0 0x4800 0x0 0x3800>; }; memory@5 { device_type = "memory"; reg = <0x5 0x 0x0 0x4000>; }; memory@6 { device_type = "memory"; reg = <0x6 0x 0x0 0x4000>; }; memory@7 { device_type = "memory"; reg = <0x7 0x 0x0 0x4000>; }; --- Try to make next: memory@4800 { device_type = "memory"; /* first 128MB is reserved for secure area. */ reg = <0x0 0x4800 0x0 0x3800>, <0x5 0x 0x0 0x4000>, <0x6 0x 0x0 0x4000>, <0x7 0x 0x0 0x4000>; }; On Fri, Feb 24, 2017 at 4:53 PM, Julien Grall wrote: > > > On 21/02/17 12:03, George John wrote: >> >> Hi, > > > Hello, > > >> I was trying out xen in salvator-X(M3 Board as described >> in >> https://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions/Salvator-X >> >> I ran in to following error: >> >> >> U-Boot 2015.04 (Feb 21 2017 - 14:24:48) >> >> CPU: Renesas Electronics R8A7796 rev 1.0 >> Board: Salvator-X >> I2C: ready >> DRAM: 3.9 GiB >> MMC: sh-sdhi: 0, sh-sdhi: 1, sh-sdhi: 2 >> In:serial >> Out: serial >> Err: serial >> Net: Board Net Initialization Failed >> No ethernet found. >> Hit any key to stop autoboot: 0 >> 819584 bytes read in 89 ms (8.8 MiB/s) >> 64927 bytes read in 23 ms (2.7 MiB/s) >> 14038016 bytes read in 1188 ms (11.3 MiB/s) >> 10319 bytes read in 19 ms (530.3 KiB/s) >> ## Booting kernel from Legacy Image at 4808 ... >>Image Name: XEN >>Image Type: AArch64 Linux Kernel Image (uncompressed) >>Data Size:819520 Bytes = 800.3 KiB >>Load Address: 7808 >>Entry Point: 7808 >>Verifying Checksum ... OK >> ## Flattened Device Tree blob at 4800 >>Booting using the fdt blob at 0x4800 >>Loading Kernel Image ... OK >>Using Device Tree in place at 4800, end 48012d9e >> >> Starting kernel ... >> >> - UART enabled - >> - CPU booting - >> - Current EL 0008 - >> - Xen starting at EL2 - >> - Zero BSS - >> - Setting up control registers - >> - Turning on paging - >> - Ready - >> (XEN) Checking for initrd in /chosen >> (XEN) RAM: 4800 - 7fff >> (XEN) RAM: 0005 - 00053fff >> (XEN) RAM: 0006 - 00063fff >> (XEN) RAM: 0007 - 00073fff >> (XEN) >> (XEN) MODULE[0]: 4800 - 4801 Device Tree >> (XEN) MODULE[1]: 7a00 - 7c00 Kernel >> (XEN) MODULE[2]: 7c00 - 7c01 XSM >> (XEN) RESVD[0]: 4800 - 4801 >> (XEN) >> (XEN) Command line: dom0_mem=512M console=dtuart dtuart=serial0 >> dom0_max_vcpus=1 bootscrub=0 flask_enforcing=1 >> (XEN) Placing Xen at 0x7fe0-0x8000 >> (XEN) Update BOOTMOD_XEN from 7808-78196e01 => >> 7fe0-7ff16e01 > > > Which kernel version is it? > >> >> >> >> >> >> >> After this, it hangs. What could be the possible reason? > > > Xen will initialize the heap and then continue into the boot. I would add > more debug around setup_mm to see where it failed. > > Regards, > > -- > Julien Grall > > ___ > Xen-devel mailing list > Xen-devel@lists.xen.org > https://lists.xen.org/xen-devel -- Regards, Oleksandr Tyshchenko ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 2/3] x86: remove has_hvm_container_{domain/vcpu}
It is now useless since PVHv1 is removed and PVHv2 is a HVM domain from Xen's point of view. Signed-off-by: Roger Pau Monné --- Cc: Christoph Egger Cc: Jan Beulich Cc: Andrew Cooper Cc: Boris Ostrovsky Cc: Suravee Suthikulpanit Cc: Jun Nakajima Cc: Kevin Tian Cc: Elena Ufimtseva Cc: George Dunlap Cc: Tim Deegan Cc: Konrad Rzeszutek Wilk --- xen/arch/x86/cpu/mcheck/vmce.c | 6 +++--- xen/arch/x86/cpu/vpmu.c | 4 ++-- xen/arch/x86/cpu/vpmu_amd.c | 12 ++-- xen/arch/x86/cpu/vpmu_intel.c | 31 +++ xen/arch/x86/cpuid.c| 2 +- xen/arch/x86/debug.c| 2 +- xen/arch/x86/domain.c | 28 ++-- xen/arch/x86/domain_build.c | 5 ++--- xen/arch/x86/domctl.c | 2 +- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/hvm.c | 6 +++--- xen/arch/x86/hvm/irq.c | 2 +- xen/arch/x86/hvm/mtrr.c | 2 +- xen/arch/x86/hvm/vmsi.c | 3 +-- xen/arch/x86/hvm/vmx/vmcs.c | 4 ++-- xen/arch/x86/hvm/vmx/vmx.c | 4 ++-- xen/arch/x86/mm.c | 4 ++-- xen/arch/x86/mm/paging.c| 2 +- xen/arch/x86/mm/shadow/common.c | 9 - xen/arch/x86/setup.c| 2 +- xen/arch/x86/time.c | 11 +-- xen/arch/x86/traps.c| 4 ++-- xen/arch/x86/x86_64/traps.c | 4 ++-- xen/drivers/passthrough/x86/iommu.c | 2 +- xen/include/asm-x86/domain.h| 2 +- xen/include/asm-x86/event.h | 2 +- xen/include/asm-x86/guest_access.h | 12 ++-- xen/include/asm-x86/hvm/hvm.h | 2 +- xen/include/xen/sched.h | 2 -- xen/include/xen/tmem_xen.h | 5 ++--- 30 files changed, 85 insertions(+), 93 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/vmce.c b/xen/arch/x86/cpu/mcheck/vmce.c index 8b727b4..6fb7833 100644 --- a/xen/arch/x86/cpu/mcheck/vmce.c +++ b/xen/arch/x86/cpu/mcheck/vmce.c @@ -82,7 +82,7 @@ int vmce_restore_vcpu(struct vcpu *v, const struct hvm_vmce_vcpu *ctxt) { dprintk(XENLOG_G_ERR, "%s restore: unsupported MCA capabilities" " %#" PRIx64 " for %pv (supported: %#Lx)\n", -has_hvm_container_vcpu(v) ? "HVM" : "PV", ctxt->caps, +is_hvm_vcpu(v) ? "HVM" : "PV", ctxt->caps, v, guest_mcg_cap & ~MCG_CAP_COUNT); return -EPERM; } @@ -364,7 +364,7 @@ int inject_vmce(struct domain *d, int vcpu) if ( !v->is_initialised ) continue; -if ( (has_hvm_container_domain(d) || +if ( (is_hvm_domain(d) || guest_has_trap_callback(d, v->vcpu_id, TRAP_machine_check)) && !test_and_set_bool(v->mce_pending) ) { @@ -444,7 +444,7 @@ int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn) if ( !mfn_valid(mfn) ) return -EINVAL; -if ( !has_hvm_container_domain(d) || !paging_mode_hap(d) ) +if ( !is_hvm_domain(d) || !paging_mode_hap(d) ) return -EOPNOTSUPP; rc = -1; diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c index d319dea..5b1e0ec 100644 --- a/xen/arch/x86/cpu/vpmu.c +++ b/xen/arch/x86/cpu/vpmu.c @@ -237,7 +237,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs) vpmu->arch_vpmu_ops->arch_vpmu_save(sampling, 1); vpmu_reset(vpmu, VPMU_CONTEXT_SAVE | VPMU_CONTEXT_LOADED); -if ( has_hvm_container_vcpu(sampled) ) +if ( is_hvm_vcpu(sampled) ) *flags = 0; else *flags = PMU_SAMPLE_PV; @@ -288,7 +288,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs) r->sp = cur_regs->rsp; r->flags = cur_regs->rflags; -if ( !has_hvm_container_vcpu(sampled) ) +if ( !is_hvm_vcpu(sampled) ) { r->ss = cur_regs->ss; r->cs = cur_regs->cs; diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c index e0acbf4..b3c3697 100644 --- a/xen/arch/x86/cpu/vpmu_amd.c +++ b/xen/arch/x86/cpu/vpmu_amd.c @@ -305,8 +305,8 @@ static int amd_vpmu_save(struct vcpu *v, bool_t to_guest) context_save(v); -if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && - has_hvm_container_vcpu(v) && is_msr_bitmap_on(vpmu) ) +if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && is_hvm_vcpu(v) && + is_msr_bitmap_on(vpmu) ) amd_vpmu_unset_msr_bitmap(v); if ( to_guest ) @@ -367,7 +367,7 @@ static int amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content, return -EINVAL; /* For all counters, enable guest only mode for HVM guest */ -if ( has_hvm_container_vcpu(v) && (type == MSR_TYPE_CTRL) && +if ( is_hvm_vcpu(v) && (type == MSR_TYPE_CTRL) && !is_guest_mode(msr_content) ) { set_guest_mode(msr_content); @@ -381,7 +381,7 @@ static int amd_vpmu_do_wrmsr(u
[Xen-devel] [PATCH 1/3] x86: remove PVHv1 code
This removal applies to both the hypervisor and the toolstack side of PVHv1. Note that on the toolstack side there's one hiccup: on xl the "pvh" configuration option is translated to builder="hvm", device_model_version="none". This is done because otherwise xl would start parsing PV like options, and filling the PV struct at libxl_domain_build_info (which in turn pollutes the HVM one because it's a union). Signed-off-by: Roger Pau Monné --- Cc: Ian Jackson Cc: Wei Liu Cc: Elena Ufimtseva Cc: Jan Beulich Cc: Andrew Cooper Cc: Paul Durrant Cc: Jun Nakajima Cc: Kevin Tian Cc: George Dunlap Cc: Razvan Cojocaru Cc: Tamas K Lengyel --- docs/man/xl.cfg.pod.5.in | 10 +- docs/misc/pvh-readme.txt | 63 - tools/debugger/gdbsx/xg/xg_main.c | 4 +- tools/libxc/include/xc_dom.h | 1 - tools/libxc/include/xenctrl.h | 2 +- tools/libxc/xc_cpuid_x86.c| 13 +- tools/libxc/xc_dom_core.c | 9 -- tools/libxc/xc_dom_x86.c | 49 +++ tools/libxc/xc_domain.c | 1 - tools/libxl/libxl_create.c| 31 ++-- tools/libxl/libxl_dom.c | 1 - tools/libxl/libxl_internal.h | 1 - tools/libxl/libxl_x86.c | 7 +- tools/xl/xl_cmdimpl.c | 10 +- xen/arch/x86/cpu/vpmu.c | 3 +- xen/arch/x86/cpuid.c | 211 ++-- xen/arch/x86/domain.c | 42 +- xen/arch/x86/domain_build.c | 287 +- xen/arch/x86/domctl.c | 7 +- xen/arch/x86/hvm/hvm.c| 81 +-- xen/arch/x86/hvm/hypercall.c | 4 +- xen/arch/x86/hvm/io.c | 2 - xen/arch/x86/hvm/ioreq.c | 3 +- xen/arch/x86/hvm/irq.c| 3 - xen/arch/x86/hvm/vmx/vmcs.c | 35 + xen/arch/x86/hvm/vmx/vmx.c| 12 +- xen/arch/x86/mm.c | 2 +- xen/arch/x86/mm/p2m-pt.c | 2 +- xen/arch/x86/mm/p2m.c | 6 +- xen/arch/x86/physdev.c| 8 -- xen/arch/x86/setup.c | 7 - xen/arch/x86/time.c | 27 xen/common/domain.c | 2 - xen/common/domctl.c | 10 -- xen/common/kernel.c | 5 - xen/common/vm_event.c | 8 +- xen/include/asm-x86/domain.h | 1 - xen/include/asm-x86/hvm/hvm.h | 3 - xen/include/public/domctl.h | 12 +- xen/include/xen/sched.h | 9 +- 40 files changed, 196 insertions(+), 798 deletions(-) delete mode 100644 docs/misc/pvh-readme.txt diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in index 505c111..da1fdd7 100644 --- a/docs/man/xl.cfg.pod.5.in +++ b/docs/man/xl.cfg.pod.5.in @@ -1064,6 +1064,12 @@ FIFO-based event channel ABI support up to 131,071 event channels. Other guests are limited to 4095 (64-bit x86 and ARM) or 1023 (32-bit x86). +=item B + +Selects whether to run this PV guest in an HVM container. Default is 0. +Note that this option is equivalent to setting builder="hvm" and +device_model_version="none" + =back =head2 Paravirtualised (PV) Guest Specific Options @@ -1108,10 +1114,6 @@ if your particular guest kernel does not require this behaviour then it is safe to allow this to be enabled but you may wish to disable it anyway. -=item B - -Selects whether to run this PV guest in an HVM container. Default is 0. - =back =head2 Fully-virtualised (HVM) Guest Specific Options diff --git a/docs/misc/pvh-readme.txt b/docs/misc/pvh-readme.txt deleted file mode 100644 index c5b3de4..000 --- a/docs/misc/pvh-readme.txt +++ /dev/null @@ -1,63 +0,0 @@ - -PVH : an x86 PV guest running in an HVM container. - -See: http://blog.xen.org/index.php/2012/10/23/the-paravirtualization-spectrum-part-1-the-ends-of-the-spectrum/ - -At the moment HAP is required for PVH. - -At present the only PVH guest is an x86 64bit PV linux. Patches are at: - git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git - -A PVH guest kernel must support following features, as defined for linux -in arch/x86/xen/xen-head.S: - - #define FEATURES_PVH "|writable_descriptor_tables" \ -"|auto_translated_physmap"\ -"|supervisor_mode_kernel" \ -"|hvm_callback_vector" - -In a nutshell: -* the guest uses auto translate: - - p2m is managed by xen - - pagetables are owned by the guest - - mmu_update hypercall not available -* it uses event callback and not vlapic emulation, -* IDT is native, so set_trap_table hcall is also N/A for a PVH guest. - -For a full list of hcalls supported for PVH, see pvh_hypercall64_table -in arch/x86/hvm/hvm.c in xen. From the ABI prespective, it's mostly a -PV guest with auto translate, although it does use hvm_op for setting -callback vector, and has a special version of arch_set_guest_info for bringing -up secondary cpus. - -The initial phase targets the booting of a 64bit UP/SMP l
[Xen-devel] [PATCH 3/3] x86/PVHv2: move pvh_setup_e820 together with the other pvh functions
This function is only used by PVHv2 domain build, so move it together with the other PVH domain build functions. Just code motion, no functional change. Signed-off-by: Roger Pau Monné --- Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/domain_build.c | 134 ++-- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c index b7d920a..aa40c79 100644 --- a/xen/arch/x86/domain_build.c +++ b/xen/arch/x86/domain_build.c @@ -470,73 +470,6 @@ static void __init process_dom0_ioports_disable(struct domain *dom0) } } -static __init void pvh_setup_e820(struct domain *d, unsigned long nr_pages) -{ -struct e820entry *entry, *entry_guest; -unsigned int i; -unsigned long pages, cur_pages = 0; -uint64_t start, end; - -/* - * Craft the e820 memory map for Dom0 based on the hardware e820 map. - */ -d->arch.e820 = xzalloc_array(struct e820entry, e820.nr_map); -if ( !d->arch.e820 ) -panic("Unable to allocate memory for Dom0 e820 map"); -entry_guest = d->arch.e820; - -/* Clamp e820 memory map to match the memory assigned to Dom0 */ -for ( i = 0, entry = e820.map; i < e820.nr_map; i++, entry++ ) -{ -if ( entry->type != E820_RAM ) -{ -*entry_guest = *entry; -goto next; -} - -if ( nr_pages == cur_pages ) -{ -/* - * We already have all the assigned memory, - * skip this entry - */ -continue; -} - -/* - * Make sure the start and length are aligned to PAGE_SIZE, because - * that's the minimum granularity of the 2nd stage translation. Since - * the p2m code uses PAGE_ORDER_4K internally, also use it here in - * order to prevent this code from getting out of sync. - */ -start = ROUNDUP(entry->addr, PAGE_SIZE << PAGE_ORDER_4K); -end = (entry->addr + entry->size) & - ~((PAGE_SIZE << PAGE_ORDER_4K) - 1); -if ( start >= end ) -continue; - -entry_guest->type = E820_RAM; -entry_guest->addr = start; -entry_guest->size = end - start; -pages = PFN_DOWN(entry_guest->size); -if ( (cur_pages + pages) > nr_pages ) -{ -/* Truncate region */ -entry_guest->size = (nr_pages - cur_pages) << PAGE_SHIFT; -cur_pages = nr_pages; -} -else -{ -cur_pages += pages; -} - next: -d->arch.nr_e820++; -entry_guest++; -} -ASSERT(cur_pages == nr_pages); -ASSERT(d->arch.nr_e820 <= e820.nr_map); -} - static __init void dom0_update_physmap(struct domain *d, unsigned long pfn, unsigned long mfn, unsigned long vphysmap_s) { @@ -1685,6 +1618,73 @@ static void __init pvh_steal_low_ram(struct domain *d, unsigned long start, } } +static __init void pvh_setup_e820(struct domain *d, unsigned long nr_pages) +{ +struct e820entry *entry, *entry_guest; +unsigned int i; +unsigned long pages, cur_pages = 0; +uint64_t start, end; + +/* + * Craft the e820 memory map for Dom0 based on the hardware e820 map. + */ +d->arch.e820 = xzalloc_array(struct e820entry, e820.nr_map); +if ( !d->arch.e820 ) +panic("Unable to allocate memory for Dom0 e820 map"); +entry_guest = d->arch.e820; + +/* Clamp e820 memory map to match the memory assigned to Dom0 */ +for ( i = 0, entry = e820.map; i < e820.nr_map; i++, entry++ ) +{ +if ( entry->type != E820_RAM ) +{ +*entry_guest = *entry; +goto next; +} + +if ( nr_pages == cur_pages ) +{ +/* + * We already have all the assigned memory, + * skip this entry + */ +continue; +} + +/* + * Make sure the start and length are aligned to PAGE_SIZE, because + * that's the minimum granularity of the 2nd stage translation. Since + * the p2m code uses PAGE_ORDER_4K internally, also use it here in + * order to prevent this code from getting out of sync. + */ +start = ROUNDUP(entry->addr, PAGE_SIZE << PAGE_ORDER_4K); +end = (entry->addr + entry->size) & + ~((PAGE_SIZE << PAGE_ORDER_4K) - 1); +if ( start >= end ) +continue; + +entry_guest->type = E820_RAM; +entry_guest->addr = start; +entry_guest->size = end - start; +pages = PFN_DOWN(entry_guest->size); +if ( (cur_pages + pages) > nr_pages ) +{ +/* Truncate region */ +entry_guest->size = (nr_pages - cur_pages) << PAGE_SHIFT; +cur_pages = nr_pages; +} +else +{ +cur_pages += pages; +} + next: +d->arch.nr_e8
[Xen-devel] [libvirt test] 106048: trouble: blocked/broken/fail/pass
flight 106048 libvirt real [real] http://logs.test-lab.xenproject.org/osstest/logs/106048/ Failures and problems with tests :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-i386-libvirt 3 host-install(3)broken REGR. vs. 105973 Regressions which are regarded as allowable (not blocking): test-armhf-armhf-libvirt 13 saverestore-support-checkfail like 105973 test-armhf-armhf-libvirt-xsm 13 saverestore-support-checkfail like 105973 test-armhf-armhf-libvirt-raw 12 saverestore-support-checkfail like 105973 Tests which did not succeed, but are not blocking: test-arm64-arm64-libvirt-xsm 1 build-check(1) blocked n/a build-arm64-libvirt 1 build-check(1) blocked n/a test-arm64-arm64-libvirt-qcow2 1 build-check(1) blocked n/a test-arm64-arm64-libvirt 1 build-check(1) blocked n/a test-amd64-amd64-libvirt 12 migrate-support-checkfail never pass test-amd64-i386-libvirt-xsm 12 migrate-support-checkfail never pass test-amd64-amd64-libvirt-xsm 12 migrate-support-checkfail never pass build-arm64 5 xen-buildfail never pass build-arm64-xsm 5 xen-buildfail never pass test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check fail never pass test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check fail never pass build-arm64-pvops 5 kernel-build fail never pass test-amd64-amd64-libvirt-vhd 11 migrate-support-checkfail never pass test-armhf-armhf-libvirt 12 migrate-support-checkfail never pass test-armhf-armhf-libvirt-xsm 12 migrate-support-checkfail never pass test-armhf-armhf-libvirt-raw 11 migrate-support-checkfail never pass version targeted for testing: libvirt eca76884ea7f75fb1dd015337ed1f5039b5b6c56 baseline version: libvirt 5ad03b9db2186d5b1d09f33e5ab0daa683054675 Last test of basis 105973 2017-02-22 04:20:09 Z2 days Failing since106006 2017-02-23 04:20:53 Z1 days2 attempts Testing same since 106048 2017-02-24 04:20:04 Z0 days1 attempts People who touched revisions under test: Andrea Bolognani Daniel P. Berrange Jiri Denemark John Ferlan Marc Hartmayer Michal Privoznik Nikolay Shirokovskiy Peter Krempa Tomáš Golembiovský jobs: build-amd64-xsm pass build-arm64-xsm fail build-armhf-xsm pass build-i386-xsm pass build-amd64 pass build-arm64 fail build-armhf pass build-i386 pass build-amd64-libvirt pass build-arm64-libvirt blocked build-armhf-libvirt pass build-i386-libvirt pass build-amd64-pvopspass build-arm64-pvopsfail build-armhf-pvopspass build-i386-pvops pass test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm pass test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsmpass test-amd64-amd64-libvirt-xsm pass test-arm64-arm64-libvirt-xsm blocked test-armhf-armhf-libvirt-xsm pass test-amd64-i386-libvirt-xsm pass test-amd64-amd64-libvirt pass test-arm64-arm64-libvirt blocked test-armhf-armhf-libvirt pass test-amd64-i386-libvirt broken test-amd64-amd64-libvirt-pairpass test-amd64-i386-libvirt-pair pass test-arm64-arm64-libvirt-qcow2 blocked test-armhf-armhf-libvirt-raw pass test-amd64-amd64-libvirt-vhd pass sg-report-flight on osstest.test-lab.xenproject.org logs: /home/logs/logs images: /home/logs/images Logs, config files, et
Re: [Xen-devel] [PATCH 6/7] xen/mce: make ASSERT's about mce_dhandler_num in mce_action() Intel only
>>> On 24.02.17 at 11:52, wrote: > --- a/xen/arch/x86/cpu/mcheck/mce.c > +++ b/xen/arch/x86/cpu/mcheck/mce.c > @@ -1621,8 +1621,8 @@ static enum mce_result mce_action(const struct > cpu_user_regs *regs, > handlers = mce_uhandlers; > } > > -/* At least a default handler should be registerd */ > -ASSERT(handler_num); > +/* At least a default handler should be registered for Intel CPU. */ > +ASSERT(handler_num || boot_cpu_data.x86_vendor != X86_VENDOR_INTEL); > > local_mi = (struct mc_info*)mctelem_dataptr(mctc); > x86_mcinfo_lookup(mic, local_mi, MC_TYPE_GLOBAL); > @@ -1656,7 +1656,8 @@ static enum mce_result mce_action(const struct > cpu_user_regs *regs, > break; > } > } > -ASSERT(i != handler_num); > +ASSERT(i != handler_num || > + boot_cpu_data.x86_vendor != X86_VENDOR_INTEL); > } > > return worst_result; I think both ASSERT()s should simply be removed: The code is fine with the conditions they check violated, and debug builds can't have worked due to their presence on AMD at all (yet production builds would have been fine). Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [qemu-mainline test] 106047: trouble: blocked/broken/fail/pass
flight 106047 qemu-mainline real [real] http://logs.test-lab.xenproject.org/osstest/logs/106047/ Failures and problems with tests :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-amd64-qemuu-nested-intel 3 host-install(3) broken REGR. vs. 105962 test-amd64-amd64-xl-qemuu-debianhvm-amd64-xsm 3 host-install(3) broken REGR. vs. 105962 test-amd64-i386-freebsd10-amd64 3 host-install(3) broken REGR. vs. 105962 test-amd64-amd64-xl-qemuu-winxpsp3 3 host-install(3) broken REGR. vs. 105962 test-amd64-amd64-pygrub 3 host-install(3)broken REGR. vs. 105962 Regressions which are regarded as allowable (not blocking): test-armhf-armhf-libvirt 13 saverestore-support-checkfail like 105962 test-armhf-armhf-libvirt-xsm 13 saverestore-support-checkfail like 105962 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stopfail like 105962 test-armhf-armhf-libvirt-raw 12 saverestore-support-checkfail like 105962 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail like 105962 test-amd64-amd64-xl-rtds 9 debian-install fail like 105962 Tests which did not succeed, but are not blocking: test-arm64-arm64-libvirt-xsm 1 build-check(1) blocked n/a test-arm64-arm64-xl 1 build-check(1) blocked n/a build-arm64-libvirt 1 build-check(1) blocked n/a test-arm64-arm64-libvirt-qcow2 1 build-check(1) blocked n/a test-arm64-arm64-libvirt 1 build-check(1) blocked n/a test-arm64-arm64-xl-credit2 1 build-check(1) blocked n/a test-arm64-arm64-xl-rtds 1 build-check(1) blocked n/a test-arm64-arm64-xl-multivcpu 1 build-check(1) blocked n/a test-arm64-arm64-xl-xsm 1 build-check(1) blocked n/a test-amd64-amd64-xl-pvh-amd 11 guest-start fail never pass test-amd64-amd64-libvirt 12 migrate-support-checkfail never pass test-amd64-amd64-xl-pvh-intel 11 guest-start fail never pass test-amd64-amd64-libvirt-xsm 12 migrate-support-checkfail never pass test-amd64-i386-libvirt-xsm 12 migrate-support-checkfail never pass test-amd64-i386-libvirt 12 migrate-support-checkfail never pass build-arm64 5 xen-buildfail never pass test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check fail never pass build-arm64-xsm 5 xen-buildfail never pass test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check fail never pass test-armhf-armhf-xl-arndale 12 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 13 saverestore-support-checkfail never pass build-arm64-pvops 5 kernel-build fail never pass test-amd64-amd64-qemuu-nested-amd 16 debian-hvm-install/l1/l2 fail never pass test-armhf-armhf-xl 12 migrate-support-checkfail never pass test-armhf-armhf-xl 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-xsm 12 migrate-support-checkfail never pass test-armhf-armhf-xl-xsm 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit2 12 migrate-support-checkfail never pass test-armhf-armhf-libvirt 12 migrate-support-checkfail never pass test-armhf-armhf-xl-credit2 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-cubietruck 12 migrate-support-checkfail never pass test-armhf-armhf-xl-cubietruck 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-multivcpu 12 migrate-support-checkfail never pass test-armhf-armhf-xl-multivcpu 13 saverestore-support-checkfail never pass test-armhf-armhf-libvirt-xsm 12 migrate-support-checkfail never pass test-amd64-amd64-libvirt-vhd 11 migrate-support-checkfail never pass test-armhf-armhf-libvirt-raw 11 migrate-support-checkfail never pass test-armhf-armhf-xl-rtds 12 migrate-support-checkfail never pass test-armhf-armhf-xl-rtds 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-vhd 11 migrate-support-checkfail never pass test-armhf-armhf-xl-vhd 12 saverestore-support-checkfail never pass version targeted for testing: qemuu10f25e4844cb9b3f02fb032f88051dd5b65b4206 baseline version: qemuu796b288f7be875045670f963ce1b3c8e96ac Last test of basis 105962 2017-02-21 20:42:52 Z2 days Failing since106014 2017-02-23 10:13:03 Z1 days2 attempts Testing same since 106047 2017-02-24 03:54:54 Z0 days1 attempts People who touched revisions under test: David Gibson D
Re: [Xen-devel] [PATCH v2 2/3] xen/x86: ensure copying to L1 guest in update_secondary_system_time()
>>> On 23.02.17 at 10:41, wrote: > @@ -992,10 +993,30 @@ bool_t update_secondary_system_time(struct vcpu *v, > { > XEN_GUEST_HANDLE(vcpu_time_info_t) user_u = v->arch.time_info_guest; > smap_check_policy_t saved_policy; > +bool nested_guest_mode = false; > > if ( guest_handle_is_null(user_u) ) > return 1; > > +/* > + * Must be before all following __copy_field_to_guest() and > + * __copy_to_guest(). > + * > + * Otherwise, if 'v' is in the nested guest mode, paging_gva_to_gfn() > called > + * from __copy_field_to_guest() and __copy_to_guest() will treat the > target > + * address as L2 gva, and __copy_field_to_guest() and __copy_to_guest() > will > + * consequently copy runstate to L2 guest rather than L1 guest. > + * > + * Therefore, we clear the nested guest flag before > __copy_field_to_guest() > + * and __copy_to_guest(), and restore the flag after all guest copy. > + */ > +if ( nestedhvm_enabled(v->domain) ) > +{ > +nested_guest_mode = nestedhvm_is_n2(v); > +if ( nested_guest_mode ) > +nestedhvm_vcpu_exit_guestmode(v); > +} > + > saved_policy = smap_policy_change(v, SMAP_CHECK_ENABLED); > > /* 1. Update userspace version. */ There is an early exit path right below here. Taking this together with the code and comment redundancy with patch 1, this is a pretty clear sign that you want to rename smap_policy_change() and use the new function, taking care of both issues, in both code paths. Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v2 3/3] x86/hvm: check HAP before enabling nested VMX
>>> On 23.02.17 at 10:41, wrote: > The current implementation of nested VMX cannot work without HAP. Of course the better route would be to fix the actual problem, the more that - according to other feedback you've got elsewhere - this apparently is a regression. Nevertheless I can see you perhaps not having the time to do so, so as a band aid it's likely fine. However ... > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -4123,7 +4123,7 @@ static int hvmop_set_param( > * Remove the check below once we have > * shadow-on-shadow. > */ > -if ( cpu_has_svm && !paging_mode_hap(d) && a.value ) > +if ( (cpu_has_svm || cpu_has_vmx) && !paging_mode_hap(d) && a.value ) ... you want to simply drop the cpu_has_svm check here instead of adding to it, as with neither SVM nor VMX available execution will never come here. Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [linux-linus test] 106009: regressions - trouble: blocked/broken/fail/pass
Boris Ostrovsky writes ("Re: [Xen-devel] [linux-linus test] 106009: regressions - trouble: blocked/broken/fail/pass"): > Can you change PVH test to use > device_model_version="none" > instead of > pvh=1 I had this conversation with Roger and we seem to have concluded that `pvh=1' should be repurposed to mean PVHv2. Of course we should force push the removal of PVHv1, as applicable. Ian. ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 3/3] x86/PVHv2: move pvh_setup_e820 together with the other pvh functions
>>> On 24.02.17 at 16:13, wrote: > This function is only used by PVHv2 domain build, so move it together with the > other PVH domain build functions. > > Just code motion, no functional change. > > Signed-off-by: Roger Pau Monné Acked-by: Jan Beulich ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 1/3] x86: remove PVHv1 code
On 24/02/17 15:13, Roger Pau Monne wrote: > diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h > index 85cbb7c..65b7475 100644 > --- a/xen/include/public/domctl.h > +++ b/xen/include/public/domctl.h > @@ -60,11 +60,8 @@ struct xen_domctl_createdomain { > /* Disable out-of-sync shadow page tables? */ > #define _XEN_DOMCTL_CDF_oos_off 3 > #define XEN_DOMCTL_CDF_oos_off(1U<<_XEN_DOMCTL_CDF_oos_off) > - /* Is this a PVH guest (as opposed to an HVM or PV guest)? */ > -#define _XEN_DOMCTL_CDF_pvh_guest 4 > -#define XEN_DOMCTL_CDF_pvh_guest (1U<<_XEN_DOMCTL_CDF_pvh_guest) > /* Is this a xenstore domain? */ > -#define _XEN_DOMCTL_CDF_xs_domain 5 > +#define _XEN_DOMCTL_CDF_xs_domain 4 > #define XEN_DOMCTL_CDF_xs_domain (1U<<_XEN_DOMCTL_CDF_xs_domain) > uint32_t flags; > struct xen_arch_domainconfig config; > @@ -97,14 +94,11 @@ struct xen_domctl_getdomaininfo { > /* Being debugged. */ > #define _XEN_DOMINF_debugged 6 > #define XEN_DOMINF_debugged (1U<<_XEN_DOMINF_debugged) > -/* domain is PVH */ > -#define _XEN_DOMINF_pvh_guest 7 > -#define XEN_DOMINF_pvh_guest (1U<<_XEN_DOMINF_pvh_guest) > /* domain is a xenstore domain */ > -#define _XEN_DOMINF_xs_domain 8 > +#define _XEN_DOMINF_xs_domain 7 > #define XEN_DOMINF_xs_domain (1U<<_XEN_DOMINF_xs_domain) > /* domain has hardware assisted paging */ > -#define _XEN_DOMINF_hap 9 > +#define _XEN_DOMINF_hap 8 > #define XEN_DOMINF_hap(1U<<_XEN_DOMINF_hap) > /* XEN_DOMINF_shutdown guest-supplied code. */ > #define XEN_DOMINF_shutdownmask 255 > It would probably be better to leave holes in the bitfield space here, given that it is in the public interface. ~Andrew ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 2/3] x86: remove has_hvm_container_{domain/vcpu}
On 24/02/17 15:13, Roger Pau Monne wrote: > It is now useless since PVHv1 is removed and PVHv2 is a HVM domain from Xen's > point of view. > > Signed-off-by: Roger Pau Monné Reviewed-by: Andrew Cooper ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 1/3] x86: remove PVHv1 code
On 24/02/17 15:13, Roger Pau Monne wrote: > diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c > index 66b7aba..fa601da 100644 > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c > @@ -62,10 +62,6 @@ integer_param("maxcpus", max_cpus); > > unsigned long __read_mostly cr4_pv32_mask; > > -/* Boot dom0 in pvh mode */ > -static bool_t __initdata opt_dom0pvh; > -boolean_param("dom0pvh", opt_dom0pvh); > - Please edit docs/misc/xen-command-line.markdown as well. ~Andrew ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v3 1/2] x86/vpmu: Add get/put_vpmu() and VPMU_AVAILABLE
>>> On 22.02.17 at 19:24, wrote: > vpmu_enabled() (used by hvm/pv_cpuid() to properly report 0xa leaf > for Intel processors) is based on the value of VPMU_CONTEXT_ALLOCATED > bit. This is problematic: > * For HVM guests VPMU context is allocated lazily, during the first > access to VPMU MSRs. Since the leaf is typically queried before guest > attempts to read or write the MSRs it is likely that CPUID will report > no PMU support > * For PV guests the context is allocated eagerly but only in responce to > guest's XENPMU_init hypercall. There is a chance that the guest will > try to read CPUID before making this hypercall. > > This patch introduces VPMU_AVAILABLE flag which is set (subject to vpmu_mode > constraints) during VCPU initialization for both PV and HVM guests. Since > this flag is expected to be managed together with vpmu_count, get/put_vpmu() > are added to simplify code. > > vpmu_enabled() (renamed to vpmu_available()) can now use this new flag. > > (As a side affect this patch also fixes a race in pvpmu_init() where we > increment vcpu_count in vpmu_initialise() after checking vpmu_mode) > > Signed-off-by: Boris Ostrovsky Acked-by: Jan Beulich ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v3 2/2] x86/vpmu: Disable VPMU if guest's CPUID indicates no PMU support
>>> On 22.02.17 at 19:24, wrote: > When toolstack overrides Intel CPUID leaf 0xa's PMU version with an > invalid value VPMU should not be available to the guest. > > Signed-off-by: Boris Ostrovsky Reviewed-by: Jan Beulich with one nit: > --- a/xen/arch/x86/domctl.c > +++ b/xen/arch/x86/domctl.c > @@ -253,6 +253,20 @@ static int update_domain_cpuid_info(struct domain *d, > } > break; > > +case 0xa: > +if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) > +break; > + > +/* If PMU version is zero then the guest doesn't have VPMU */ > +if ( p->basic.pmu_version == 0 ) > +{ > +struct vcpu *v; > + > +for_each_vcpu( d, v ) If you use blanks immediately inside the parentheses, there should also be one immediately before the opening one. Can be corrected upon commit of course. Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 2/3] x86: remove has_hvm_container_{domain/vcpu}
At 15:13 + on 24 Feb (1487949198), Roger Pau Monne wrote: > It is now useless since PVHv1 is removed and PVHv2 is a HVM domain from Xen's > point of view. > > Signed-off-by: Roger Pau Monné Acked-by: Tim Deegan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 1/3] x86: remove PVHv1 code
>>> On 24.02.17 at 16:32, wrote: > On 24/02/17 15:13, Roger Pau Monne wrote: >> diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h >> index 85cbb7c..65b7475 100644 >> --- a/xen/include/public/domctl.h >> +++ b/xen/include/public/domctl.h >> @@ -60,11 +60,8 @@ struct xen_domctl_createdomain { >> /* Disable out-of-sync shadow page tables? */ >> #define _XEN_DOMCTL_CDF_oos_off 3 >> #define XEN_DOMCTL_CDF_oos_off(1U<<_XEN_DOMCTL_CDF_oos_off) >> - /* Is this a PVH guest (as opposed to an HVM or PV guest)? */ >> -#define _XEN_DOMCTL_CDF_pvh_guest 4 >> -#define XEN_DOMCTL_CDF_pvh_guest (1U<<_XEN_DOMCTL_CDF_pvh_guest) >> /* Is this a xenstore domain? */ >> -#define _XEN_DOMCTL_CDF_xs_domain 5 >> +#define _XEN_DOMCTL_CDF_xs_domain 4 >> #define XEN_DOMCTL_CDF_xs_domain (1U<<_XEN_DOMCTL_CDF_xs_domain) >> uint32_t flags; >> struct xen_arch_domainconfig config; >> @@ -97,14 +94,11 @@ struct xen_domctl_getdomaininfo { >> /* Being debugged. */ >> #define _XEN_DOMINF_debugged 6 >> #define XEN_DOMINF_debugged (1U<<_XEN_DOMINF_debugged) >> -/* domain is PVH */ >> -#define _XEN_DOMINF_pvh_guest 7 >> -#define XEN_DOMINF_pvh_guest (1U<<_XEN_DOMINF_pvh_guest) >> /* domain is a xenstore domain */ >> -#define _XEN_DOMINF_xs_domain 8 >> +#define _XEN_DOMINF_xs_domain 7 >> #define XEN_DOMINF_xs_domain (1U<<_XEN_DOMINF_xs_domain) >> /* domain has hardware assisted paging */ >> -#define _XEN_DOMINF_hap 9 >> +#define _XEN_DOMINF_hap 8 >> #define XEN_DOMINF_hap(1U<<_XEN_DOMINF_hap) >> /* XEN_DOMINF_shutdown guest-supplied code. */ >> #define XEN_DOMINF_shutdownmask 255 >> > > It would probably be better to leave holes in the bitfield space here, > given that it is in the public interface. Or else the domctl interface version would need to be bumped. Or perhaps it needs to be in any case with such a removal. Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [RFC 01/16] docs: create Memory Bandwidth Allocation (MBA) feature document.
>> > + System administrator can change PSR allocation policy at runtime by >> > + tool stack. Since MBA shares COS with CAT/CDP, a COS corresponds to a >> > + 2-tuple, like [CBM, Thrtl] with only-CAT enalbed, when CDP is enable, >> > + the COS corresponds to a 3-tuple, like [Code_CBM, Data_CBM, Thrtl]. If >> > + neither CAT nor CDP is enabled, things would be easier, one COS >> > + corresponds to one Thrtl. >> >> How many bits in Thrtl field? >> Is it decided by the hardware type? >> > This is defined in SDM. > "The definition for the MBA delay value MSRs is provided in Figure 17.39. The > lower 16 bits are used for MBA delay values, and values from zero to the > maximum > from the CPUID MBA_MAX-1 value are supported." > > Please note, MBA value is different with CBM. You do not need care the bits. > >> > +# References >> > + >> > +"INTEL® RESOURCE DIRECTOR TECHNOLOGY (INTEL® RDT) ALLOCATION FEATURES" >> > [Intel® 64 and IA-32 Architectures Software Developer Manuals, >> > vol3](http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html) >> > + >> >> I checked the document. The CAT is in Chapter 17.17. However, there is >> no description about the MBA? ;-) > Have you downloaded latest SDM? 17.18.7 is for MBA. Ah-ha, I saw it now. I guess I downloaded the old version. :-) I found this MBA feature is interesting. Is there any processor on the market we can purchase? We'd like to evaluate this feature. ;-) Thanks, Meng --- Meng Xu PhD Student in Computer and Information Science University of Pennsylvania http://www.cis.upenn.edu/~mengxu/ ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH] build: add --with-rundir option to configure
On 2/22/17 5:37 AM, Wei Liu wrote: > On Wed, Feb 22, 2017 at 08:53:24AM +0100, Juergen Gross wrote: >> On 20/02/17 16:19, Andrew Cooper wrote: >>> On 20/02/17 14:43, Juergen Gross wrote: On 20/02/17 15:31, Wei Liu wrote: > On Thu, Feb 16, 2017 at 08:47:07AM +0100, Juergen Gross wrote: >> There have been reports that Fedora 25 uses /run instead of /var/run. >> >> Add a --with-rundir option ito configure to be able to specify that > I've read this thread but I'm not sure if I need to take any action or > all the comments addressed -- especially the part about autoconf. Andrew, are you fine with my answer regarding autoconf? Or do you have some information regarding --runstatedir which could help? >>> >>> Oh sorry. Didn't realise I was blocking here. I have no specific >>> information, other than the quick search I did. >>> >>> Can't the future problem be worked around just with if autoconf version >>> < 2.70 ? >> >> I don't think it is possible to add configure options other than >> --disable-*, --enable-*, --with-* or --without-* by other means than >> patching general.m4 of autoconf. I don't think we want to do that. >> >> So the possibilities are: >> >> 1. don't support /run instead of /var/run via configure >> 2. patch autoconf to support --runstatedir >> 3. take this patch adding support via --with-rundir and possibly >>switch over to --runstatedir when a new autoconf version is >>available > > Option 3 but we need to have that for eternity. :-) > > Wei. Cause --runstatedir will never rear its head I believe I proposed --runstatedir 3+ years ago (I can't recall how long ago) and the maintainers said go idea we'll do a quick release with that on top of 2.69 and then work on the upcoming big release. -- Doug Goldstein signature.asc Description: OpenPGP digital signature ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [xen-4.4-testing test] 106051: regressions - trouble: blocked/broken/fail/pass
flight 106051 xen-4.4-testing real [real] http://logs.test-lab.xenproject.org/osstest/logs/106051/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-i386-xend-qemut-winxpsp3 15 guest-localmigrate/x10 fail REGR. vs. 105835 test-armhf-armhf-xl-multivcpu 16 guest-start.2 fail REGR. vs. 105835 Tests which are failing intermittently (not blocking): test-amd64-amd64-xl-qemuu-ovmf-amd64 3 host-install(3) broken in 106018 pass in 106051 test-amd64-i386-xl-qemut-win7-amd64 3 host-install(3) broken in 106018 pass in 106051 test-amd64-amd64-pygrub 3 host-install(3) broken in 106018 pass in 106051 test-amd64-i386-xl-qemuu-ovmf-amd64 3 host-install(3) broken in 106018 pass in 106051 test-amd64-i386-xl 3 host-install(3) broken in 106018 pass in 106051 test-amd64-i386-xl-qemut-winxpsp3-vcpus1 3 host-install(3) broken in 106018 pass in 106051 test-amd64-i386-freebsd10-amd64 3 host-install(3) broken pass in 106018 test-armhf-armhf-xl-multivcpu 15 guest-start/debian.repeat fail in 106018 pass in 106051 test-amd64-i386-xl-qemuu-win7-amd64 15 guest-localmigrate/x10 fail pass in 106018 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-stop fail pass in 106018 Regressions which are regarded as allowable (not blocking): test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail in 106018 like 105835 test-xtf-amd64-amd64-2 16 xtf/test-pv32pae-selftestfail like 105835 test-xtf-amd64-amd64-4 16 xtf/test-pv32pae-selftestfail like 105835 test-xtf-amd64-amd64-3 20 xtf/test-hvm32-invlpg~shadow fail like 105835 test-xtf-amd64-amd64-3 33 xtf/test-hvm32pae-invlpg~shadow fail like 105835 test-xtf-amd64-amd64-3 44 xtf/test-hvm64-invlpg~shadow fail like 105835 test-xtf-amd64-amd64-2 54 leak-check/check fail like 105835 test-xtf-amd64-amd64-4 54 leak-check/check fail like 105835 test-xtf-amd64-amd64-1 54 leak-check/check fail like 105835 test-xtf-amd64-amd64-5 54 leak-check/check fail like 105835 test-xtf-amd64-amd64-3 54 leak-check/check fail like 105835 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stopfail like 105835 Tests which did not succeed, but are not blocking: test-amd64-amd64-rumprun-amd64 1 build-check(1) blocked n/a test-amd64-i386-rumprun-i386 1 build-check(1) blocked n/a test-xtf-amd64-amd64-2 10 xtf-fep fail never pass test-xtf-amd64-amd64-2 18 xtf/test-hvm32-cpuid-faulting fail never pass test-xtf-amd64-amd64-4 10 xtf-fep fail never pass test-xtf-amd64-amd64-2 31 xtf/test-hvm32pae-cpuid-faulting fail never pass test-xtf-amd64-amd64-4 18 xtf/test-hvm32-cpuid-faulting fail never pass test-xtf-amd64-amd64-1 10 xtf-fep fail never pass test-xtf-amd64-amd64-2 37 xtf/test-hvm32pse-cpuid-faulting fail never pass test-xtf-amd64-amd64-1 16 xtf/test-pv32pae-selftestfail never pass test-xtf-amd64-amd64-1 18 xtf/test-hvm32-cpuid-faulting fail never pass test-xtf-amd64-amd64-2 41 xtf/test-hvm64-cpuid-faulting fail never pass test-xtf-amd64-amd64-4 31 xtf/test-hvm32pae-cpuid-faulting fail never pass test-xtf-amd64-amd64-4 37 xtf/test-hvm32pse-cpuid-faulting fail never pass test-xtf-amd64-amd64-1 31 xtf/test-hvm32pae-cpuid-faulting fail never pass test-xtf-amd64-amd64-4 41 xtf/test-hvm64-cpuid-faulting fail never pass test-xtf-amd64-amd64-1 37 xtf/test-hvm32pse-cpuid-faulting fail never pass test-xtf-amd64-amd64-1 41 xtf/test-hvm64-cpuid-faulting fail never pass test-xtf-amd64-amd64-5 10 xtf-fep fail never pass build-amd64-rumprun 7 xen-buildfail never pass build-i386-rumprun7 xen-buildfail never pass test-amd64-i386-libvirt 12 migrate-support-checkfail never pass test-xtf-amd64-amd64-3 10 xtf-fep fail never pass test-armhf-armhf-xl-vhd 9 debian-di-installfail never pass test-xtf-amd64-amd64-2 53 xtf/test-hvm64-xsa-195 fail never pass test-xtf-amd64-amd64-4 53 xtf/test-hvm64-xsa-195 fail never pass test-armhf-armhf-libvirt-raw 9 debian-di-installfail never pass test-xtf-amd64-amd64-1 53 xtf/test-hvm64-xsa-195 fail never pass test-amd64-amd64-libvirt 12 migrate-support-checkfail never pass test-amd64-amd64-qemuu-nested-intel 16 debian-hvm-install/l1/l2 fail never pass test-xtf-amd64-amd64-5 53 xtf/test-hvm64-xsa-195 fail never pass test-armhf-armhf-xl-arndale 12 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 13 saverestore-support-checkfail never pass test-xtf-amd64
Re: [Xen-devel] [PATCH] build: add --with-rundir option to configure
On 2/22/17 1:53 AM, Juergen Gross wrote: > On 20/02/17 16:19, Andrew Cooper wrote: >> On 20/02/17 14:43, Juergen Gross wrote: >>> On 20/02/17 15:31, Wei Liu wrote: On Thu, Feb 16, 2017 at 08:47:07AM +0100, Juergen Gross wrote: > There have been reports that Fedora 25 uses /run instead of /var/run. > > Add a --with-rundir option ito configure to be able to specify that I've read this thread but I'm not sure if I need to take any action or all the comments addressed -- especially the part about autoconf. >>> Andrew, are you fine with my answer regarding autoconf? Or do you have >>> some information regarding --runstatedir which could help? >> >> Oh sorry. Didn't realise I was blocking here. I have no specific >> information, other than the quick search I did. >> >> Can't the future problem be worked around just with if autoconf version >> < 2.70 ? > > I don't think it is possible to add configure options other than > --disable-*, --enable-*, --with-* or --without-* by other means than > patching general.m4 of autoconf. I don't think we want to do that. > > So the possibilities are: > > 1. don't support /run instead of /var/run via configure > 2. patch autoconf to support --runstatedir > 3. take this patch adding support via --with-rundir and possibly >switch over to --runstatedir when a new autoconf version is >available > > I'm in favor of (3.). > > > Juergen FWIW, many distros have already pulled the patch into their autoconf so its available so you wouldn't really have to do anything. Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759647 Ubuntu: 16.04 and newer have it Gentoo: no link handy but I know its there -- Doug Goldstein signature.asc Description: OpenPGP digital signature ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 04/29] xl: use <> variant to include Xen tools library headers
They should be treated like any other libraries installed on the build host. Compiler options are set correctly to point to their locations. Signed-off-by: Wei Liu --- tools/xl/xl.c | 6 +++--- tools/xl/xl.h | 2 +- tools/xl/xl_cmdimpl.c | 8 tools/xl/xl_cmdtable.c | 2 +- tools/xl/xl_sxp.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/xl/xl.c b/tools/xl/xl.c index 5eab2c31c4..32346ad7a5 100644 --- a/tools/xl/xl.c +++ b/tools/xl/xl.c @@ -24,9 +24,9 @@ #include #include -#include "libxl.h" -#include "libxl_utils.h" -#include "libxlutil.h" +#include +#include +#include #include "xl.h" xentoollog_logger_stdiostream *logger; diff --git a/tools/xl/xl.h b/tools/xl/xl.h index 84dd2a9265..a8b6264c59 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -18,7 +18,7 @@ #include #include "_paths.h" -#include "xentoollog.h" +#include struct cmd_spec { char *cmd_name; diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 4dfcbe61ca..9901011008 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -34,10 +34,10 @@ #include #include -#include "libxl.h" -#include "libxl_utils.h" -#include "libxl_json.h" -#include "libxlutil.h" +#include +#include +#include +#include #include "xl.h" /* For calls which return an errno on failure */ diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index ddcd6c2423..1219b3309d 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -14,7 +14,7 @@ #include -#include "libxl.h" +#include #include "xl.h" struct cmd_spec cmd_table[] = { diff --git a/tools/xl/xl_sxp.c b/tools/xl/xl_sxp.c index 9ced6f17be..e738bf2465 100644 --- a/tools/xl/xl_sxp.c +++ b/tools/xl/xl_sxp.c @@ -19,8 +19,8 @@ #include #include -#include "libxl.h" -#include "libxl_utils.h" +#include +#include #include "xl.h" /* In general you should not add new output to this function since it -- 2.11.0 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 05/29] xl: generate _paths.h
It is included by xl.h. Previously it was using _paths.h from some other place. We'd better generate one for xl as well. Signed-off-by: Wei Liu --- .gitignore| 1 + tools/xl/Makefile | 7 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 557b38e1b2..3713b1e2a6 100644 --- a/.gitignore +++ b/.gitignore @@ -380,6 +380,7 @@ tools/firmware/etherboot/ipxe/ tools/python/xen/lowlevel/xl/_pyxl_types.c tools/python/xen/lowlevel/xl/_pyxl_types.h tools/xenstore/xenstore-watch +tools/xl/_paths.h tools/xl/xl docs/txt/misc/*.txt diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 32dff40584..7106009d66 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -20,6 +20,11 @@ $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) $(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it. +genpath-target = $(call buildmakevars2header,_paths.h) +$(eval $(genpath-target)) + +$(XL_OBJS): _paths.h + .PHONY: all all: xl @@ -35,7 +40,7 @@ install: all .PHONY: clean clean: - $(RM) -f *.o xl $(DEPS) + $(RM) -f *.o xl _paths.h $(DEPS) distclean: clean -- 2.11.0 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 02/29] xl: update copyright information
Signed-off-by: Wei Liu --- tools/xl/xl.c | 4 +--- tools/xl/xl.h | 2 +- tools/xl/xl_cmdimpl.c | 4 +--- tools/xl/xl_cmdtable.c | 2 +- tools/xl/xl_sxp.c | 4 +--- 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/tools/xl/xl.c b/tools/xl/xl.c index a272258155..4bc9648b71 100644 --- a/tools/xl/xl.c +++ b/tools/xl/xl.c @@ -1,7 +1,5 @@ /* - * Copyright (C) 2009 Citrix Ltd. - * Author Stefano Stabellini - * Author Vincent Hanquez + * Copyright 2009-2017 Citrix Ltd and other contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/tools/xl/xl.h b/tools/xl/xl.h index 0a8c8133cf..84dd2a9265 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -1,5 +1,5 @@ /* - * Author Yang Hongyang + * Copyright 2009-2017 Citrix Ltd and other contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 0add5dcc5e..a83739942c 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -1,7 +1,5 @@ /* - * Copyright (C) 2009 Citrix Ltd. - * Author Stefano Stabellini - * Author Vincent Hanquez + * Copyright 2009-2017 Citrix Ltd and other contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 588d5d9604..ddcd6c2423 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -1,5 +1,5 @@ /* - * Author Yang Hongyang + * Copyright 2009-2017 Citrix Ltd and other contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/tools/xl/xl_sxp.c b/tools/xl/xl_sxp.c index a8c127b439..b67c0ae999 100644 --- a/tools/xl/xl_sxp.c +++ b/tools/xl/xl_sxp.c @@ -1,7 +1,5 @@ /* - * Copyright (C) 2009 Citrix Ltd. - * Author Stefano Stabellini - * Author Vincent Hanquez + * Copyright 2009-2017 Citrix Ltd and other contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published -- 2.11.0 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 00/29] Refactor xl code
xl_cmdimpl.c has become prohibitively large (almost 10k lines in one single file). Try to split it up into multiple files according to the functionality of the code. I will run a full osstest flight before merging. Send the first version out as quick as possible to gather feedback because I know other people are also touching this area of code. Further improvements are certainly desired, for example we should probably give functions better names, but this series is already very long, so let's save that for another day. Wei Liu (29): xl: remove accidentally committed hunk from Makefile xl: update copyright information xl: remove inclusion of libxl_osdeps.h xl: use <> variant to include Xen tools library headers xl: generate _paths.h xl: remove trailing spaces in xl_cmdimpl.c xl: lift a bunch of macros to xl_utils.h xl: move some helper functions to xl_utils.c xl: split out tmem related code to xl_tmem.c xl: split out xl_parse.[ch] xl: split out cpupool related code xl: split out flask related code xl: split out vtpm related code xl: split out block related code xl: split out network related code xl: split out usb related code xl: split out scheduler related code xl: split out pci related code xl: split out vcpu related code xl: split out cd related code xl: split out memory related code xl: split out psr related code xl: split out functions to print out information xl: split out vnc and console related code xl: split out miscellaneous functions xl: split out vm lifecycle control functions xl: split out save/restore related code xl: split out migration related code xl: merge xl_cmdimpl.c into xl.c .gitignore|1 + tools/xl/Makefile | 19 +- tools/xl/xl.c | 70 +- tools/xl/xl.h | 77 +- tools/xl/xl_block.c | 129 + tools/xl/xl_cd.c | 114 + tools/xl/xl_cmdimpl.c | 9642 - tools/xl/xl_cmdtable.c|4 +- tools/xl/xl_console.c | 130 + tools/xl/xl_cpupool.c | 624 +++ tools/xl/xl_flask.c | 153 + tools/xl/xl_info.c| 925 + tools/xl/xl_mem.c | 167 + tools/xl/xl_migrate.c | 754 tools/xl/xl_misc.c| 355 ++ tools/xl/xl_nic.c | 172 + tools/xl/xl_parse.c | 2052 ++ tools/xl/xl_parse.h | 65 + tools/xl/xl_pci.c | 278 ++ tools/xl/xl_psr.c | 567 +++ tools/xl/xl_saverestore.c | 273 ++ tools/xl/xl_sched.c | 888 + tools/xl/xl_sxp.c | 10 +- tools/xl/xl_tmem.c| 251 ++ tools/xl/xl_usb.c | 222 ++ tools/xl/xl_utils.c | 328 ++ tools/xl/xl_utils.h | 157 + tools/xl/xl_vcpu.c| 337 ++ tools/xl/xl_vmcontrol.c | 1225 ++ tools/xl/xl_vtpm.c| 153 + 30 files changed, 10474 insertions(+), 9668 deletions(-) create mode 100644 tools/xl/xl_block.c create mode 100644 tools/xl/xl_cd.c delete mode 100644 tools/xl/xl_cmdimpl.c create mode 100644 tools/xl/xl_console.c create mode 100644 tools/xl/xl_cpupool.c create mode 100644 tools/xl/xl_flask.c create mode 100644 tools/xl/xl_info.c create mode 100644 tools/xl/xl_mem.c create mode 100644 tools/xl/xl_migrate.c create mode 100644 tools/xl/xl_misc.c create mode 100644 tools/xl/xl_nic.c create mode 100644 tools/xl/xl_parse.c create mode 100644 tools/xl/xl_parse.h create mode 100644 tools/xl/xl_pci.c create mode 100644 tools/xl/xl_psr.c create mode 100644 tools/xl/xl_saverestore.c create mode 100644 tools/xl/xl_sched.c create mode 100644 tools/xl/xl_tmem.c create mode 100644 tools/xl/xl_usb.c create mode 100644 tools/xl/xl_utils.c create mode 100644 tools/xl/xl_utils.h create mode 100644 tools/xl/xl_vcpu.c create mode 100644 tools/xl/xl_vmcontrol.c create mode 100644 tools/xl/xl_vtpm.c -- 2.11.0 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 08/29] xl: move some helper functions to xl_utils.c
Move some commonly used functions to a new file. Prepend "x" to function names to stick to consistent naming scheme. Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 343 +- tools/xl/xl_utils.c | 258 + tools/xl/xl_utils.h | 33 - 4 files changed, 351 insertions(+), 285 deletions(-) create mode 100644 tools/xl/xl_utils.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 7106009d66..2f740b4789 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -15,7 +15,7 @@ LDFLAGS += $(PTHREAD_LDFLAGS) CFLAGS_XL += $(CFLAGS_libxenlight) CFLAGS_XL += -Wshadow -XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o +XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) $(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it. diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index d9d947827d..c45ffe943f 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -48,7 +47,7 @@ libxl_ctx *ctx; xlchild children[child_max]; -static const char *common_domname; +const char *common_domname; static int fd_lock = -1; static const char savefileheader_magic[32]= @@ -129,22 +128,6 @@ struct domain_create { char **migration_domname_r; /* from malloc */ }; - -static uint32_t find_domain(const char *p) __attribute__((warn_unused_result)); -static uint32_t find_domain(const char *p) -{ -uint32_t domid; -int rc; - -rc = libxl_domain_qualifier_to_domid(ctx, p, &domid); -if (rc) { -fprintf(stderr, "%s is an invalid domain identifier (rc=%d)\n", p, rc); -exit(EXIT_FAILURE); -} -common_domname = libxl_domid_to_name(ctx, domid); -return domid; -} - int child_report(xlchildnum child) { int status; @@ -253,47 +236,6 @@ release_lock: return rc; } -static void *xmalloc(size_t sz) { -void *r; -r = malloc(sz); -if (!r) { fprintf(stderr,"xl: Unable to malloc %lu bytes.\n", - (unsigned long)sz); exit(-ERROR_FAIL); } -return r; -} - -static void *xcalloc(size_t n, size_t sz) __attribute__((unused)); -static void *xcalloc(size_t n, size_t sz) { -void *r = calloc(n, sz); -if (!r) { -fprintf(stderr,"xl: Unable to calloc %zu bytes.\n", sz*n); -exit(-ERROR_FAIL); -} -return r; -} - -static void *xrealloc(void *ptr, size_t sz) { -void *r; -if (!sz) { free(ptr); return 0; } - /* realloc(non-0, 0) has a useless return value; - * but xrealloc(anything, 0) is like free - */ -r = realloc(ptr, sz); -if (!r) { fprintf(stderr,"xl: Unable to realloc to %lu bytes.\n", - (unsigned long)sz); exit(-ERROR_FAIL); } -return r; -} - -static char *xstrdup(const char *x) -{ -char *r; -r = strdup(x); -if (!r) { -fprintf(stderr, "xl: Unable to strdup a string of length %zu.\n", -strlen(x)); -exit(-ERROR_FAIL); -} -return r; -} #define ARRAY_EXTEND_INIT__CORE(array,count,initfn,more)\ ({ \ @@ -313,46 +255,6 @@ static char *xstrdup(const char *x) #define ARRAY_EXTEND_INIT_NODEVID(array,count,initfn) \ ARRAY_EXTEND_INIT__CORE((array),(count),(initfn), /* nothing */ ) -static void dolog(const char *file, int line, const char *func, char *fmt, ...) - __attribute__((format(printf,4,5))); - -static void dolog(const char *file, int line, const char *func, char *fmt, ...) -{ -va_list ap; -char *s = NULL; -int rc; - -va_start(ap, fmt); -rc = vasprintf(&s, fmt, ap); -va_end(ap); -if (rc >= 0) -/* we ignore write errors since we have no way to report them; - * the alternative would be to abort the whole program */ -libxl_write_exactly(NULL, logfile, s, rc, NULL, NULL); -free(s); -} - -static void xvasprintf(char **strp, const char *fmt, va_list ap) -__attribute__((format(printf,2,0))); -static void xvasprintf(char **strp, const char *fmt, va_list ap) -{ -int r = vasprintf(strp, fmt, ap); -if (r == -1) { -perror("asprintf failed"); -exit(EXIT_FAILURE); -} -} - -static void xasprintf(char **strp, const char *fmt, ...) -__attribute__((format(printf,2,3))); -static void xasprintf(char **strp, const char *fmt, ...) -{ -va_list ap; -va_start(ap, fmt); -xvasprintf(strp, fmt, ap); -va_end(ap); -} - static yajl_gen_status printf_info_one_json(yajl_gen hand, int domid, libxl_domain_config *d_config) { @@ -389,19 +291,6 @@ out: return s; } -static void flush_stream(FILE *fh) -{ -const char *fh_name = -fh == stdout
[Xen-devel] [PATCH 03/29] xl: remove inclusion of libxl_osdeps.h
There is no reason for a client to include a private header from libxl. Remove the inclusion and define _GNU_SOURCE for {v,}asprintf in xl_cmdimpl.c. Signed-off-by: Wei Liu --- tools/xl/xl.c | 2 -- tools/xl/xl_cmdimpl.c | 2 +- tools/xl/xl_sxp.c | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/xl/xl.c b/tools/xl/xl.c index 4bc9648b71..5eab2c31c4 100644 --- a/tools/xl/xl.c +++ b/tools/xl/xl.c @@ -12,8 +12,6 @@ * GNU Lesser General Public License for more details. */ -#include "libxl_osdeps.h" - #include #include #include diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index a83739942c..4dfcbe61ca 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -12,7 +12,7 @@ * GNU Lesser General Public License for more details. */ -#include "libxl_osdeps.h" +#define _GNU_SOURCE #include #include diff --git a/tools/xl/xl_sxp.c b/tools/xl/xl_sxp.c index b67c0ae999..9ced6f17be 100644 --- a/tools/xl/xl_sxp.c +++ b/tools/xl/xl_sxp.c @@ -16,8 +16,6 @@ * Legacy SXP output handling */ -#include "libxl_osdeps.h" - #include #include -- 2.11.0 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 06/29] xl: remove trailing spaces in xl_cmdimpl.c
Signed-off-by: Wei Liu --- tools/xl/xl_cmdimpl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 9901011008..1d7cf8ffa8 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -6732,7 +6732,7 @@ static int sched_vcpu_output(libxl_scheduler sched, return 0; } -/* +/* * : List all domain params and sched params from all pools * -d [domid]: List domain params for domain * -d [domid] [params] : Set domain params for domain @@ -8374,7 +8374,7 @@ int main_cpupoolcreate(int argc, char **argv) } /* We made it! */ rc = EXIT_SUCCESS; - + out_cfg: xlu_cfg_destroy(config); out: -- 2.11.0 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 07/29] xl: lift a bunch of macros to xl_utils.h
We're going to split xl_cmdimpl.c into multiple files. Lift the commonly used macros to xl_utils.h. Signed-off-by: Wei Liu --- tools/xl/xl_cmdimpl.c | 104 +--- tools/xl/xl_utils.h | 129 ++ 2 files changed, 130 insertions(+), 103 deletions(-) create mode 100644 tools/xl/xl_utils.h diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 1d7cf8ffa8..d9d947827d 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -39,42 +39,7 @@ #include #include #include "xl.h" - -/* For calls which return an errno on failure */ -#define CHK_ERRNOVAL( call ) ({ \ -int chk_errnoval = (call); \ -if (chk_errnoval < 0) \ -abort();\ -else if (chk_errnoval > 0) {\ -fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n", \ -__FILE__,__LINE__, strerror(chk_errnoval), #call); \ -exit(EXIT_FAILURE); \ -} \ -}) - -/* For calls which return -1 and set errno on failure */ -#define CHK_SYSCALL( call ) ({ \ -if ((call) == -1) { \ -fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n", \ -__FILE__,__LINE__, strerror(errno), #call); \ -exit(EXIT_FAILURE); \ -} \ -}) - -#define MUST( call ) ({ \ -int must_rc = (call); \ -if (must_rc < 0) { \ -fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n", \ -__FILE__,__LINE__, must_rc, #call); \ -exit(EXIT_FAILURE); \ -} \ -}) - -#define STR_HAS_PREFIX( a, b ) \ -( strncmp(a, b, strlen(b)) == 0 ) -#define STR_SKIP_PREFIX( a, b ) \ -( STR_HAS_PREFIX(a, b) ? ((a) += strlen(b), 1) : 0 ) - +#include "xl_utils.h" int logfile = 2; @@ -83,7 +48,6 @@ libxl_ctx *ctx; xlchild children[child_max]; -#define INVALID_DOMID ~0 static const char *common_domname; static int fd_lock = -1; @@ -349,8 +313,6 @@ static char *xstrdup(const char *x) #define ARRAY_EXTEND_INIT_NODEVID(array,count,initfn) \ ARRAY_EXTEND_INIT__CORE((array),(count),(initfn), /* nothing */ ) -#define LOG(_f, _a...) dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a) - static void dolog(const char *file, int line, const char *func, char *fmt, ...) __attribute__((format(printf,4,5))); @@ -3332,10 +3294,6 @@ static int64_t parse_mem_size_kb(const char *mem) return kbytes; } -/* Must be last in list */ -#define COMMON_LONG_OPTS {"help", 0, 0, 'h'}, \ - {0, 0, 0, 0} - /* * Callers should use SWITCH_FOREACH_OPT in preference to calling this * directly. @@ -3378,66 +3336,6 @@ static int def_getopt(int argc, char * const argv[], return -1; } -/* - * Wraps def_getopt into a convenient loop+switch to process all - * arguments. This macro is intended to be called from main_XXX(). - * - * SWITCH_FOREACH_OPT(int *opt, "OPTS", - * const struct option *longopts, - * const char *commandname, - * int num_opts_req) { ... - * - * opt: pointer to an int variable, holds the current option - *during processing. - * OPTS: short options, as per getopt_long(3)'s optstring argument. - *do not include "h"; will be provided automatically - * longopts: long options, as per getopt_long(3)'s longopts argument. - *May be null. - * commandname: name of this command, for usage string. - * num_required_opts: number of non-option command line parameters - *which are required. - * - * In addition the calling context is expected to contain variables - * "argc" and "argv" in the conventional C-style: - * main(int argc, char **argv) - * manner. - * - * Callers should treat SWITCH_FOREACH_OPT as they would a switch - * statement over the value of `opt`. Each option given in `opts` (or - * `lopts`) should be handled by a case statement as if it were inside - * a switch statement. - * - * In addition to the options provided in opts the macro will handle - * the "help" option and enforce a minimum number of non-option
[Xen-devel] [PATCH 01/29] xl: remove accidentally committed hunk from Makefile
It was never intended to be committed. Lucky the high level Makefile was correct so it didn't cause us problem when building xl. Signed-off-by: Wei Liu --- tools/xl/Makefile | 6 -- 1 file changed, 6 deletions(-) diff --git a/tools/xl/Makefile b/tools/xl/Makefile index d4b862c9b9..32dff40584 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -20,12 +20,6 @@ $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) $(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it. -# libxenlight should be built before building xl -.PHONY: libxl -libxl: - $(MAKE) -C $(XEN_ROOT)/tools/libxl -$(XL_OBJS): libxl - .PHONY: all all: xl -- 2.11.0 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] spinlock wakeup
Looking at void _spin_lock(spinlock_t *lock) { spinlock_tickets_t tickets = SPINLOCK_TICKET_INC; LOCK_PROFILE_VAR; check_lock(&lock->debug); tickets.head_tail = arch_fetch_and_add(&lock->tickets.head_tail, tickets.head_tail); while ( tickets.tail != observe_head(&lock->tickets) ) { LOCK_PROFILE_BLOCK; arch_lock_relax(); } LOCK_PROFILE_GOT; preempt_disable(); arch_lock_acquire_barrier(); } If the lock is dropped during LOCK_PROFILE_BLOCK, isn't there a chance that we are never woken up from arch_lock_relax()? (This would only be an issue on ARM which IIUIC sleeps there). -boris ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 5/5] x86/xen: split suspend.c for PV and PVHVM guests
Get read of #ifdefs in suspend.c by splitting the code into suspend_pv.c and suspend_hvm.c. Signed-off-by: Vitaly Kuznetsov --- arch/x86/xen/Makefile | 4 ++-- arch/x86/xen/suspend.c | 58 -- arch/x86/xen/suspend_hvm.c | 22 ++ arch/x86/xen/suspend_pv.c | 44 +++ arch/x86/xen/xen-ops.h | 14 +++ 5 files changed, 82 insertions(+), 60 deletions(-) create mode 100644 arch/x86/xen/suspend_hvm.c create mode 100644 arch/x86/xen/suspend_pv.c diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile index 10264ed..c5291f4 100644 --- a/arch/x86/xen/Makefile +++ b/arch/x86/xen/Makefile @@ -16,8 +16,8 @@ obj-y := enlighten.o multicalls.o \ mmu.o obj-$(CONFIG_XEN_PV) += enlighten_pv.o setup.o mmu_pv.o p2m.o \ - apic.o pmu.o -obj-$(CONFIG_XEN_PVHVM)+= enlighten_hvm.o mmu_hvm.o + apic.o pmu.o suspend_pv.o +obj-$(CONFIG_XEN_PVHVM)+= enlighten_hvm.o mmu_hvm.o suspend_hvm.o obj-$(CONFIG_XEN_PVH) += enlighten_pvh.o obj-$(CONFIG_EVENT_TRACING) += trace.o diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index 37f634f..d6b1680 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c @@ -14,64 +14,6 @@ #include "mmu.h" #include "pmu.h" -static void xen_pv_pre_suspend(void) -{ -#ifdef CONFIG_XEN_PV - xen_mm_pin_all(); - - xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); - xen_start_info->console.domU.mfn = - mfn_to_pfn(xen_start_info->console.domU.mfn); - - BUG_ON(!irqs_disabled()); - - HYPERVISOR_shared_info = &xen_dummy_shared_info; - if (HYPERVISOR_update_va_mapping(fix_to_virt(FIX_PARAVIRT_BOOTMAP), -__pte_ma(0), 0)) - BUG(); -#endif -} - -static void xen_hvm_post_suspend(int suspend_cancelled) -{ -#ifdef CONFIG_XEN_PVHVM - int cpu; - if (!suspend_cancelled) - xen_hvm_init_shared_info(); - xen_callback_vector(); - xen_unplug_emulated_devices(); - if (xen_feature(XENFEAT_hvm_safe_pvclock)) { - for_each_online_cpu(cpu) { - xen_setup_runstate_info(cpu); - } - } -#endif -} - -static void xen_pv_post_suspend(int suspend_cancelled) -{ -#ifdef CONFIG_XEN_PV - xen_build_mfn_list_list(); - - xen_setup_shared_info(); - - if (suspend_cancelled) { - xen_start_info->store_mfn = - pfn_to_mfn(xen_start_info->store_mfn); - xen_start_info->console.domU.mfn = - pfn_to_mfn(xen_start_info->console.domU.mfn); - } else { -#ifdef CONFIG_SMP - BUG_ON(xen_cpu_initialized_map == NULL); - cpumask_copy(xen_cpu_initialized_map, cpu_online_mask); -#endif - xen_vcpu_restore(); - } - - xen_mm_unpin_all(); -#endif -} - void xen_arch_pre_suspend(void) { if (xen_pv_domain()) diff --git a/arch/x86/xen/suspend_hvm.c b/arch/x86/xen/suspend_hvm.c new file mode 100644 index 000..01afcad --- /dev/null +++ b/arch/x86/xen/suspend_hvm.c @@ -0,0 +1,22 @@ +#include + +#include +#include +#include + +#include "xen-ops.h" + +void xen_hvm_post_suspend(int suspend_cancelled) +{ + int cpu; + + if (!suspend_cancelled) + xen_hvm_init_shared_info(); + xen_callback_vector(); + xen_unplug_emulated_devices(); + if (xen_feature(XENFEAT_hvm_safe_pvclock)) { + for_each_online_cpu(cpu) { + xen_setup_runstate_info(cpu); + } + } +} diff --git a/arch/x86/xen/suspend_pv.c b/arch/x86/xen/suspend_pv.c new file mode 100644 index 000..496decca --- /dev/null +++ b/arch/x86/xen/suspend_pv.c @@ -0,0 +1,44 @@ +#include + +#include +#include + +#include "xen-ops.h" + +void xen_pv_pre_suspend(void) +{ + xen_mm_pin_all(); + + xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); + xen_start_info->console.domU.mfn = + mfn_to_pfn(xen_start_info->console.domU.mfn); + + BUG_ON(!irqs_disabled()); + + HYPERVISOR_shared_info = &xen_dummy_shared_info; + if (HYPERVISOR_update_va_mapping(fix_to_virt(FIX_PARAVIRT_BOOTMAP), +__pte_ma(0), 0)) + BUG(); +} + +void xen_pv_post_suspend(int suspend_cancelled) +{ + xen_build_mfn_list_list(); + + xen_setup_shared_info(); + + if (suspend_cancelled) { + xen_start_info->store_mfn = + pfn_to_mfn(xen_start_info->store_mfn); + xen_start_info->console.domU.mfn = + pfn_to_mfn(xen_start_info->console.domU.mfn); + } else { +#ifdef CONFIG_SMP + BUG_ON(xen_cpu_initial
[Xen-devel] [PATCH 1/5] x86/xen: start untangling PV and PVHVM guest support code
Introduce CONFIG_XEN_PV config option and split enlighten.c into 4 files. Temporary add #ifdef CONFIG_XEN_PV to smp.c and mmu.c to not break the build and not make the patch even bigger. xen_cpu_up_prepare*/xen_cpu_die hooks require separation to support future xen_smp_intr_init() split. Signed-off-by: Vitaly Kuznetsov --- arch/x86/include/asm/hypervisor.h |3 +- arch/x86/kernel/cpu/hypervisor.c |7 +- arch/x86/kernel/process_64.c |2 +- arch/x86/xen/Kconfig | 23 +- arch/x86/xen/Makefile | 10 +- arch/x86/xen/enlighten.c | 1904 + arch/x86/xen/enlighten_hvm.c | 210 arch/x86/xen/enlighten_pv.c | 1552 ++ arch/x86/xen/enlighten_pvh.c | 114 +++ arch/x86/xen/mmu.c|2 + arch/x86/xen/smp.c| 40 +- arch/x86/xen/suspend.c|4 + arch/x86/xen/xen-head.S |4 + arch/x86/xen/xen-ops.h|2 + include/xen/xen-ops.h |6 + 15 files changed, 1994 insertions(+), 1889 deletions(-) create mode 100644 arch/x86/xen/enlighten_hvm.c create mode 100644 arch/x86/xen/enlighten_pv.c create mode 100644 arch/x86/xen/enlighten_pvh.c diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h index 67942b6..4faa12d 100644 --- a/arch/x86/include/asm/hypervisor.h +++ b/arch/x86/include/asm/hypervisor.h @@ -53,7 +53,8 @@ extern const struct hypervisor_x86 *x86_hyper; /* Recognized hypervisors */ extern const struct hypervisor_x86 x86_hyper_vmware; extern const struct hypervisor_x86 x86_hyper_ms_hyperv; -extern const struct hypervisor_x86 x86_hyper_xen; +extern const struct hypervisor_x86 x86_hyper_xen_pv; +extern const struct hypervisor_x86 x86_hyper_xen_pvhvm; extern const struct hypervisor_x86 x86_hyper_kvm; extern void init_hypervisor(struct cpuinfo_x86 *c); diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c index 35691a6..dd68b03 100644 --- a/arch/x86/kernel/cpu/hypervisor.c +++ b/arch/x86/kernel/cpu/hypervisor.c @@ -28,8 +28,11 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] = { -#ifdef CONFIG_XEN - &x86_hyper_xen, +#ifdef CONFIG_XEN_PV + &x86_hyper_xen_pv, +#endif +#ifdef CONFIG_XEN_PVHVM + &x86_hyper_xen_pvhvm, #endif &x86_hyper_vmware, &x86_hyper_ms_hyperv, diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index a61e141..5e8d129 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -438,7 +438,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV)) __switch_to_xtra(prev_p, next_p, tss); -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_PV /* * On Xen PV, IOPL bits in pt_regs->flags have no effect, and * current_pt_regs()->flags may not match the current task's diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig index 76b6dbd..c387560 100644 --- a/arch/x86/xen/Kconfig +++ b/arch/x86/xen/Kconfig @@ -6,7 +6,6 @@ config XEN bool "Xen guest support" depends on PARAVIRT select PARAVIRT_CLOCK - select XEN_HAVE_PVMMU select XEN_HAVE_VPMU depends on X86_64 || (X86_32 && X86_PAE) depends on X86_LOCAL_APIC && X86_TSC @@ -15,18 +14,32 @@ config XEN kernel to boot in a paravirtualized environment under the Xen hypervisor. +config XEN_PV + bool "Xen PV guest support" + default y + depends on XEN + help + Support running as a Xen PV guest. + config XEN_DOM0 - def_bool y - depends on XEN && PCI_XEN && SWIOTLB_XEN + bool "Xen PV Dom0 support" + default y + depends on XEN_PV && PCI_XEN && SWIOTLB_XEN depends on X86_IO_APIC && ACPI && PCI + select XEN_HAVE_PVMMU + help + Support running as a Xen PV Dom0 guest. config XEN_PVHVM - def_bool y + bool "Xen PVHVM guest support" + default y depends on XEN && PCI && X86_LOCAL_APIC + help + Support running as a Xen PVHVM guest. config XEN_512GB bool "Limit Xen pv-domain memory to 512GB" - depends on XEN && X86_64 + depends on XEN_PV && X86_64 default y help Limit paravirtualized user domains to 512GB of RAM. diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile index cb0164a..750727b 100644 --- a/arch/x86/xen/Makefile +++ b/arch/x86/xen/Makefile @@ -7,14 +7,18 @@ endif # Make sure early boot has no stackprotector nostackp := $(call cc-option, -fno-stack-protector) -CFLAGS_enlighten.o := $(nostackp) +CFLAGS_enlighten_pv.o := $(nostackp) CFLAGS_mmu.o := $(nostackp) -obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ - time.o xe
[Xen-devel] RFC/PATCH: xen: race during domain destruction [Re: [xen-4.7-testing test] 105948: regressions - FAIL]
[Adding Juergen] On Wed, 2017-02-22 at 01:46 -0700, Jan Beulich wrote: > > > > On 22.02.17 at 01:02, wrote: > > (XEN) Xen call trace: > > (XEN)[] > > sched_credit2.c#vcpu_is_migrateable+0x22/0x9a > > (XEN)[] > > sched_credit2.c#csched2_schedule+0x823/0xb4e > > (XEN)[] schedule.c#schedule+0x108/0x609 > > (XEN)[] softirq.c#__do_softirq+0x7f/0x8a > > (XEN)[] do_softirq+0x13/0x15 > > (XEN)[] domain.c#idle_loop+0x55/0x62 > > (XEN) > > (XEN) > > (XEN) > > (XEN) Panic on CPU 14: > > (XEN) Assertion 'd->cpupool != NULL' failed at > > ...5948.build-amd64/xen/xen/include/xen/sched-if.h:200 > > (XEN) > > (XEN) > > (XEN) Manual reset required ('noreboot' specified) > > > > I am guessing the most recent credit2 backports weren't quite so > > safe? > Well, what I'd say we're facing is the surfacing of a latent bug. > However, comparing with the staging version of the file > (which is heavily different), the immediate code involved here isn't > all that different, so I wonder whether (a) this is a problem on > staging too or (b) we're missing another backport. Dario? > So, according to my investigation, this is a genuine race. It affects this branch as well as staging, but it manifests less frequently (or, I should say, very rarely) in the latter. The problem is that the Credit2's load balancer operates not only on runnable vCPUs, but also on blocked, sleeping, and paused ones (and that's by design). In this case, the original domain is in the process of being destroyed, Â after migration completed, and reaches the point where, within domain_destroy(), we call cpupool_rm_domain(). This remove the domain from any cpupool, and sets d->cpupool = NULL. Then, on another pCPU --since the vCPUs of the domain are still around (until we call sched_destroy_vcpu(), which happens much later-- and they also are still assigned to a Credit2 runqueue, balance_load() picks up one of them for moving to another runqueue, and things explode when we realize that the vCPU is actually out of any pool! So, I've thought quite a bit of how to solve this. Possibilities are to act at the Credit2 level, or outside of it. I drafted a couple of solutions only affecting sched_credit2.c, but could not be satisfied with the results. And that's because I ultimately think it should be safe for a scheduler that it can play with a vCPU that it can reach out to, and that means the vCPU must be in a pool. And that's why I came up with the patch below. This is a draft and is on top of staging-4.7. I will properly submit it against staging, if you agree with me it's an ok thing to do. Basically, I anticipate a little bit calling sched_destroy_vcpu(), so that it happens before cpupool_rm_domain(). This ensures that vCPUs have valid cpupool information until the very last moment that they are accessible from a scheduler. --- diff --git a/xen/common/domain.c b/xen/common/domain.c index 45273d4..4db7750 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -643,7 +643,10 @@ int domain_kill(struct domain *d) if ( cpupool_move_domain(d, cpupool0) ) return -ERESTART; for_each_vcpu ( d, v ) +{ unmap_vcpu_info(v); +sched_destroy_vcpu(v); +} d->is_dying = DOMDYING_dead; /* Mem event cleanup has to go here because the rings * have to be put before we call put_domain. */ @@ -807,7 +810,6 @@ static void complete_domain_destroy(struct rcu_head *head) continue; tasklet_kill(&v->continue_hypercall_tasklet); vcpu_destroy(v); -sched_destroy_vcpu(v); destroy_waitqueue_vcpu(v); } --- Let me know. Thanks and Regards, Dario -- <> (Raistlin Majere) - Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) signature.asc Description: This is a digitally signed message part ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH] build: add --with-rundir option to configure
On 24/02/17 17:06, Doug Goldstein wrote: > On 2/22/17 1:53 AM, Juergen Gross wrote: >> On 20/02/17 16:19, Andrew Cooper wrote: >>> On 20/02/17 14:43, Juergen Gross wrote: On 20/02/17 15:31, Wei Liu wrote: > On Thu, Feb 16, 2017 at 08:47:07AM +0100, Juergen Gross wrote: >> There have been reports that Fedora 25 uses /run instead of /var/run. >> >> Add a --with-rundir option ito configure to be able to specify that > I've read this thread but I'm not sure if I need to take any action or > all the comments addressed -- especially the part about autoconf. Andrew, are you fine with my answer regarding autoconf? Or do you have some information regarding --runstatedir which could help? >>> Oh sorry. Didn't realise I was blocking here. I have no specific >>> information, other than the quick search I did. >>> >>> Can't the future problem be worked around just with if autoconf version >>> < 2.70 ? >> I don't think it is possible to add configure options other than >> --disable-*, --enable-*, --with-* or --without-* by other means than >> patching general.m4 of autoconf. I don't think we want to do that. >> >> So the possibilities are: >> >> 1. don't support /run instead of /var/run via configure >> 2. patch autoconf to support --runstatedir >> 3. take this patch adding support via --with-rundir and possibly >>switch over to --runstatedir when a new autoconf version is >>available >> >> I'm in favor of (3.). >> >> >> Juergen > FWIW, many distros have already pulled the patch into their autoconf so > its available so you wouldn't really have to do anything. > > Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759647 > Ubuntu: 16.04 and newer have it > Gentoo: no link handy but I know its there openSUSE: not available I don't think its a good idea to rely on _all_ relevant distributions having done the backport. Juergen ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 0/5] x86/xen: untangle PV and PVHVM guest support code
Hi, it's been a while since my 'RFC' submission in November: https://lists.xen.org/archives/html/xen-devel/2016-11/msg01044.html I was advised to wait till PVHv2 stuff lands upstream and as this has already happened I'm sending the first non-RFC version. Changes since RFC: - Rebase - Use enlighten.c, enlighten_pv.c, enlighten_hvm.c, enlighten_pvh.c (and similar for other files I split) [David Vrabel] - Split suspend.c too to get rid of #ifdefs in C code. - I left XEN_DOM0 intact (rename to XEN_PV_DOM0 was suggested by [Boris Ostrovsky]) as it occured to me that we may want to have all three when XEN_PVH_DOM0 comes into play. XEN_DOM0 will be used for common code than so no need to change #ifdefs twice. Patches are known to produce checkpatch.pl WARNINGS and a couple of ERRORs, I fixed a few (mostly in _hvm* code I split) and I refrained from fixing the rest to make it easier to review. I think that we may leave PV code as it is as sooner or later it will go away. Original description: I have a long-standing idea to separate PV and PVHVM code in kernel and introduce Kconfig options to make it possible to enable the required parts only breaking the current 'all or nothing' approach. Motivation: - Xen related x86 code in kernel is rather big and it is unclear which parts of it are required for PV, for HVM or for both. With PVH coming into picture is becomes even more tangled. It makes it hard to understand/audit the code. - In some case we may want to avoid bloating kernel by supporting Xen guests we don't need. In particular, 90% of the code in arch/x86/xen/ is required to support PV guests and one may require PVHVM support only. - PV guests are supposed to go away one day and such code separation would help us to get ready. This series adds XEN_PV Kconfig option and makes it possible to build PV-only and PVHVM-only kernels. It also makes it possible to disable Dom0 support. Patches are rather big but this is mostly just moving code around, no functional changes intended. I smoke tested it with PV-only and PVHVM-only builds, booted and did save/restore test. I also tried the newly introduced PVHv2 guest, it even worked! Vitaly Kuznetsov (5): x86/xen: start untangling PV and PVHVM guest support code x86/xen: split smp.c for PV and PVHVM guests x86/xen: put setup.c, mmu.c and p2m.c under CONFIG_XEN_PV x86/xen: put setup.c, pmu.c and apic.c under CONFIG_XEN_PV x86/xen: split suspend.c for PV and PVHVM guests arch/x86/include/asm/hypervisor.h |3 +- arch/x86/include/asm/xen/page.h | 44 +- arch/x86/kernel/cpu/hypervisor.c |7 +- arch/x86/kernel/process_64.c |2 +- arch/x86/xen/Kconfig | 33 +- arch/x86/xen/Makefile | 18 +- arch/x86/xen/enlighten.c | 1904 + arch/x86/xen/enlighten_hvm.c | 210 +++ arch/x86/xen/enlighten_pv.c | 1561 + arch/x86/xen/enlighten_pvh.c | 114 ++ arch/x86/xen/mmu.c| 2776 + arch/x86/xen/mmu_hvm.c| 77 + arch/x86/xen/mmu_pv.c | 2636 +++ arch/x86/xen/pmu.h|5 + arch/x86/xen/smp.c| 523 +-- arch/x86/xen/smp.h| 23 + arch/x86/xen/smp_hvm.c| 58 + arch/x86/xen/smp_pv.c | 499 +++ arch/x86/xen/suspend.c| 54 - arch/x86/xen/suspend_hvm.c| 22 + arch/x86/xen/suspend_pv.c | 44 + arch/x86/xen/xen-head.S |4 + arch/x86/xen/xen-ops.h| 16 + drivers/xen/balloon.c | 30 +- include/xen/xen-ops.h | 19 + 25 files changed, 5489 insertions(+), 5193 deletions(-) create mode 100644 arch/x86/xen/enlighten_hvm.c create mode 100644 arch/x86/xen/enlighten_pv.c create mode 100644 arch/x86/xen/enlighten_pvh.c create mode 100644 arch/x86/xen/mmu_hvm.c create mode 100644 arch/x86/xen/mmu_pv.c create mode 100644 arch/x86/xen/smp_hvm.c create mode 100644 arch/x86/xen/smp_pv.c create mode 100644 arch/x86/xen/suspend_hvm.c create mode 100644 arch/x86/xen/suspend_pv.c -- 2.9.3 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 2/5] x86/xen: split smp.c for PV and PVHVM guests
More or less mechanically split smp.c into 3 files. XEN_PV_SMP and XEN_PVHVM_SMP config options added to support the change. Signed-off-by: Vitaly Kuznetsov --- arch/x86/xen/Kconfig| 8 + arch/x86/xen/Makefile | 3 + arch/x86/xen/enlighten_pv.c | 9 + arch/x86/xen/smp.c | 531 +--- arch/x86/xen/smp.h | 23 ++ arch/x86/xen/smp_hvm.c | 58 + arch/x86/xen/smp_pv.c | 499 + 7 files changed, 611 insertions(+), 520 deletions(-) create mode 100644 arch/x86/xen/smp_hvm.c create mode 100644 arch/x86/xen/smp_pv.c diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig index c387560..9ebfd77 100644 --- a/arch/x86/xen/Kconfig +++ b/arch/x86/xen/Kconfig @@ -21,6 +21,10 @@ config XEN_PV help Support running as a Xen PV guest. +config XEN_PV_SMP + def_bool y + depends on XEN_PV && SMP + config XEN_DOM0 bool "Xen PV Dom0 support" default y @@ -37,6 +41,10 @@ config XEN_PVHVM help Support running as a Xen PVHVM guest. +config XEN_PVHVM_SMP + def_bool y + depends on XEN_PVHVM && SMP + config XEN_512GB bool "Limit Xen pv-domain memory to 512GB" depends on XEN_PV && X86_64 diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile index 750727b..ed6f126 100644 --- a/arch/x86/xen/Makefile +++ b/arch/x86/xen/Makefile @@ -22,6 +22,9 @@ obj-$(CONFIG_XEN_PVH) += enlighten_pvh.o obj-$(CONFIG_EVENT_TRACING) += trace.o obj-$(CONFIG_SMP) += smp.o +obj-$(CONFIG_XEN_PV_SMP) += smp_pv.o +obj-$(CONFIG_XEN_PVHVM_SMP)+= smp_hvm.o + obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o obj-$(CONFIG_XEN_DOM0) += vga.o diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index b9ff23c..acfd896 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1478,12 +1478,21 @@ static int xen_cpu_up_prepare_pv(unsigned int cpu) cpu, rc); return rc; } + + rc = xen_smp_intr_init_pv(cpu); + if (rc) { + WARN(1, "xen_smp_intr_init_pv() for CPU %d failed: %d\n", +cpu, rc); + return rc; + } + return 0; } static int xen_cpu_dead_pv(unsigned int cpu) { xen_smp_intr_free(cpu); + xen_smp_intr_free_pv(cpu); xen_teardown_timer(cpu); diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 14fd7f3..dd1150e 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c @@ -1,62 +1,21 @@ -/* - * Xen SMP support - * - * This file implements the Xen versions of smp_ops. SMP under Xen is - * very straightforward. Bringing a CPU up is simply a matter of - * loading its initial context and setting it running. - * - * IPIs are handled through the Xen event mechanism. - * - * Because virtual CPUs can be scheduled onto any real CPU, there's no - * useful topology information for the kernel to make use of. As a - * result, all CPUs are treated as if they're single-core and - * single-threaded. - */ -#include -#include -#include #include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include +#include +#include +#include -#include -#include #include #include #include "xen-ops.h" -#include "mmu.h" #include "smp.h" -#include "pmu.h" - -cpumask_var_t xen_cpu_initialized_map; -struct xen_common_irq { - int irq; - char *name; -}; static DEFINE_PER_CPU(struct xen_common_irq, xen_resched_irq) = { .irq = -1 }; static DEFINE_PER_CPU(struct xen_common_irq, xen_callfunc_irq) = { .irq = -1 }; static DEFINE_PER_CPU(struct xen_common_irq, xen_callfuncsingle_irq) = { .irq = -1 }; -static DEFINE_PER_CPU(struct xen_common_irq, xen_irq_work) = { .irq = -1 }; static DEFINE_PER_CPU(struct xen_common_irq, xen_debug_irq) = { .irq = -1 }; -static DEFINE_PER_CPU(struct xen_common_irq, xen_pmu_irq) = { .irq = -1 }; static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id); static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id); -static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id); /* * Reschedule call back. @@ -69,42 +28,6 @@ static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static void cpu_bringup(void) -{ - int cpu; - - cpu_init(); - touch_softlockup_watchdog(); - preempt_disable(); - - /* PVH runs in ring 0 and allows us to do native syscalls. Yay! */ - if (!xen_feature(XENFEAT_supervisor_mode_kernel)) { - xen_enable_sysenter(); - xen_enable_syscall(); - } - cpu = smp_processor_id(); - smp_store_cpu_info(cpu); - cpu_data(cpu).x86_max_cores = 1; - set_cpu_sibling_map(cpu); - - xen_setup
[Xen-devel] [PATCH 4/5] x86/xen: put setup.c, pmu.c and apic.c under CONFIG_XEN_PV
xen_pmu_init/finish() functions are used in suspend.c and enlighten.c, add stubs for now. Signed-off-by: Vitaly Kuznetsov --- arch/x86/xen/Kconfig | 2 +- arch/x86/xen/Makefile | 5 +++-- arch/x86/xen/pmu.h| 5 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig index 9ebfd77..aa8256b 100644 --- a/arch/x86/xen/Kconfig +++ b/arch/x86/xen/Kconfig @@ -6,7 +6,6 @@ config XEN bool "Xen guest support" depends on PARAVIRT select PARAVIRT_CLOCK - select XEN_HAVE_VPMU depends on X86_64 || (X86_32 && X86_PAE) depends on X86_LOCAL_APIC && X86_TSC help @@ -18,6 +17,7 @@ config XEN_PV bool "Xen PV guest support" default y depends on XEN + select XEN_HAVE_VPMU help Support running as a Xen PV guest. diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile index 3bf840e..10264ed 100644 --- a/arch/x86/xen/Makefile +++ b/arch/x86/xen/Makefile @@ -13,9 +13,10 @@ CFLAGS_mmu_pv.o := $(nostackp) obj-y := enlighten.o multicalls.o \ irq.o time.o xen-asm.o xen-asm_$(BITS).o \ grant-table.o suspend.o platform-pci-unplug.o \ - apic.o pmu.o mmu.o + mmu.o -obj-$(CONFIG_XEN_PV) += enlighten_pv.o setup.o mmu_pv.o p2m.o +obj-$(CONFIG_XEN_PV) += enlighten_pv.o setup.o mmu_pv.o p2m.o \ + apic.o pmu.o obj-$(CONFIG_XEN_PVHVM)+= enlighten_hvm.o mmu_hvm.o obj-$(CONFIG_XEN_PVH) += enlighten_pvh.o diff --git a/arch/x86/xen/pmu.h b/arch/x86/xen/pmu.h index af5f0ad..4be5355 100644 --- a/arch/x86/xen/pmu.h +++ b/arch/x86/xen/pmu.h @@ -4,8 +4,13 @@ #include irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id); +#ifdef CONFIG_XEN_HAVE_VPMU void xen_pmu_init(int cpu); void xen_pmu_finish(int cpu); +#else +static inline void xen_pmu_init(int cpu) {} +static inline void xen_pmu_finish(int cpu) {} +#endif bool is_xen_pmu(int cpu); bool pmu_msr_read(unsigned int msr, uint64_t *val, int *err); bool pmu_msr_write(unsigned int msr, uint32_t low, uint32_t high, int *err); -- 2.9.3 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v3 2/2] x86/vpmu: Disable VPMU if guest's CPUID indicates no PMU support
>> +for_each_vcpu( d, v ) > If you use blanks immediately inside the parentheses, there should > also be one immediately before the opening one. Can be corrected > upon commit of course. Yes, please fix this when committing. Thanks. -boris ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 22/29] xl: split out psr related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 1 + tools/xl/xl_cmdimpl.c | 533 --- tools/xl/xl_psr.c | 567 ++ 3 files changed, 568 insertions(+), 533 deletions(-) create mode 100644 tools/xl/xl_psr.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 964da8e705..fdb64fed1d 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -19,6 +19,7 @@ XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o xl_mem.o +XL_OBJS += xl_psr.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 35d81417ec..f6942ffbe8 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -3619,539 +3619,6 @@ out: return ret; } -#ifdef LIBXL_HAVE_PSR_CMT -static int psr_cmt_hwinfo(void) -{ -int rc; -int enabled; -uint32_t total_rmid; - -printf("Cache Monitoring Technology (CMT):\n"); - -enabled = libxl_psr_cmt_enabled(ctx); -printf("%-16s: %s\n", "Enabled", enabled ? "1" : "0"); -if (!enabled) -return 0; - -rc = libxl_psr_cmt_get_total_rmid(ctx, &total_rmid); -if (rc) { -fprintf(stderr, "Failed to get max RMID value\n"); -return rc; -} -printf("%-16s: %u\n", "Total RMID", total_rmid); - -printf("Supported monitor types:\n"); -if (libxl_psr_cmt_type_supported(ctx, LIBXL_PSR_CMT_TYPE_CACHE_OCCUPANCY)) -printf("cache-occupancy\n"); -if (libxl_psr_cmt_type_supported(ctx, LIBXL_PSR_CMT_TYPE_TOTAL_MEM_COUNT)) -printf("total-mem-bandwidth\n"); -if (libxl_psr_cmt_type_supported(ctx, LIBXL_PSR_CMT_TYPE_LOCAL_MEM_COUNT)) -printf("local-mem-bandwidth\n"); - -return rc; -} - -#define MBM_SAMPLE_RETRY_MAX 4 -static int psr_cmt_get_mem_bandwidth(uint32_t domid, - libxl_psr_cmt_type type, - uint32_t socketid, - uint64_t *bandwidth_r) -{ -uint64_t sample1, sample2; -uint64_t tsc1, tsc2; -int retry_attempts = 0; -int rc; - -while (1) { -rc = libxl_psr_cmt_get_sample(ctx, domid, type, socketid, - &sample1, &tsc1); -if (rc < 0) -return rc; - -usleep(1); - -rc = libxl_psr_cmt_get_sample(ctx, domid, type, socketid, - &sample2, &tsc2); -if (rc < 0) -return rc; - -if (tsc2 <= tsc1) -return -1; - -/* - * Hardware guarantees at most 1 overflow can happen if the duration - * between two samples is less than 1 second. Note that tsc returned - * from hypervisor is already-scaled time(ns). - */ -if (tsc2 - tsc1 < 10 && sample2 >= sample1) -break; - -if (retry_attempts < MBM_SAMPLE_RETRY_MAX) { -retry_attempts++; -} else { -fprintf(stderr, "event counter overflowed\n"); -return -1; -} -} - -*bandwidth_r = (sample2 - sample1) * 10 / (tsc2 - tsc1) / 1024; -return 0; -} - -static void psr_cmt_print_domain_info(libxl_dominfo *dominfo, - libxl_psr_cmt_type type, - libxl_bitmap *socketmap) -{ -char *domain_name; -uint32_t socketid; -uint64_t monitor_data; - -if (!libxl_psr_cmt_domain_attached(ctx, dominfo->domid)) -return; - -domain_name = libxl_domid_to_name(ctx, dominfo->domid); -printf("%-40s %5d", domain_name, dominfo->domid); -free(domain_name); - -libxl_for_each_set_bit(socketid, *socketmap) { -switch (type) { -case LIBXL_PSR_CMT_TYPE_CACHE_OCCUPANCY: -if (!libxl_psr_cmt_get_sample(ctx, dominfo->domid, type, socketid, - &monitor_data, NULL)) -printf("%13"PRIu64" KB", monitor_data / 1024); -break; -case LIBXL_PSR_CMT_TYPE_TOTAL_MEM_COUNT: -case LIBXL_PSR_CMT_TYPE_LOCAL_MEM_COUNT: -if (!psr_cmt_get_mem_bandwidth(dominfo->domid, type, socketid, - &monitor_data)) -printf("%11"PRIu64" KB/s", monitor_data); -break; -default: -return; -} -} - -printf("\n"); -} - -static int psr_cmt_show(libxl_psr_cmt_type type, uint32_t domid) -{ -uint32_t i, socketid, total_rmid; -uint32_t l3_cache_size; -libxl_bitmap socketmap; -int rc, nr_domains; - -if (!libxl_psr_cmt_enabled(ctx)) { -fprintf(stderr, "CMT is disabled in the system\n"); -return -1; -} - -if (!libxl_psr_cmt_type_s
[Xen-devel] [PATCH 12/29] xl: split out flask related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 119 --- tools/xl/xl_flask.c | 153 ++ 3 files changed, 154 insertions(+), 120 deletions(-) create mode 100644 tools/xl/xl_flask.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 0ff7ef9bfe..df0b5dd5cf 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -16,7 +16,7 @@ CFLAGS_XL += $(CFLAGS_libxenlight) CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o -XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o +XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 82b30bb094..eb87cb975a 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -5611,125 +5611,6 @@ int main_uptime(int argc, char **argv) return 0; } -int main_getenforce(int argc, char **argv) -{ -int ret; - -ret = libxl_flask_getenforce(ctx); - -if (ret < 0) { -if (errno == ENOSYS) -printf("Flask XSM Disabled\n"); -else -fprintf(stderr, "Failed to get enforcing mode\n"); -} -else if (ret == 1) -printf("Enforcing\n"); -else if (ret == 0) -printf("Permissive\n"); - -return ret; -} - -int main_setenforce(int argc, char **argv) -{ -int ret, mode; -const char *p = NULL; - -if (optind >= argc) { -help("setenforce"); -return 2; -} - -p = argv[optind]; - -if (!strcmp(p, "0")) -mode = 0; -else if (!strcmp(p, "1")) -mode = 1; -else if (!strcasecmp(p, "permissive")) -mode = 0; -else if (!strcasecmp(p, "enforcing")) -mode = 1; -else { -help("setenforce"); -return 2; -} - -ret = libxl_flask_setenforce(ctx, mode); - -if (ret) { -if (errno == ENOSYS) { -fprintf(stderr, "Flask XSM disabled\n"); -} -else -fprintf(stderr, "error occured while setting enforcing mode (%i)\n", ret); -} - -return ret; -} - -int main_loadpolicy(int argc, char **argv) -{ -const char *polFName; -int polFd = -1; -void *polMemCp = NULL; -struct stat info; -int ret; - -if (optind >= argc) { -help("loadpolicy"); -return 2; -} - -polFName = argv[optind]; -polFd = open(polFName, O_RDONLY); -if (polFd < 0) { -fprintf(stderr, "Error occurred opening policy file '%s': %s\n", -polFName, strerror(errno)); -ret = -1; -goto done; -} - -ret = stat(polFName, &info); -if (ret < 0) { -fprintf(stderr, "Error occurred retrieving information about" -"policy file '%s': %s\n", polFName, strerror(errno)); -goto done; -} - -polMemCp = malloc(info.st_size); - -ret = read(polFd, polMemCp, info.st_size); -if ( ret < 0 ) { -fprintf(stderr, "Unable to read new Flask policy file: %s\n", -strerror(errno)); -goto done; -} - -ret = libxl_flask_loadpolicy(ctx, polMemCp, info.st_size); - -if (ret < 0) { -if (errno == ENOSYS) { -fprintf(stderr, "Flask XSM disabled\n"); -} else { -errno = -ret; -fprintf(stderr, "Unable to load new Flask policy: %s\n", -strerror(errno)); -ret = -1; -} -} else { -printf("Successfully loaded policy.\n"); -} - -done: -free(polMemCp); -if (polFd >= 0) -close(polFd); - -return ret; -} - #ifndef LIBXL_HAVE_NO_SUSPEND_RESUME int main_remus(int argc, char **argv) { diff --git a/tools/xl/xl_flask.c b/tools/xl/xl_flask.c new file mode 100644 index 00..804165c6a8 --- /dev/null +++ b/tools/xl/xl_flask.c @@ -0,0 +1,153 @@ +/* + * Copyright 2009-2017 Citrix Ltd and other contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking described in file LICENSE. + * + * 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 Lesser General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "xl.h" + +extern libxl_ctx *ctx; + +int main_getenforce(int argc, char **argv) +{ +int ret; + +ret = libxl_flask_getenforce(ctx); + +if (ret < 0) { +if (errno == ENOSYS) +printf("Flask XSM Disabled\n"); +else +fprintf(stderr, "Failed to get enforcing mode\n"); +} +else if (ret ==
[Xen-devel] [PATCH 17/29] xl: split out scheduler related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 1 + tools/xl/xl_cmdimpl.c | 856 tools/xl/xl_sched.c | 888 ++ 3 files changed, 889 insertions(+), 856 deletions(-) create mode 100644 tools/xl/xl_sched.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 45ddc255f5..8aa294d5a0 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -18,6 +18,7 @@ CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o +XL_OBJS += xl_sched.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 386f96b4cc..7d6de3957e 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -3757,862 +3757,6 @@ int main_sharing(int argc, char **argv) return EXIT_SUCCESS; } -static int sched_domain_get(libxl_scheduler sched, int domid, -libxl_domain_sched_params *scinfo) -{ -if (libxl_domain_sched_params_get(ctx, domid, scinfo)) { -fprintf(stderr, "libxl_domain_sched_params_get failed.\n"); -return 1; -} -if (scinfo->sched != sched) { -fprintf(stderr, "libxl_domain_sched_params_get returned %s not %s.\n", -libxl_scheduler_to_string(scinfo->sched), -libxl_scheduler_to_string(sched)); -return 1; -} - -return 0; -} - -static int sched_domain_set(int domid, const libxl_domain_sched_params *scinfo) -{ -if (libxl_domain_sched_params_set(ctx, domid, scinfo)) { -fprintf(stderr, "libxl_domain_sched_params_set failed.\n"); -return 1; -} - -return 0; -} - -static int sched_vcpu_get(libxl_scheduler sched, int domid, - libxl_vcpu_sched_params *scinfo) -{ -int rc; - -rc = libxl_vcpu_sched_params_get(ctx, domid, scinfo); -if (rc) { -fprintf(stderr, "libxl_vcpu_sched_params_get failed.\n"); -exit(EXIT_FAILURE); -} -if (scinfo->sched != sched) { -fprintf(stderr, "libxl_vcpu_sched_params_get returned %s not %s.\n", -libxl_scheduler_to_string(scinfo->sched), -libxl_scheduler_to_string(sched)); -return 1; -} - -return 0; -} - -static int sched_vcpu_get_all(libxl_scheduler sched, int domid, - libxl_vcpu_sched_params *scinfo) -{ -int rc; - -rc = libxl_vcpu_sched_params_get_all(ctx, domid, scinfo); -if (rc) { -fprintf(stderr, "libxl_vcpu_sched_params_get_all failed.\n"); -exit(EXIT_FAILURE); -} -if (scinfo->sched != sched) { -fprintf(stderr, "libxl_vcpu_sched_params_get_all returned %s not %s.\n", -libxl_scheduler_to_string(scinfo->sched), -libxl_scheduler_to_string(sched)); -return 1; -} - -return 0; -} - -static int sched_vcpu_set(int domid, const libxl_vcpu_sched_params *scinfo) -{ -int rc; - -rc = libxl_vcpu_sched_params_set(ctx, domid, scinfo); -if (rc) { -fprintf(stderr, "libxl_vcpu_sched_params_set failed.\n"); -exit(EXIT_FAILURE); -} - -return 0; -} - -static int sched_vcpu_set_all(int domid, const libxl_vcpu_sched_params *scinfo) -{ -int rc; - -rc = libxl_vcpu_sched_params_set_all(ctx, domid, scinfo); -if (rc) { -fprintf(stderr, "libxl_vcpu_sched_params_set_all failed.\n"); -exit(EXIT_FAILURE); -} - -return 0; -} - -static int sched_credit_params_set(int poolid, libxl_sched_credit_params *scinfo) -{ -if (libxl_sched_credit_params_set(ctx, poolid, scinfo)) { -fprintf(stderr, "libxl_sched_credit_params_set failed.\n"); -return 1; -} - -return 0; -} - -static int sched_credit_params_get(int poolid, libxl_sched_credit_params *scinfo) -{ -if (libxl_sched_credit_params_get(ctx, poolid, scinfo)) { -fprintf(stderr, "libxl_sched_credit_params_get failed.\n"); -return 1; -} - -return 0; -} - -static int sched_credit_domain_output(int domid) -{ -char *domname; -libxl_domain_sched_params scinfo; - -if (domid < 0) { -printf("%-33s %4s %6s %4s\n", "Name", "ID", "Weight", "Cap"); -return 0; -} - -libxl_domain_sched_params_init(&scinfo); -if (sched_domain_get(LIBXL_SCHEDULER_CREDIT, domid, &scinfo)) { -libxl_domain_sched_params_dispose(&scinfo); -return 1; -} -domname = libxl_domid_to_name(ctx, domid); -printf("%-33s %4d %6d %4d\n", -domname, -domid, -scinfo.weight, -scinfo.cap); -free(domname); -libxl_domain_sched_params_dispose(&scinfo); -return 0; -} - -static int sched_credit_pool_output(uint32_t poolid) -{ -libxl_sched_credit_params scparam; -char *poolname; - -poolname = libxl_cpupoolid
[Xen-devel] [PATCH 25/29] xl: split out miscellaneous functions
A collections of functions that don't warrant their own files. Moving main_devd there requires lifting do_daemonize to xl_utils.c. Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 390 -- tools/xl/xl_misc.c| 355 + tools/xl/xl_utils.c | 70 + tools/xl/xl_utils.h | 1 + 5 files changed, 427 insertions(+), 391 deletions(-) create mode 100644 tools/xl/xl_misc.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index b49e2cdcab..3e8361b121 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -19,7 +19,7 @@ XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o xl_mem.o -XL_OBJS += xl_psr.o xl_info.o xl_console.o +XL_OBJS += xl_psr.o xl_info.o xl_console.o xl_misc.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index d32e7fe6f1..7851fc03d4 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -222,74 +222,6 @@ release_lock: return rc; } -static int do_daemonize(char *name, const char *pidfile) -{ -char *fullname; -pid_t child1; -int nullfd, ret = 0; - -child1 = xl_fork(child_waitdaemon, "domain monitoring daemonizing child"); -if (child1) { -ret = child_report(child_waitdaemon); -if (ret) goto out; -ret = 1; -goto out; -} - -postfork(); - -ret = libxl_create_logfile(ctx, name, &fullname); -if (ret) { -LOG("failed to open logfile %s: %s",fullname,strerror(errno)); -exit(-1); -} - -CHK_SYSCALL(logfile = open(fullname, O_WRONLY|O_CREAT|O_APPEND, 0644)); -free(fullname); -assert(logfile >= 3); - -CHK_SYSCALL(nullfd = open("/dev/null", O_RDONLY)); -assert(nullfd >= 3); - -dup2(nullfd, 0); -dup2(logfile, 1); -dup2(logfile, 2); - -close(nullfd); - -CHK_SYSCALL(daemon(0, 1)); - -if (pidfile) { -int fd = open(pidfile, O_RDWR | O_CREAT, S_IRUSR|S_IWUSR); -char *pid = NULL; - -if (fd == -1) { -perror("Unable to open pidfile"); -exit(1); -} - -if (asprintf(&pid, "%ld\n", (long)getpid()) == -1) { -perror("Formatting pid"); -exit(1); -} - -if (write(fd, pid, strlen(pid)) < 0) { -perror("Writing pid"); -exit(1); -} - -if (close(fd) < 0) { -perror("Closing pidfile"); -exit(1); -} - -free(pid); -} - -out: -return ret; -} - static void reload_domain_config(uint32_t domid, libxl_domain_config *d_config) { @@ -1192,14 +1124,6 @@ static void reboot_domain(uint32_t domid, libxl_evgen_domain_death **deathw, } } -static void core_dump_domain(uint32_t domid, const char *filename) -{ -int rc; - -rc=libxl_domain_core_dump(ctx, domid, filename, NULL); -if (rc) { fprintf(stderr,"core dump failed (rc=%d)\n",rc);exit(EXIT_FAILURE); } -} - #ifndef LIBXL_HAVE_NO_SUSPEND_RESUME static void save_domain_core_begin(uint32_t domid, const char *override_config_file, @@ -1991,18 +1915,6 @@ int main_migrate(int argc, char **argv) } #endif -int main_dump_core(int argc, char **argv) -{ -int opt; - -SWITCH_FOREACH_OPT(opt, "", NULL, "dump-core", 2) { -/* No options */ -} - -core_dump_domain(xfind_domain(argv[optind]), argv[optind + 1]); -return EXIT_SUCCESS; -} - int main_pause(int argc, char **argv) { int opt; @@ -2220,246 +2132,6 @@ int main_create(int argc, char **argv) return 0; } -extern void printf_info(enum output_format output_format, -int domid, -libxl_domain_config *d_config, FILE *fh); -int main_config_update(int argc, char **argv) -{ -uint32_t domid; -const char *filename = NULL; -char *extra_config = NULL; -void *config_data = 0; -int config_len = 0; -libxl_domain_config d_config; -int opt, rc; -int debug = 0; -static struct option opts[] = { -{"defconfig", 1, 0, 'f'}, -COMMON_LONG_OPTS -}; - -if (argc < 2) { -fprintf(stderr, "xl config-update requires a domain argument\n"); -help("config-update"); -exit(1); -} - -fprintf(stderr, "WARNING: xl now has better capability to manage domain configuration, " -"avoid using this command when possible\n"); - -domid = xfind_domain(argv[1]); -argc--; argv++; - -if (argv[1] && argv[1][0] != '-' && !strchr(argv[1], '=')) { -filename = argv[1]; -argc--; argv++; -} - -SWITCH_FOREACH_OPT(opt, "dqf:", opts, "config_update", 0) { -
[Xen-devel] [PATCH 19/29] xl: split out vcpu related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 306 - tools/xl/xl_vcpu.c| 337 ++ 3 files changed, 338 insertions(+), 307 deletions(-) create mode 100644 tools/xl/xl_vcpu.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 0af1e92b65..e6e8cef710 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -18,7 +18,7 @@ CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o -XL_OBJS += xl_sched.o xl_pci.o +XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index b32233e95e..faeac675ad 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -2885,312 +2885,6 @@ int main_button_press(int argc, char **argv) return 0; } -static void print_vcpuinfo(uint32_t tdomid, - const libxl_vcpuinfo *vcpuinfo, - uint32_t nr_cpus) -{ -char *domname; - -/* NAME ID VCPU */ -domname = libxl_domid_to_name(ctx, tdomid); -printf("%-32s %5u %5u", - domname, tdomid, vcpuinfo->vcpuid); -free(domname); -if (!vcpuinfo->online) { -/* CPU STA */ -printf("%5c %3c%cp ", '-', '-', '-'); -} else { -/* CPU STA */ -printf("%5u %3c%c- ", vcpuinfo->cpu, - vcpuinfo->running ? 'r' : '-', - vcpuinfo->blocked ? 'b' : '-'); -} -/* TIM */ -printf("%9.1f ", ((float)vcpuinfo->vcpu_time / 1e9)); -/* CPU HARD AND SOFT AFFINITY */ -print_bitmap(vcpuinfo->cpumap.map, nr_cpus, stdout); -printf(" / "); -print_bitmap(vcpuinfo->cpumap_soft.map, nr_cpus, stdout); -printf("\n"); -} - -static void print_domain_vcpuinfo(uint32_t domid, uint32_t nr_cpus) -{ -libxl_vcpuinfo *vcpuinfo; -int i, nb_vcpu, nrcpus; - -vcpuinfo = libxl_list_vcpu(ctx, domid, &nb_vcpu, &nrcpus); - -if (!vcpuinfo) -return; - -for (i = 0; i < nb_vcpu; i++) { -print_vcpuinfo(domid, &vcpuinfo[i], nr_cpus); -} - -libxl_vcpuinfo_list_free(vcpuinfo, nb_vcpu); -} - -static void vcpulist(int argc, char **argv) -{ -libxl_dominfo *dominfo; -libxl_physinfo physinfo; -int i, nb_domain; - -if (libxl_get_physinfo(ctx, &physinfo) != 0) { -fprintf(stderr, "libxl_physinfo failed.\n"); -goto vcpulist_out; -} - -printf("%-32s %5s %5s %5s %5s %9s %s\n", - "Name", "ID", "VCPU", "CPU", "State", "Time(s)", - "Affinity (Hard / Soft)"); -if (!argc) { -if (!(dominfo = libxl_list_domain(ctx, &nb_domain))) { -fprintf(stderr, "libxl_list_domain failed.\n"); -goto vcpulist_out; -} - -for (i = 0; i 0; ++argv, --argc) { -uint32_t domid = xfind_domain(*argv); -print_domain_vcpuinfo(domid, physinfo.nr_cpus); -} -} - vcpulist_out: -libxl_physinfo_dispose(&physinfo); -} - -int main_vcpulist(int argc, char **argv) -{ -int opt; - -SWITCH_FOREACH_OPT(opt, "", NULL, "vcpu-list", 0) { -/* No options */ -} - -vcpulist(argc - optind, argv + optind); -return EXIT_SUCCESS; -} - -int main_vcpupin(int argc, char **argv) -{ -static struct option opts[] = { -{"force", 0, 0, 'f'}, -COMMON_LONG_OPTS -}; -libxl_vcpuinfo *vcpuinfo; -libxl_bitmap cpumap_hard, cpumap_soft;; -libxl_bitmap *soft = &cpumap_soft, *hard = &cpumap_hard; -uint32_t domid; -/* - * int would be enough for vcpuid, but we don't want to - * mess aroung range checking the return value of strtol(). - */ -long vcpuid; -const char *vcpu, *hard_str, *soft_str; -char *endptr; -int opt, nb_cpu, nb_vcpu, rc = EXIT_FAILURE; -bool force = false; - -libxl_bitmap_init(&cpumap_hard); -libxl_bitmap_init(&cpumap_soft); - -SWITCH_FOREACH_OPT(opt, "f", opts, "vcpu-pin", 3) { -case 'f': -force = true; -break; -default: -break; -} - -domid = xfind_domain(argv[optind]); -vcpu = argv[optind+1]; -hard_str = argv[optind+2]; -soft_str = (argc > optind+3) ? argv[optind+3] : NULL; - -/* Figure out with which vCPU we are dealing with */ -vcpuid = strtol(vcpu, &endptr, 10); -if (vcpu == endptr || vcpuid < 0) { -if (strcmp(vcpu, "all")) { -fprintf(stderr, "Error: Invalid argument %s as VCPU.\n", vcpu); -goto out; -} -if (force) { -fprintf(stderr, "Error: --force and 'all' as VCPU not allowed.\n"); -goto out; -} -vcpuid = -1; -} - -if (libxl_cpu_bitmap_alloc(ctx, &cpumap_hard, 0) || -libxl_cpu_bitmap_alloc(ctx,
[Xen-devel] [PATCH 27/29] xl: split out save/restore related code
Add some function declarations to xl.h because they are now needed in multiple files. Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl.h | 6 + tools/xl/xl_cmdimpl.c | 227 -- tools/xl/xl_saverestore.c | 273 ++ 4 files changed, 280 insertions(+), 228 deletions(-) create mode 100644 tools/xl/xl_saverestore.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 0f966684be..9982b936c4 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -20,7 +20,7 @@ XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o xl_mem.o XL_OBJS += xl_psr.o xl_info.o xl_console.o xl_misc.o -XL_OBJS += xl_vmcontrol.o +XL_OBJS += xl_vmcontrol.o xl_saverestore.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl.h b/tools/xl/xl.h index 62d010076b..65b89ce717 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -96,6 +96,12 @@ struct save_file_header { #define SAVEFILE_BYTEORDER_VALUE ((uint32_t)0x01020304UL) +void save_domain_core_begin(uint32_t domid, +const char *override_config_file, +uint8_t **config_data_r, +int *config_len_r); +void save_domain_core_writeconfig(int fd, const char *source, + const uint8_t *config_data, int config_len); /* * The xl process should always return either EXIT_SUCCESS or diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index b3a17d5fa6..c41ae31814 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -99,133 +99,6 @@ void help(const char *command) } #ifndef LIBXL_HAVE_NO_SUSPEND_RESUME -static void save_domain_core_begin(uint32_t domid, - const char *override_config_file, - uint8_t **config_data_r, - int *config_len_r) -{ -int rc; -libxl_domain_config d_config; -char *config_c = 0; - -/* configuration file in optional data: */ - -libxl_domain_config_init(&d_config); - -if (override_config_file) { -void *config_v = 0; -rc = libxl_read_file_contents(ctx, override_config_file, - &config_v, config_len_r); -if (rc) { -fprintf(stderr, "unable to read overridden config file\n"); -exit(EXIT_FAILURE); -} -parse_config_data(override_config_file, config_v, *config_len_r, - &d_config); -free(config_v); -} else { -rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config); -if (rc) { -fprintf(stderr, "unable to retrieve domain configuration\n"); -exit(EXIT_FAILURE); -} -} - -config_c = libxl_domain_config_to_json(ctx, &d_config); -if (!config_c) { -fprintf(stderr, "unable to convert config file to JSON\n"); -exit(EXIT_FAILURE); -} -*config_data_r = (uint8_t *)config_c; -*config_len_r = strlen(config_c) + 1; /* including trailing '\0' */ - -libxl_domain_config_dispose(&d_config); -} - -static void save_domain_core_writeconfig(int fd, const char *source, - const uint8_t *config_data, int config_len) -{ -struct save_file_header hdr; -uint8_t *optdata_begin; -union { uint32_t u32; char b[4]; } u32buf; - -memset(&hdr, 0, sizeof(hdr)); -memcpy(hdr.magic, savefileheader_magic, sizeof(hdr.magic)); -hdr.byteorder = SAVEFILE_BYTEORDER_VALUE; -hdr.mandatory_flags = XL_MANDATORY_FLAG_STREAMv2; - -optdata_begin= 0; - -#define ADD_OPTDATA(ptr, len) ({\ -if ((len)) {\ -hdr.optional_data_len += (len); \ -optdata_begin = xrealloc(optdata_begin, hdr.optional_data_len); \ -memcpy(optdata_begin + hdr.optional_data_len - (len), \ - (ptr), (len)); \ -} \ - }) - -u32buf.u32 = config_len; -ADD_OPTDATA(u32buf.b,4); -ADD_OPTDATA(config_data, config_len); -if (config_len) -hdr.mandatory_flags |= XL_MANDATORY_FLAG_JSON; - -/* that's the optional data */ - -CHK_ERRNOVAL(libxl_write_exactly( - ctx, fd, &hdr, sizeof(hdr), source, "header")); -CHK_ERRNOVAL(libxl_write_exactly( - ctx, fd, optdata_begin, hdr.optional_data_len, - source, "header")); - -free(optdata_begin); - -fprintf(stderr, "Saving to %s new xl format (info" -" 0x%"PRIx32"/0x%"PRIx32"/%"PRI
[Xen-devel] [PATCH 15/29] xl: split out network related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 140 tools/xl/xl_nic.c | 172 ++ 3 files changed, 173 insertions(+), 141 deletions(-) create mode 100644 tools/xl/xl_nic.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 331ae21293..c2f2ca38f4 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -17,7 +17,7 @@ CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o -XL_OBJS += xl_vtpm.o xl_block.o +XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 56524fe707..eab7865bef 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -364,31 +364,6 @@ out: return ret; } -void set_default_nic_values(libxl_device_nic *nic); -void set_default_nic_values(libxl_device_nic *nic) -{ - -if (default_vifscript) { -free(nic->script); -nic->script = strdup(default_vifscript); -} - -if (default_bridge) { -free(nic->bridge); -nic->bridge = strdup(default_bridge); -} - -if (default_gatewaydev) { -free(nic->gatewaydev); -nic->gatewaydev = strdup(default_gatewaydev); -} - -if (default_vifbackend) { -free(nic->backend_domname); -nic->backend_domname = strdup(default_vifbackend); -} -} - static void reload_domain_config(uint32_t domid, libxl_domain_config *d_config) { @@ -5017,121 +4992,6 @@ int main_top(int argc, char **argv) return system("xentop"); } -int main_networkattach(int argc, char **argv) -{ -uint32_t domid; -int opt; -libxl_device_nic nic; -XLU_Config *config = 0; - -SWITCH_FOREACH_OPT(opt, "", NULL, "network-attach", 1) { -/* No options */ -} - -domid = xfind_domain(argv[optind]); - -config= xlu_cfg_init(stderr, "command line"); -if (!config) { -fprintf(stderr, "Failed to allocate for configuration\n"); -return 1; -} - -libxl_device_nic_init(&nic); -set_default_nic_values(&nic); - -for (argv += optind+1, argc -= optind+1; argc > 0; ++argv, --argc) { -if (parse_nic_config(&nic, &config, *argv)) -return 1; -} - -if (dryrun_only) { -char *json = libxl_device_nic_to_json(ctx, &nic); -printf("vif: %s\n", json); -free(json); -libxl_device_nic_dispose(&nic); -if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); } -return 0; -} - -if (libxl_device_nic_add(ctx, domid, &nic, 0)) { -fprintf(stderr, "libxl_device_nic_add failed.\n"); -return 1; -} -libxl_device_nic_dispose(&nic); -xlu_cfg_destroy(config); -return 0; -} - -int main_networklist(int argc, char **argv) -{ -int opt; -libxl_device_nic *nics; -libxl_nicinfo nicinfo; -int nb, i; - -SWITCH_FOREACH_OPT(opt, "", NULL, "network-list", 1) { -/* No options */ -} - -/* Idx BE MAC Hdl Sta evch txr/rxr BE-path */ -printf("%-3s %-2s %-17s %-6s %-5s %-6s %5s/%-5s %-30s\n", - "Idx", "BE", "Mac Addr.", "handle", "state", "evt-ch", "tx-", "rx-ring-ref", "BE-path"); -for (argv += optind, argc -= optind; argc > 0; --argc, ++argv) { -uint32_t domid = xfind_domain(*argv); -nics = libxl_device_nic_list(ctx, domid, &nb); -if (!nics) { -continue; -} -for (i = 0; i < nb; ++i) { -if (!libxl_device_nic_getinfo(ctx, domid, &nics[i], &nicinfo)) { -/* Idx BE */ -printf("%-3d %-2d ", nicinfo.devid, nicinfo.backend_id); -/* MAC */ -printf(LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nics[i].mac)); -/* Hdl Sta evch txr/rxr BE-path */ -printf("%6d %5d %6d %5d/%-11d %-30s\n", - nicinfo.devid, nicinfo.state, nicinfo.evtch, - nicinfo.rref_tx, nicinfo.rref_rx, nicinfo.backend); -libxl_nicinfo_dispose(&nicinfo); -} -libxl_device_nic_dispose(&nics[i]); -} -free(nics); -} -return 0; -} - -int main_networkdetach(int argc, char **argv) -{ -uint32_t domid; -int opt; -libxl_device_nic nic; - -SWITCH_FOREACH_OPT(opt, "", NULL, "network-detach", 2) { -/* No options */ -} - -domid = xfind_domain(argv[optind]); - -if (!strchr(argv[optind+1], ':')) { -if (libxl_devid_to_device_nic(ctx, domid, atoi(argv[optind+1]), &nic)) { -fprintf(stderr, "Unknown device %s.\n", argv[optind+1]); -return 1; -} -} else { -if (libxl_mac_to_device_nic(ctx, domid, argv[optind+1], &nic)) { -fprintf(s
[Xen-devel] [PATCH 11/29] xl: split out cpupool related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 592 --- tools/xl/xl_cpupool.c | 624 ++ 3 files changed, 625 insertions(+), 593 deletions(-) create mode 100644 tools/xl/xl_cpupool.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index d7f7f01549..0ff7ef9bfe 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -16,7 +16,7 @@ CFLAGS_XL += $(CFLAGS_libxenlight) CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o -XL_OBJS += xl_tmem.o xl_parse.o +XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 812f570d0d..82b30bb094 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -5611,598 +5611,6 @@ int main_uptime(int argc, char **argv) return 0; } - -int main_cpupoolcreate(int argc, char **argv) -{ -const char *filename = NULL, *config_src=NULL; -const char *p; -char *extra_config = NULL; -int opt; -static struct option opts[] = { -{"defconfig", 1, 0, 'f'}, -{"dryrun", 0, 0, 'n'}, -COMMON_LONG_OPTS -}; -int ret; -char *config_data = 0; -int config_len = 0; -XLU_Config *config; -const char *buf; -char *name = NULL; -uint32_t poolid; -libxl_scheduler sched = 0; -XLU_ConfigList *cpus; -XLU_ConfigList *nodes; -int n_cpus, n_nodes, i, n; -libxl_bitmap freemap; -libxl_bitmap cpumap; -libxl_uuid uuid; -libxl_cputopology *topology; -int rc = EXIT_FAILURE; - -SWITCH_FOREACH_OPT(opt, "nf:", opts, "cpupool-create", 0) { -case 'f': -filename = optarg; -break; -case 'n': -dryrun_only = 1; -break; -} - -libxl_bitmap_init(&freemap); -libxl_bitmap_init(&cpumap); - -while (optind < argc) { -if ((p = strchr(argv[optind], '='))) { -xstring_realloc_append(&extra_config, "\n"); -xstring_realloc_append(&extra_config, argv[optind]); -} else if (!filename) { -filename = argv[optind]; -} else { -help("cpupool-create"); -goto out; -} -optind++; -} - -if (filename) -{ -if (libxl_read_file_contents(ctx, filename, (void **)&config_data, - &config_len)) { -fprintf(stderr, "Failed to read config file: %s: %s\n", -filename, strerror(errno)); -goto out; -} -config_src=filename; -} -else -config_src="command line"; - -if (extra_config && strlen(extra_config)) { -if (config_len > INT_MAX - (strlen(extra_config) + 2)) { -fprintf(stderr, "Failed to attach extra configuration\n"); -goto out; -} -config_data = xrealloc(config_data, - config_len + strlen(extra_config) + 2); -if (!config_data) { -fprintf(stderr, "Failed to realloc config_data\n"); -goto out; -} -config_data[config_len] = 0; -strcat(config_data, extra_config); -strcat(config_data, "\n"); -config_len += strlen(extra_config) + 1; -} - -config = xlu_cfg_init(stderr, config_src); -if (!config) { -fprintf(stderr, "Failed to allocate for configuration\n"); -goto out; -} - -ret = xlu_cfg_readdata(config, config_data, config_len); -if (ret) { -fprintf(stderr, "Failed to parse config file: %s\n", strerror(ret)); -goto out_cfg; -} - -if (!xlu_cfg_get_string (config, "name", &buf, 0)) -name = strdup(buf); -else if (filename) -name = libxl_basename(filename); -else { -fprintf(stderr, "Missing cpupool name!\n"); -goto out_cfg; -} -if (!libxl_name_to_cpupoolid(ctx, name, &poolid)) { -fprintf(stderr, "Pool name \"%s\" already exists\n", name); -goto out_cfg; -} - -if (!xlu_cfg_get_string (config, "sched", &buf, 0)) { -if ((libxl_scheduler_from_string(buf, &sched)) < 0) { -fprintf(stderr, "Unknown scheduler\n"); -goto out_cfg; -} -} else { -rc = libxl_get_scheduler(ctx); -if (rc < 0) { -fprintf(stderr, "get_scheduler sysctl failed.\n"); -goto out_cfg; -} -sched = rc; -} - -if (libxl_get_freecpus(ctx, &freemap)) { -fprintf(stderr, "libxl_get_freecpus failed\n"); -goto out_cfg; -} -if (libxl_cpu_bitmap_alloc(ctx, &cpumap, 0)) { -fprintf(stderr, "Failed to allocate cpumap\n"); -goto out_cfg; -} -if (!xlu_cfg_get_list(config, "nodes", &nodes, 0, 0)) { -int nr; -n_cpus = 0; -n_nodes = 0; -topology = libxl_get_c
[Xen-devel] [PATCH 29/29] xl: merge xl_cmdimpl.c into xl.c
After splitting out all the meaty bits, xl_cmdimpl.c doesn't contain much. Merge the rest into xl.c and delete the file. Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl.c | 58 +++ tools/xl/xl_cmdimpl.c | 107 -- 3 files changed, 59 insertions(+), 108 deletions(-) delete mode 100644 tools/xl/xl_cmdimpl.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 8c30fdcf9e..7b73e1b574 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -15,7 +15,7 @@ LDFLAGS += $(PTHREAD_LDFLAGS) CFLAGS_XL += $(CFLAGS_libxenlight) CFLAGS_XL += -Wshadow -XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o +XL_OBJS = xl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o xl_mem.o diff --git a/tools/xl/xl.c b/tools/xl/xl.c index 32346ad7a5..02179a6229 100644 --- a/tools/xl/xl.c +++ b/tools/xl/xl.c @@ -48,6 +48,15 @@ bool progress_use_cr = 0; xentoollog_level minmsglevel = minmsglevel_default; +int logfile = 2; + +/* every libxl action in xl uses this same libxl context */ +libxl_ctx *ctx; + +xlchild children[child_max]; + +const char *common_domname; + /* Get autoballoon option based on presence of dom0_mem Xen command line option. */ static int auto_autoballoon(void) @@ -370,6 +379,55 @@ int main(int argc, char **argv) return ret; } +int child_report(xlchildnum child) +{ +int status; +pid_t got = xl_waitpid(child, &status, 0); +if (got < 0) { +fprintf(stderr, "xl: warning, failed to waitpid for %s: %s\n", +children[child].description, strerror(errno)); +return ERROR_FAIL; +} else if (status) { +xl_report_child_exitstatus(XTL_ERROR, child, got, status); +return ERROR_FAIL; +} else { +return 0; +} +} + +void help(const char *command) +{ +int i; +struct cmd_spec *cmd; + +if (!command || !strcmp(command, "help")) { +printf("Usage xl [-vfN] [args]\n\n"); +printf("xl full list of subcommands:\n\n"); +for (i = 0; i < cmdtable_len; i++) { +printf(" %-19s ", cmd_table[i].cmd_name); +if (strlen(cmd_table[i].cmd_name) > 19) +printf("\n %-19s ", ""); +printf("%s\n", cmd_table[i].cmd_desc); +} +} else { +cmd = cmdtable_lookup(command); +if (cmd) { +printf("Usage: xl [-v%s%s] %s %s\n\n%s.\n\n", + cmd->modifies ? "f" : "", + cmd->can_dryrun ? "N" : "", + cmd->cmd_name, + cmd->cmd_usage, + cmd->cmd_desc); +if (cmd->cmd_option) +printf("Options:\n\n%s\n", cmd->cmd_option); +} +else { +printf("command \"%s\" not implemented\n", command); +} +} +} + + /* * Local variables: * mode: C diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c deleted file mode 100644 index bd7f8edb0a..00 --- a/tools/xl/xl_cmdimpl.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2009-2017 Citrix Ltd and other contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; version 2.1 only. with the special - * exception on linking described in file LICENSE. - * - * 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 Lesser General Public License for more details. - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for utsname in xl info */ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "xl.h" -#include "xl_utils.h" -#include "xl_parse.h" - -int logfile = 2; - -/* every libxl action in xl uses this same libxl context */ -libxl_ctx *ctx; - -xlchild children[child_max]; - -const char *common_domname; - -int child_report(xlchildnum child) -{ -int status; -pid_t got = xl_waitpid(child, &status, 0); -if (got < 0) { -fprintf(stderr, "xl: warning, failed to waitpid for %s: %s\n", -children[child].description, strerror(errno)); -return ERROR_FAIL; -} else if (status) { -xl_report_child_exitstatus(XTL_ERROR, child, got, status); -return ERROR_FAIL; -} else { -return 0; -} -} - -void help(const char *command) -{ -int i; -struct cmd_spec *cmd; - -if (!command || !strcmp(command, "help")) { -printf("Usage xl [-vfN] [args]\n\n"); -printf("x
[Xen-devel] [PATCH 23/29] xl: split out functions to print out information
Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 883 +-- tools/xl/xl_info.c| 925 ++ 3 files changed, 929 insertions(+), 881 deletions(-) create mode 100644 tools/xl/xl_info.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index fdb64fed1d..c51106e49e 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -19,7 +19,7 @@ XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o xl_mem.o -XL_OBJS += xl_psr.o +XL_OBJS += xl_psr.o xl_info.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index f6942ffbe8..1de5445e7f 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -222,80 +222,6 @@ release_lock: return rc; } -static yajl_gen_status printf_info_one_json(yajl_gen hand, int domid, -libxl_domain_config *d_config) -{ -yajl_gen_status s; - -s = yajl_gen_map_open(hand); -if (s != yajl_gen_status_ok) -goto out; - -s = yajl_gen_string(hand, (const unsigned char *)"domid", -sizeof("domid")-1); -if (s != yajl_gen_status_ok) -goto out; -if (domid != -1) -s = yajl_gen_integer(hand, domid); -else -s = yajl_gen_null(hand); -if (s != yajl_gen_status_ok) -goto out; - -s = yajl_gen_string(hand, (const unsigned char *)"config", -sizeof("config")-1); -if (s != yajl_gen_status_ok) -goto out; -s = libxl_domain_config_gen_json(hand, d_config); -if (s != yajl_gen_status_ok) -goto out; - -s = yajl_gen_map_close(hand); -if (s != yajl_gen_status_ok) -goto out; - -out: -return s; -} - -static void printf_info(enum output_format output_format, -int domid, -libxl_domain_config *d_config, FILE *fh) -{ -if (output_format == OUTPUT_FORMAT_SXP) -return printf_info_sexp(domid, d_config, fh); - -const char *buf; -libxl_yajl_length len = 0; -yajl_gen_status s; -yajl_gen hand; - -hand = libxl_yajl_gen_alloc(NULL); -if (!hand) { -fprintf(stderr, "unable to allocate JSON generator\n"); -return; -} - -s = printf_info_one_json(hand, domid, d_config); -if (s != yajl_gen_status_ok) -goto out; - -s = yajl_gen_get_buf(hand, (const unsigned char **)&buf, &len); -if (s != yajl_gen_status_ok) -goto out; - -fputs(buf, fh); - -out: -yajl_gen_free(hand); - -if (s != yajl_gen_status_ok) -fprintf(stderr, -"unable to format domain config as JSON (YAJL:%d)\n", s); - -xflush_stream(fh); -} - static int do_daemonize(char *name, const char *pidfile) { char *fullname; @@ -1320,165 +1246,6 @@ static void reboot_domain(uint32_t domid, libxl_evgen_domain_death **deathw, } } -static void list_domains_details(const libxl_dominfo *info, int nb_domain) -{ -libxl_domain_config d_config; - -int i, rc; - -yajl_gen hand = NULL; -yajl_gen_status s; -const char *buf; -libxl_yajl_length yajl_len = 0; - -if (default_output_format == OUTPUT_FORMAT_JSON) { -hand = libxl_yajl_gen_alloc(NULL); -if (!hand) { -fprintf(stderr, "unable to allocate JSON generator\n"); -return; -} - -s = yajl_gen_array_open(hand); -if (s != yajl_gen_status_ok) -goto out; -} else -s = yajl_gen_status_ok; - -for (i = 0; i < nb_domain; i++) { -libxl_domain_config_init(&d_config); -rc = libxl_retrieve_domain_configuration(ctx, info[i].domid, &d_config); -if (rc) -continue; -if (default_output_format == OUTPUT_FORMAT_JSON) -s = printf_info_one_json(hand, info[i].domid, &d_config); -else -printf_info_sexp(info[i].domid, &d_config, stdout); -libxl_domain_config_dispose(&d_config); -if (s != yajl_gen_status_ok) -goto out; -} - -if (default_output_format == OUTPUT_FORMAT_JSON) { -s = yajl_gen_array_close(hand); -if (s != yajl_gen_status_ok) -goto out; - -s = yajl_gen_get_buf(hand, (const unsigned char **)&buf, &yajl_len); -if (s != yajl_gen_status_ok) -goto out; - -puts(buf); -} - -out: -if (default_output_format == OUTPUT_FORMAT_JSON) { -yajl_gen_free(hand); -if (s != yajl_gen_status_ok) -fprintf(stderr, -"unable to format domain config as JSON (YAJL:%d)\n", s); -} -} - -static void list_domains(bool verbose, bool context, bool claim, bool numa, -
[Xen-devel] [PATCH 20/29] xl: split out cd related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cd.c | 114 ++ tools/xl/xl_cmdimpl.c | 80 --- 3 files changed, 115 insertions(+), 81 deletions(-) create mode 100644 tools/xl/xl_cd.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index e6e8cef710..89cf9069e0 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -18,7 +18,7 @@ CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o -XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o +XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cd.c b/tools/xl/xl_cd.c new file mode 100644 index 00..d99f461c6d --- /dev/null +++ b/tools/xl/xl_cd.c @@ -0,0 +1,114 @@ +/* + * Copyright 2009-2017 Citrix Ltd and other contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking described in file LICENSE. + * + * 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 Lesser General Public License for more details. + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include "xl.h" +#include "xl_utils.h" +#include "xl_parse.h" + +static int cd_insert(uint32_t domid, const char *virtdev, char *phys) +{ +libxl_device_disk disk; +char *buf = NULL; +XLU_Config *config = 0; +struct stat b; +int r; + +xasprintf(&buf, "vdev=%s,access=r,devtype=cdrom,target=%s", + virtdev, phys ? phys : ""); + +parse_disk_config(&config, buf, &disk); + +/* ATM the existence of the backing file is not checked for qdisk + * in libxl_cdrom_insert() because RAW is used for remote + * protocols as well as plain files. This will ideally be changed + * for 4.4, but this work-around fixes the problem of "cd-insert" + * returning success for non-existent files. */ +if (disk.format != LIBXL_DISK_FORMAT_EMPTY +&& stat(disk.pdev_path, &b)) { +fprintf(stderr, "Cannot stat file: %s\n", +disk.pdev_path); +r = 1; +goto out; +} + +if (libxl_cdrom_insert(ctx, domid, &disk, NULL)) { +r = 1; +goto out; +} + +r = 0; + +out: +libxl_device_disk_dispose(&disk); +free(buf); + +return r; +} + +int main_cd_eject(int argc, char **argv) +{ +uint32_t domid; +int opt = 0; +const char *virtdev; + +SWITCH_FOREACH_OPT(opt, "", NULL, "cd-eject", 2) { +/* No options */ +} + +domid = xfind_domain(argv[optind]); +virtdev = argv[optind + 1]; + +if (cd_insert(domid, virtdev, NULL)) +return EXIT_FAILURE; + +return EXIT_SUCCESS; +} + +int main_cd_insert(int argc, char **argv) +{ +uint32_t domid; +int opt = 0; +const char *virtdev; +char *file = NULL; /* modified by cd_insert tokenising it */ + +SWITCH_FOREACH_OPT(opt, "", NULL, "cd-insert", 3) { +/* No options */ +} + +domid = xfind_domain(argv[optind]); +virtdev = argv[optind + 1]; +file = argv[optind + 2]; + +if (cd_insert(domid, virtdev, file)) +return EXIT_FAILURE; + +return EXIT_SUCCESS; +} + +/* + * Local variables: + * mode: C + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index faeac675ad..e15baae861 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -1213,86 +1213,6 @@ int main_memset(int argc, char **argv) return set_memory_target(domid, mem); } -static int cd_insert(uint32_t domid, const char *virtdev, char *phys) -{ -libxl_device_disk disk; -char *buf = NULL; -XLU_Config *config = 0; -struct stat b; -int r; - -xasprintf(&buf, "vdev=%s,access=r,devtype=cdrom,target=%s", - virtdev, phys ? phys : ""); - -parse_disk_config(&config, buf, &disk); - -/* ATM the existence of the backing file is not checked for qdisk - * in libxl_cdrom_insert() because RAW is used for remote - * protocols as well as plain files. This will ideally be changed - * for 4.4, but this work-around fixes the problem of "cd-insert" - * returning success for non-existent files. */ -if (disk.format != LIBXL_DISK_FORMAT_EMPTY -&& stat(disk.pdev_path, &b)) { -fprintf(stderr, "Cannot stat file: %s\n", -disk.pdev_path); -r = 1; -goto out; -} - -if (libxl_cdrom_insert(ctx, domid, &disk, NULL)) { -
[Xen-devel] [PATCH 21/29] xl: split out memory related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 136 tools/xl/xl_mem.c | 167 ++ 3 files changed, 168 insertions(+), 137 deletions(-) create mode 100644 tools/xl/xl_mem.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 89cf9069e0..964da8e705 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -18,7 +18,7 @@ CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o -XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o +XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o xl_mem.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index e15baae861..35d81417ec 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -1145,74 +1145,6 @@ void help(const char *command) } } -static int set_memory_max(uint32_t domid, const char *mem) -{ -int64_t memorykb; - -memorykb = parse_mem_size_kb(mem); -if (memorykb == -1) { -fprintf(stderr, "invalid memory size: %s\n", mem); -return EXIT_FAILURE; -} - -if (libxl_domain_setmaxmem(ctx, domid, memorykb)) { -fprintf(stderr, "cannot set domid %u static max memory to : %s\n", domid, mem); -return EXIT_FAILURE; -} - -return EXIT_SUCCESS; -} - -int main_memmax(int argc, char **argv) -{ -uint32_t domid; -int opt = 0; -char *mem; - -SWITCH_FOREACH_OPT(opt, "", NULL, "mem-max", 2) { -/* No options */ -} - -domid = xfind_domain(argv[optind]); -mem = argv[optind + 1]; - -return set_memory_max(domid, mem); -} - -static int set_memory_target(uint32_t domid, const char *mem) -{ -int64_t memorykb; - -memorykb = parse_mem_size_kb(mem); -if (memorykb == -1) { -fprintf(stderr, "invalid memory size: %s\n", mem); -return EXIT_FAILURE; -} - -if (libxl_set_memory_target(ctx, domid, memorykb, 0, /* enforce */ 1)) { -fprintf(stderr, "cannot set domid %u dynamic max memory to : %s\n", domid, mem); -return EXIT_FAILURE; -} - -return EXIT_SUCCESS; -} - -int main_memset(int argc, char **argv) -{ -uint32_t domid; -int opt = 0; -const char *mem; - -SWITCH_FOREACH_OPT(opt, "", NULL, "mem-set", 2) { -/* No options */ -} - -domid = xfind_domain(argv[optind]); -mem = argv[optind + 1]; - -return set_memory_target(domid, mem); -} - int main_console(int argc, char **argv) { uint32_t domid; @@ -3056,74 +2988,6 @@ int main_info(int argc, char **argv) return 0; } -static void sharing(const libxl_dominfo *info, int nb_domain) -{ -int i; - -printf("NameID Mem Shared\n"); - -for (i = 0; i < nb_domain; i++) { -char *domname; -unsigned shutdown_reason; -domname = libxl_domid_to_name(ctx, info[i].domid); -shutdown_reason = info[i].shutdown ? info[i].shutdown_reason : 0; -printf("%-40s %5d %5lu %5lu\n", -domname, -info[i].domid, -(unsigned long) ((info[i].current_memkb + -info[i].outstanding_memkb) / 1024), -(unsigned long) (info[i].shared_memkb / 1024)); -free(domname); -} -} - -int main_sharing(int argc, char **argv) -{ -int opt = 0; -libxl_dominfo info_buf; -libxl_dominfo *info, *info_free = NULL; -int nb_domain, rc; - -SWITCH_FOREACH_OPT(opt, "", NULL, "sharing", 0) { -/* No options */ -} - -if (optind >= argc) { -info = libxl_list_domain(ctx, &nb_domain); -if (!info) { -fprintf(stderr, "libxl_list_domain failed.\n"); -return EXIT_FAILURE; -} -info_free = info; -} else if (optind == argc-1) { -uint32_t domid = xfind_domain(argv[optind]); -rc = libxl_domain_info(ctx, &info_buf, domid); -if (rc == ERROR_DOMAIN_NOTFOUND) { -fprintf(stderr, "Error: Domain \'%s\' does not exist.\n", -argv[optind]); -return EXIT_FAILURE; -} -if (rc) { -fprintf(stderr, "libxl_domain_info failed (code %d).\n", rc); -return EXIT_FAILURE; -} -info = &info_buf; -nb_domain = 1; -} else { -help("sharing"); -return EXIT_FAILURE; -} - -sharing(info, nb_domain); - -if (info_free) -libxl_dominfo_list_free(info_free, nb_domain); -else -libxl_dominfo_dispose(info); - -return EXIT_SUCCESS; -} - int main_domid(int argc, char **argv) { uint32_t domid; diff --git a/tools/xl/xl_mem.c b/tools/xl/xl_mem.c new file mode 100644 index 00..736d1f8f34 --- /dev/null +++ b/tools/xl/xl_mem.c @@ -0,0
[Xen-devel] [PATCH 16/29] xl: split out usb related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 190 -- tools/xl/xl_usb.c | 222 ++ 3 files changed, 223 insertions(+), 191 deletions(-) create mode 100644 tools/xl/xl_usb.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index c2f2ca38f4..45ddc255f5 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -17,7 +17,7 @@ CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o -XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o +XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index eab7865bef..386f96b4cc 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -1293,196 +1293,6 @@ int main_cd_insert(int argc, char **argv) return EXIT_SUCCESS; } -int main_usbctrl_attach(int argc, char **argv) -{ -uint32_t domid; -int opt, rc = 0; -libxl_device_usbctrl usbctrl; - -SWITCH_FOREACH_OPT(opt, "", NULL, "usbctrl-attach", 1) { -/* No options */ -} - -domid = xfind_domain(argv[optind++]); - -libxl_device_usbctrl_init(&usbctrl); - -for (argv += optind, argc -= optind; argc > 0; ++argv, --argc) { -if (parse_usbctrl_config(&usbctrl, *argv)) -return 1; -} - -rc = libxl_device_usbctrl_add(ctx, domid, &usbctrl, 0); -if (rc) { -fprintf(stderr, "libxl_device_usbctrl_add failed.\n"); -rc = 1; -} - -libxl_device_usbctrl_dispose(&usbctrl); -return rc; -} - -int main_usbctrl_detach(int argc, char **argv) -{ -uint32_t domid; -int opt, devid, rc; -libxl_device_usbctrl usbctrl; - -SWITCH_FOREACH_OPT(opt, "", NULL, "usbctrl-detach", 2) { -/* No options */ -} - -domid = xfind_domain(argv[optind]); -devid = atoi(argv[optind+1]); - -libxl_device_usbctrl_init(&usbctrl); -if (libxl_devid_to_device_usbctrl(ctx, domid, devid, &usbctrl)) { -fprintf(stderr, "Unknown device %s.\n", argv[optind+1]); -return 1; -} - -rc = libxl_device_usbctrl_remove(ctx, domid, &usbctrl, 0); -if (rc) { -fprintf(stderr, "libxl_device_usbctrl_remove failed.\n"); -rc = 1; -} - -libxl_device_usbctrl_dispose(&usbctrl); -return rc; - -} - -int main_usbdev_attach(int argc, char **argv) -{ -uint32_t domid; -int opt, rc; -libxl_device_usbdev usbdev; - -SWITCH_FOREACH_OPT(opt, "", NULL, "usbdev-attach", 2) { -/* No options */ -} - -libxl_device_usbdev_init(&usbdev); - -domid = xfind_domain(argv[optind++]); - -for (argv += optind, argc -= optind; argc > 0; ++argv, --argc) { -if (parse_usbdev_config(&usbdev, *argv)) -return 1; -} - -rc = libxl_device_usbdev_add(ctx, domid, &usbdev, 0); -if (rc) { -fprintf(stderr, "libxl_device_usbdev_add failed.\n"); -rc = 1; -} - -libxl_device_usbdev_dispose(&usbdev); -return rc; -} - -int main_usbdev_detach(int argc, char **argv) -{ -uint32_t domid; -int ctrl, port; -int opt, rc = 1; -libxl_device_usbdev usbdev; - -SWITCH_FOREACH_OPT(opt, "", NULL, "usbdev-detach", 3) { -/* No options */ -} - -domid = xfind_domain(argv[optind]); -ctrl = atoi(argv[optind+1]); -port = atoi(argv[optind+2]); - -if (argc - optind > 3) { -fprintf(stderr, "Invalid arguments.\n"); -return 1; -} - -libxl_device_usbdev_init(&usbdev); -if (libxl_ctrlport_to_device_usbdev(ctx, domid, ctrl, port, &usbdev)) { -fprintf(stderr, "Unknown device at controller %d port %d.\n", -ctrl, port); -return 1; -} - -rc = libxl_device_usbdev_remove(ctx, domid, &usbdev, 0); -if (rc) { -fprintf(stderr, "libxl_device_usbdev_remove failed.\n"); -rc = 1; -} - -libxl_device_usbdev_dispose(&usbdev); -return rc; -} - -int main_usblist(int argc, char **argv) -{ -uint32_t domid; -libxl_device_usbctrl *usbctrls; -libxl_usbctrlinfo usbctrlinfo; -int numctrl, i, j, opt; - -SWITCH_FOREACH_OPT(opt, "", NULL, "usb-list", 1) { -/* No options */ -} - -domid = xfind_domain(argv[optind++]); - -if (argc > optind) { -fprintf(stderr, "Invalid arguments.\n"); -exit(-1); -} - -usbctrls = libxl_device_usbctrl_list(ctx, domid, &numctrl); -if (!usbctrls) { -return 0; -} - -for (i = 0; i < numctrl; ++i) { -printf("%-6s %-12s %-3s %-5s %-7s %-5s\n", -"Devid", "Type", "BE", "state", "usb-ver", "ports"); - -libxl_usbctrlinfo_init(&usbctrlinfo); - -if (!libxl_device_usbctrl_getinfo(ctx, domid, -&usbctrls[i], &usbctrlinfo)) { -printf("%-6d %-12
[Xen-devel] [PATCH 14/29] xl: split out block related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_block.c | 129 ++ tools/xl/xl_cmdimpl.c | 99 -- 3 files changed, 130 insertions(+), 100 deletions(-) create mode 100644 tools/xl/xl_block.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index b31ec052c1..331ae21293 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -17,7 +17,7 @@ CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o -XL_OBJS += xl_vtpm.o +XL_OBJS += xl_vtpm.o xl_block.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_block.c b/tools/xl/xl_block.c new file mode 100644 index 00..b0d79931f9 --- /dev/null +++ b/tools/xl/xl_block.c @@ -0,0 +1,129 @@ +/* + * Copyright 2009-2017 Citrix Ltd and other contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking described in file LICENSE. + * + * 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 Lesser General Public License for more details. + */ + +#include + +#include +#include +#include + +#include "xl.h" +#include "xl_utils.h" +#include "xl_parse.h" + +int main_blockattach(int argc, char **argv) +{ +int opt; +uint32_t fe_domid; +libxl_device_disk disk; +XLU_Config *config = 0; + +SWITCH_FOREACH_OPT(opt, "", NULL, "block-attach", 2) { +/* No options */ +} + +if (libxl_domain_qualifier_to_domid(ctx, argv[optind], &fe_domid) < 0) { +fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]); +return 1; +} +optind++; + +parse_disk_config_multistring +(&config, argc-optind, (const char* const*)argv + optind, &disk); + +if (dryrun_only) { +char *json = libxl_device_disk_to_json(ctx, &disk); +printf("disk: %s\n", json); +free(json); +if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); } +return 0; +} + +if (libxl_device_disk_add(ctx, fe_domid, &disk, 0)) { +fprintf(stderr, "libxl_device_disk_add failed.\n"); +return 1; +} +return 0; +} + +int main_blocklist(int argc, char **argv) +{ +int opt; +int i, nb; +libxl_device_disk *disks; +libxl_diskinfo diskinfo; + +SWITCH_FOREACH_OPT(opt, "", NULL, "block-list", 1) { +/* No options */ +} + +printf("%-5s %-3s %-6s %-5s %-6s %-8s %-30s\n", + "Vdev", "BE", "handle", "state", "evt-ch", "ring-ref", "BE-path"); +for (argv += optind, argc -= optind; argc > 0; --argc, ++argv) { +uint32_t domid; +if (libxl_domain_qualifier_to_domid(ctx, *argv, &domid) < 0) { +fprintf(stderr, "%s is an invalid domain identifier\n", *argv); +continue; +} +disks = libxl_device_disk_list(ctx, domid, &nb); +if (!disks) { +continue; +} +for (i=0; i 0; --argc, ++argv) { -uint32_t domid; -if (libxl_domain_qualifier_to_domid(ctx, *argv, &domid) < 0) { -fprintf(stderr, "%s is an invalid domain identifier\n", *argv); -continue; -} -disks = libxl_device_disk_list(ctx, domid, &nb); -if (!disks) { -continue; -} -for (i=0; ihttps://lists.xen.org/xen-devel
[Xen-devel] [PATCH 24/29] xl: split out vnc and console related code
The new file also contains code for channel, which is just a console in disguise. Replace the call to vncviewer() with libxl_vncviewer_exec() directly in main_vncviewer. Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 98 - tools/xl/xl_console.c | 130 ++ 3 files changed, 131 insertions(+), 99 deletions(-) create mode 100644 tools/xl/xl_console.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index c51106e49e..b49e2cdcab 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -19,7 +19,7 @@ XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o xl_mem.o -XL_OBJS += xl_psr.o xl_info.o +XL_OBJS += xl_psr.o xl_info.o xl_console.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 1de5445e7f..d32e7fe6f1 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -1071,60 +1071,6 @@ void help(const char *command) } } -int main_console(int argc, char **argv) -{ -uint32_t domid; -int opt = 0, num = 0; -libxl_console_type type = 0; - -SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) { -case 't': -if (!strcmp(optarg, "pv")) -type = LIBXL_CONSOLE_TYPE_PV; -else if (!strcmp(optarg, "serial")) -type = LIBXL_CONSOLE_TYPE_SERIAL; -else { -fprintf(stderr, "console type supported are: pv, serial\n"); -return EXIT_FAILURE; -} -break; -case 'n': -num = atoi(optarg); -break; -} - -domid = xfind_domain(argv[optind]); -if (!type) -libxl_primary_console_exec(ctx, domid, -1); -else -libxl_console_exec(ctx, domid, num, type, -1); -fprintf(stderr, "Unable to attach console\n"); -return EXIT_FAILURE; -} - -int main_vncviewer(int argc, char **argv) -{ -static const struct option opts[] = { -{"autopass", 0, 0, 'a'}, -{"vncviewer-autopass", 0, 0, 'a'}, -COMMON_LONG_OPTS -}; -uint32_t domid; -int opt, autopass = 0; - -SWITCH_FOREACH_OPT(opt, "a", opts, "vncviewer", 1) { -case 'a': -autopass = 1; -break; -} - -domid = xfind_domain(argv[optind]); - -if (vncviewer(domid, autopass)) -return EXIT_FAILURE; -return EXIT_SUCCESS; -} - static void pause_domain(uint32_t domid) { libxl_domain_pause(ctx, domid); @@ -2514,50 +2460,6 @@ int main_debug_keys(int argc, char **argv) return EXIT_SUCCESS; } -int main_channellist(int argc, char **argv) -{ -int opt; -libxl_device_channel *channels; -libxl_channelinfo channelinfo; -int nb, i; - -SWITCH_FOREACH_OPT(opt, "", NULL, "channel-list", 1) { -/* No options */ -} - -/* Idx BE state evt-ch ring-ref connection params*/ -printf("%-3s %-2s %-5s %-6s %8s %-10s %-30s\n", - "Idx", "BE", "state", "evt-ch", "ring-ref", "connection", ""); -for (argv += optind, argc -= optind; argc > 0; --argc, ++argv) { -uint32_t domid = xfind_domain(*argv); -channels = libxl_device_channel_list(ctx, domid, &nb); -if (!channels) -continue; -for (i = 0; i < nb; ++i) { -if (!libxl_device_channel_getinfo(ctx, domid, &channels[i], -&channelinfo)) { -printf("%-3d %-2d ", channels[i].devid, channelinfo.backend_id); -printf("%-5d ", channelinfo.state); -printf("%-6d %-8d ", channelinfo.evtch, channelinfo.rref); -printf("%-10s ", libxl_channel_connection_to_string( - channels[i].connection)); -switch (channels[i].connection) { -case LIBXL_CHANNEL_CONNECTION_PTY: -printf("%-30s ", channelinfo.u.pty.path); -break; -default: -break; -} -printf("\n"); -libxl_channelinfo_dispose(&channelinfo); -} -libxl_device_channel_dispose(&channels[i]); -} -free(channels); -} -return 0; -} - #ifndef LIBXL_HAVE_NO_SUSPEND_RESUME int main_remus(int argc, char **argv) { diff --git a/tools/xl/xl_console.c b/tools/xl/xl_console.c new file mode 100644 index 00..c3abb3f631 --- /dev/null +++ b/tools/xl/xl_console.c @@ -0,0 +1,130 @@ +/* + * Copyright 2009-2017 Citrix Ltd and other contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking descri
[Xen-devel] [PATCH 13/29] xl: split out vtpm related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 1 + tools/xl/xl_cmdimpl.c | 122 tools/xl/xl_vtpm.c| 153 ++ 3 files changed, 154 insertions(+), 122 deletions(-) create mode 100644 tools/xl/xl_vtpm.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index df0b5dd5cf..b31ec052c1 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -17,6 +17,7 @@ CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o +XL_OBJS += xl_vtpm.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index eb87cb975a..aeb4fb362f 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -5274,128 +5274,6 @@ int main_blockdetach(int argc, char **argv) return rc; } -int main_vtpmattach(int argc, char **argv) -{ -int opt; -libxl_device_vtpm vtpm; -char *oparg; -uint32_t domid; - -SWITCH_FOREACH_OPT(opt, "", NULL, "vtpm-attach", 1) { -/* No options */ -} - -if (libxl_domain_qualifier_to_domid(ctx, argv[optind], &domid) < 0) { -fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]); -return 1; -} -++optind; - -libxl_device_vtpm_init(&vtpm); -for (argv += optind, argc -= optind; argc > 0; ++argv, --argc) { -if (MATCH_OPTION("uuid", *argv, oparg)) { -if(libxl_uuid_from_string(&(vtpm.uuid), oparg)) { -fprintf(stderr, "Invalid uuid specified (%s)\n", oparg); -return 1; -} -} else if (MATCH_OPTION("backend", *argv, oparg)) { -replace_string(&vtpm.backend_domname, oparg); -} else { -fprintf(stderr, "unrecognized argument `%s'\n", *argv); -return 1; -} -} - -if(dryrun_only) { - char* json = libxl_device_vtpm_to_json(ctx, &vtpm); - printf("vtpm: %s\n", json); - free(json); - libxl_device_vtpm_dispose(&vtpm); - if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); } - return 0; -} - -if (libxl_device_vtpm_add(ctx, domid, &vtpm, 0)) { -fprintf(stderr, "libxl_device_vtpm_add failed.\n"); -return 1; -} -libxl_device_vtpm_dispose(&vtpm); -return 0; -} - -int main_vtpmlist(int argc, char **argv) -{ -int opt; -libxl_device_vtpm *vtpms; -libxl_vtpminfo vtpminfo; -int nb, i; - -SWITCH_FOREACH_OPT(opt, "", NULL, "vtpm-list", 1) { -/* No options */ -} - -/* Idx BE UUID Hdl Sta evch rref BE-path */ -printf("%-3s %-2s %-36s %-6s %-5s %-6s %-5s %-10s\n", - "Idx", "BE", "Uuid", "handle", "state", "evt-ch", "ring-ref", "BE-path"); -for (argv += optind, argc -= optind; argc > 0; --argc, ++argv) { -uint32_t domid; -if (libxl_domain_qualifier_to_domid(ctx, *argv, &domid) < 0) { -fprintf(stderr, "%s is an invalid domain identifier\n", *argv); -continue; -} -if (!(vtpms = libxl_device_vtpm_list(ctx, domid, &nb))) { -continue; -} -for (i = 0; i < nb; ++i) { - if(!libxl_device_vtpm_getinfo(ctx, domid, &vtpms[i], &vtpminfo)) { - /* Idx BE UUID Hdl Sta evch rref BE-path*/ - printf("%-3d %-2d " LIBXL_UUID_FMT " %6d %5d %6d %8d %-30s\n", -vtpminfo.devid, vtpminfo.backend_id, -LIBXL_UUID_BYTES(vtpminfo.uuid), -vtpminfo.devid, vtpminfo.state, vtpminfo.evtch, -vtpminfo.rref, vtpminfo.backend); - - libxl_vtpminfo_dispose(&vtpminfo); - } - libxl_device_vtpm_dispose(&vtpms[i]); -} -free(vtpms); -} -return 0; -} - -int main_vtpmdetach(int argc, char **argv) -{ -uint32_t domid; -int opt, rc=0; -libxl_device_vtpm vtpm; -libxl_uuid uuid; - -SWITCH_FOREACH_OPT(opt, "", NULL, "vtpm-detach", 2) { -/* No options */ -} - -domid = xfind_domain(argv[optind]); - -if ( libxl_uuid_from_string(&uuid, argv[optind+1])) { -if (libxl_devid_to_device_vtpm(ctx, domid, atoi(argv[optind+1]), &vtpm)) { -fprintf(stderr, "Unknown device %s.\n", argv[optind+1]); -return 1; -} -} else { -if (libxl_uuid_to_device_vtpm(ctx, domid, &uuid, &vtpm)) { -fprintf(stderr, "Unknown device %s.\n", argv[optind+1]); -return 1; -} -} -rc = libxl_device_vtpm_remove(ctx, domid, &vtpm, 0); -if (rc) { -fprintf(stderr, "libxl_device_vtpm_remove failed.\n"); -} -libxl_device_vtpm_dispose(&vtpm); -return rc; -} - static char *uptime_to_string(unsigned long uptime, int short_mode) { diff --git a/tools/xl/xl_vtpm.c b/tools/xl/xl_vtpm.c new
[Xen-devel] [PATCH 18/29] xl: split out pci related code
Signed-off-by: Wei Liu --- tools/xl/Makefile | 2 +- tools/xl/xl_cmdimpl.c | 247 tools/xl/xl_pci.c | 278 ++ 3 files changed, 279 insertions(+), 248 deletions(-) create mode 100644 tools/xl/xl_pci.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 8aa294d5a0..0af1e92b65 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -18,7 +18,7 @@ CFLAGS_XL += -Wshadow XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o -XL_OBJS += xl_sched.o +XL_OBJS += xl_sched.o xl_pci.o $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) $(XL_OBJS): CFLAGS += $(CFLAGS_XL) diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 7d6de3957e..b32233e95e 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -1347,253 +1347,6 @@ int main_vncviewer(int argc, char **argv) return EXIT_SUCCESS; } -static void pcilist(uint32_t domid) -{ -libxl_device_pci *pcidevs; -int num, i; - -pcidevs = libxl_device_pci_list(ctx, domid, &num); -if (pcidevs == NULL) -return; -printf("Vdev Device\n"); -for (i = 0; i < num; i++) { -printf("%02x.%01x %04x:%02x:%02x.%01x\n", - (pcidevs[i].vdevfn >> 3) & 0x1f, pcidevs[i].vdevfn & 0x7, - pcidevs[i].domain, pcidevs[i].bus, pcidevs[i].dev, pcidevs[i].func); -libxl_device_pci_dispose(&pcidevs[i]); -} -free(pcidevs); -} - -int main_pcilist(int argc, char **argv) -{ -uint32_t domid; -int opt; - -SWITCH_FOREACH_OPT(opt, "", NULL, "pci-list", 1) { -/* No options */ -} - -domid = xfind_domain(argv[optind]); - -pcilist(domid); -return 0; -} - -static int pcidetach(uint32_t domid, const char *bdf, int force) -{ -libxl_device_pci pcidev; -XLU_Config *config; -int r = 0; - -libxl_device_pci_init(&pcidev); - -config = xlu_cfg_init(stderr, "command line"); -if (!config) { perror("xlu_cfg_inig"); exit(-1); } - -if (xlu_pci_parse_bdf(config, &pcidev, bdf)) { -fprintf(stderr, "pci-detach: malformed BDF specification \"%s\"\n", bdf); -exit(2); -} -if (force) { -if (libxl_device_pci_destroy(ctx, domid, &pcidev, 0)) -r = 1; -} else { -if (libxl_device_pci_remove(ctx, domid, &pcidev, 0)) -r = 1; -} - -libxl_device_pci_dispose(&pcidev); -xlu_cfg_destroy(config); - -return r; -} - -int main_pcidetach(int argc, char **argv) -{ -uint32_t domid; -int opt; -int force = 0; -const char *bdf = NULL; - -SWITCH_FOREACH_OPT(opt, "f", NULL, "pci-detach", 2) { -case 'f': -force = 1; -break; -} - -domid = xfind_domain(argv[optind]); -bdf = argv[optind + 1]; - -if (pcidetach(domid, bdf, force)) -return EXIT_FAILURE; - -return EXIT_SUCCESS; -} - -static int pciattach(uint32_t domid, const char *bdf, const char *vs) -{ -libxl_device_pci pcidev; -XLU_Config *config; -int r = 0; - -libxl_device_pci_init(&pcidev); - -config = xlu_cfg_init(stderr, "command line"); -if (!config) { perror("xlu_cfg_inig"); exit(-1); } - -if (xlu_pci_parse_bdf(config, &pcidev, bdf)) { -fprintf(stderr, "pci-attach: malformed BDF specification \"%s\"\n", bdf); -exit(2); -} - -if (libxl_device_pci_add(ctx, domid, &pcidev, 0)) -r = 1; - -libxl_device_pci_dispose(&pcidev); -xlu_cfg_destroy(config); - -return r; -} - -int main_pciattach(int argc, char **argv) -{ -uint32_t domid; -int opt; -const char *bdf = NULL, *vs = NULL; - -SWITCH_FOREACH_OPT(opt, "", NULL, "pci-attach", 2) { -/* No options */ -} - -domid = xfind_domain(argv[optind]); -bdf = argv[optind + 1]; - -if (optind + 1 < argc) -vs = argv[optind + 2]; - -if (pciattach(domid, bdf, vs)) -return EXIT_FAILURE; - -return EXIT_SUCCESS; -} - -static void pciassignable_list(void) -{ -libxl_device_pci *pcidevs; -int num, i; - -pcidevs = libxl_device_pci_assignable_list(ctx, &num); - -if ( pcidevs == NULL ) -return; -for (i = 0; i < num; i++) { -printf("%04x:%02x:%02x.%01x\n", - pcidevs[i].domain, pcidevs[i].bus, pcidevs[i].dev, pcidevs[i].func); -libxl_device_pci_dispose(&pcidevs[i]); -} -free(pcidevs); -} - -int main_pciassignable_list(int argc, char **argv) -{ -int opt; - -SWITCH_FOREACH_OPT(opt, "", NULL, "pci-assignable-list", 0) { -/* No options */ -} - -pciassignable_list(); -return 0; -} - -static int pciassignable_add(const char *bdf, int rebind) -{ -libxl_device_pci pcidev; -XLU_Config *config; -int r = 0; - -libxl_device_pci_init(&pcidev); - -config = xlu_cfg_init(stderr, "command line"); -if (!config) { perr