Re: Linux domU only works with xen_platform_pci=0 ?

2018-05-23 Thread Nathan Friess

On 2018-05-22 03:01 AM, Roger Pau Monné wrote:

On Mon, May 21, 2018 at 01:51:13PM -0600, Nathan Friess wrote:

On 2018-05-19 02:02 AM, Roger Pau Monné wrote:
On a related note, did these patches ever make it into 11-stable?  I don't
see them at svn.freebsd.org/base/stable/11 but I may have missed something.

https://lists.freebsd.org/pipermail/freebsd-xen/2016-December/002918.html


I don't think they are on HEAD either?

I don't have a lot of time ATM, so if you want to pick the patches,
rebase them onto HEAD, test them and give me a branch I'm more than
happy to review and commit them.



Attached are 4 patches from your git repository, applied to HEAD with 
some testing on an up-to-date 12-CURRENT install.  I did see one kernel 
message that I assume is not fatal (more on that later).  I'm not able 
to test running as dom0 right now because I don't have any newish 
hardware available.  My main use case is FreeBSD as domU serving disks 
to other domUs.


The 0001-0003 patches applied cleanly to HEAD.  0004 required moving a 
function around to fix a compile error but otherwise is unchanged.  I 
also copied your commit messages from git into the patches for reference.



I was going to attach a patch to fix xen-tools with iasl in 12-CURRENT, 
but as I type this I see that you just committed a fix yesterday. 
Thanks! :)



The kernel message that I'm seeing appears when a domU shuts down or a 
disk is detached from a running domU, while the backend for the disk is 
my 12-CURRENT test system.  The backend spits this out:



lock order reversal: (sleepable after non-sleepable)
 1st 0xf8000802fe90 xbbd1 (xbbd1) @ 
/usr/src/sys/dev/xen/blkback/blkback.c:3423
 2nd 0x81fdf890 intrsrc (intrsrc) @ 
/usr/src/sys/x86/x86/intr_machdep.c:224

stack backtrace:
#0 0x80bdd993 at witness_debugger+0x73
#1 0x80bdd814 at witness_checkorder+0xe34
#2 0x80b7d798 at _sx_xlock+0x68
#3 0x811b3913 at intr_remove_handler+0x43
#4 0x811c63ef at xen_intr_unbind+0x10f
#5 0x80a12ecf at xbb_disconnect+0x2f
#6 0x80a12e54 at xbb_shutdown+0x1e4
#7 0x80a10be4 at xbb_frontend_changed+0x54
#8 0x80ed66a4 at xenbusb_back_otherend_changed+0x14
#9 0x80a2a382 at xenwatch_thread+0x182
#10 0x80b34164 at fork_exit+0x84
#11 0x8101ec9e at fork_trampoline+0xe
lock order reversal: (sleepable after non-sleepable)
 1st 0xf80008030690 xbbd0 (xbbd0) @ 
/usr/src/sys/dev/xen/blkback/blkback.c:3423
 2nd 0x81fdf890 intrsrc (intrsrc) @ 
/usr/src/sys/x86/x86/intr_machdep.c:224

stack backtrace:
#0 0x80bdd993 at witness_debugger+0x73
#1 0x80bdd814 at witness_checkorder+0xe34
#2 0x80b7d798 at _sx_xlock+0x68
#3 0x811b3913 at intr_remove_handler+0x43
#4 0x811c63ef at xen_intr_unbind+0x10f
#5 0x80a12ecf at xbb_disconnect+0x2f
#6 0x80a12e54 at xbb_shutdown+0x1e4
#7 0x80a10be4 at xbb_frontend_changed+0x54
#8 0x80ed66a4 at xenbusb_back_otherend_changed+0x14
#9 0x80a2a382 at xenwatch_thread+0x182
#10 0x80b34164 at fork_exit+0x84
#11 0x8101ec9e at fork_trampoline+0xe


Otherwise disk backends seem to work fine.

Nathan
>From 9f9ca8f244c773ee5e6a08efa6874890a8217f05 Mon Sep 17 00:00:00 2001
From: Roger Pau Monne 
Date: Thu, 15 Dec 2016 16:52:50 +
Subject: [PATCH 1/4] xenstore: remove the suspend sx lock

There's no need to prevent suspend while doing xenstore transactions, callers of
transactions are supposed to be prepared for a transaction to fail.

This fixes a bug that could be triggered from the xenstore user-space device,
since starting a transaction from user-space would result in returning there
with a sx lock held, that causes a WITNESS check to trigger.

Sponsored by: Citrix Systems R
---
 sys/dev/xen/xenstore/xenstore.c | 81 ++---
 1 file changed, 4 insertions(+), 77 deletions(-)

diff --git a/sys/dev/xen/xenstore/xenstore.c b/sys/dev/xen/xenstore/xenstore.c
index 4f89b74..14e4ebd 100644
===
--- a/sys/dev/xen/xenstore/xenstore.c	(revision 334101)
+++ b/sys/dev/xen/xenstore/xenstore.c	(working copy)
@@ -202,18 +202,6 @@
 	struct mtx watch_events_lock;
 
 	/**
-	 * Sleepable lock used to prevent VM suspension while a
-	 * xenstore transaction is outstanding.
-	 *
-	 * Each active transaction holds a shared lock on the
-	 * suspend mutex.  Our suspend method blocks waiting
-	 * to acquire an exclusive lock.  This guarantees that
-	 * suspend processing will only proceed once all active
-	 * transactions have been retired.
-	 */
-	struct sx suspend_mutex;
-
-	/**
 	 * The processid of the xenwatch thread.
 	 */
 	pid_t xenwatch_pid;
@@ -710,50 +698,6 @@
 }
 
 /* XenStore Message Request/Reply Processing -*/
-/**
- * Filter invoked before transmitting any message to the XenStore service.
- *
- * The 

Re: Xen kernel fails to boot, d0v1 triple fault looks like the cuplrit

2018-05-23 Thread Roger Pau Monné
On Wed, May 23, 2018 at 08:27:29PM +0530, Pratyush Yadav wrote:
> Hi,
> 
> On Wed, May 23, 2018 at 1:45 PM, Roger Pau Monné  wrote:
> > It's too early for the logs to be stored anywhere. The point where you
> > get the crash is when the APs are started, which is way before FreeBSD
> > starts proving for disk devices.
> >
> > Can you please try the patch below?
> >
> > Thanks, Roger.
> > ---8<---
> > diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c
> > index 54184898e9bf..52391e2e7c08 100644
> > --- a/sys/x86/xen/pv.c
> > +++ b/sys/x86/xen/pv.c
> > @@ -113,6 +113,7 @@ static int xen_pv_start_all_aps(void);
> >  extern char *doublefault_stack;
> >  extern char *mce_stack;
> >  extern char *nmi_stack;
> > +extern char *dbg_stack;
> >  #endif
> >
> >  /*
> > @@ -329,6 +330,8 @@ start_xen_ap(int cpu)
> > (char *)kmem_malloc(kernel_arena, PAGE_SIZE, M_WAITOK | M_ZERO);
> > nmi_stack =
> > (char *)kmem_malloc(kernel_arena, PAGE_SIZE, M_WAITOK | M_ZERO);
> > +   dbg_stack =
> > +   (void *)kmem_malloc(kernel_arena, PAGE_SIZE, M_WAITOK | M_ZERO);
> > dpcpu =
> > (void *)kmem_malloc(kernel_arena, DPCPU_SIZE, M_WAITOK | 
> > M_ZERO);
> >
> 
> I think we have different pv.c files. For me, line 113 is:
> /* Xen init_ops implementation. */
> 
> The declarations of doublefault_stach, mce_stack, etc are in line 101.
> 
> Similarly, line 329 for me is:
> {
> 
> in function xen_pv_parse_symtab(void). The declarations your diff
> mentions in line 329 are in line 224.
> 
> This is in sync with the official repository [0]. Maybe you have
> modifications that are not yet upstream?

Sorry, I did indeed have other changes in pv.c. I'm appending the
patch on top of current HEAD.

> Anyway, I manually made the changes. It still does not boot (I used
> make kernel -DKERNFAST, but I don't think that should make a
> difference).

FWIW, I think the recommended way is KERNFAST=1.

Can you paste the error? I think you should no longer get a triple
page fault in mp_machdep.c:307.

Thanks, Roger.
---8<---
diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c
index c7e97c5b2b63..27e98012302b 100644
--- a/sys/x86/xen/pv.c
+++ b/sys/x86/xen/pv.c
@@ -101,6 +101,7 @@ static int xen_pv_start_all_aps(void);
 extern char *doublefault_stack;
 extern char *mce_stack;
 extern char *nmi_stack;
+extern char *dbg_stack;
 #endif
 
 /*
@@ -224,6 +225,8 @@ start_xen_ap(int cpu)
(char *)kmem_malloc(kernel_arena, PAGE_SIZE, M_WAITOK | M_ZERO);
nmi_stack =
(char *)kmem_malloc(kernel_arena, PAGE_SIZE, M_WAITOK | M_ZERO);
+   dbg_stack =
+   (void *)kmem_malloc(kernel_arena, PAGE_SIZE, M_WAITOK | M_ZERO);
dpcpu =
(void *)kmem_malloc(kernel_arena, DPCPU_SIZE, M_WAITOK | M_ZERO);
 

___
freebsd-xen@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to "freebsd-xen-unsubscr...@freebsd.org"


[Bug 213439] ifOutOctets are always zero for Xen xn interfaces

2018-05-23 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213439

Eitan Adler  changed:

   What|Removed |Added

 Status|In Progress |Open

--- Comment #10 from Eitan Adler  ---
batch change of PRs untouched in 2018 marked "in progress" back to open.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-xen@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to "freebsd-xen-unsubscr...@freebsd.org"


Re: Xen kernel fails to boot, d0v1 triple fault looks like the cuplrit

2018-05-23 Thread Roger Pau Monné
On Wed, May 23, 2018 at 12:57:59PM +0530, Pratyush Yadav wrote:
> On Mon, May 21, 2018 at 2:33 PM, Roger Pau Monné 
> wrote:
> > Please try to avoid top posting.
> 
> Sorry, I didn't know. I Googled top posting just now, and realized it is
> inconvenient for the reader.
> 
> > Hm, it seems like dbg_stack is not properly allocated. Can you please
> > try the above debug patch and paste the boot log?
> >
> > ---8<---
> > diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
> > index 301461420874..8854242b4bf5 100644
> > --- a/sys/amd64/amd64/mp_machdep.c
> > +++ b/sys/amd64/amd64/mp_machdep.c
> > @@ -304,6 +304,7 @@ init_secondary(void)
> >
> > /* Save the per-cpu pointer for use by the DB# handler. */
> > np = ((struct nmi_pcpu *) _stack[PAGE_SIZE]) - 1;
> > +printf("ID %d dbg_stack: %p per-cpu: %p\n", cpu, dbg_stack, np);
> > np->np_pcpu = (register_t) pc;
> >
> > wrmsr(MSR_FSBASE, 0);   /* User value */
> > @@ -403,6 +404,7 @@ native_start_all_aps(void)
> > M_WAITOK | M_ZERO);
> > dbg_stack = (char *)kmem_malloc(kernel_arena, PAGE_SIZE,
> > M_WAITOK | M_ZERO);
> > +printf("allocated dbg_stack: %p\n", dbg_stack);
> > dpcpu = (void *)kmem_malloc(kernel_arena, DPCPU_SIZE,
> > M_WAITOK | M_ZERO);
> >
> 
> I applied your patch. The boot stops at the same spot. Also, I can't see
> any of the two print messages added in the patch. I booted from a Live CD
> to look at the logs, but they are not stored. I checked dmesg.boot and
> messages, and /var/log/xen/ none of them have the logs. They all have logs
> of the previous boot.

It's too early for the logs to be stored anywhere. The point where you
get the crash is when the APs are started, which is way before FreeBSD
starts proving for disk devices.

Can you please try the patch below?

Thanks, Roger.
---8<---
diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c
index 54184898e9bf..52391e2e7c08 100644
--- a/sys/x86/xen/pv.c
+++ b/sys/x86/xen/pv.c
@@ -113,6 +113,7 @@ static int xen_pv_start_all_aps(void);
 extern char *doublefault_stack;
 extern char *mce_stack;
 extern char *nmi_stack;
+extern char *dbg_stack;
 #endif
 
 /*
@@ -329,6 +330,8 @@ start_xen_ap(int cpu)
(char *)kmem_malloc(kernel_arena, PAGE_SIZE, M_WAITOK | M_ZERO);
nmi_stack =
(char *)kmem_malloc(kernel_arena, PAGE_SIZE, M_WAITOK | M_ZERO);
+   dbg_stack =
+   (void *)kmem_malloc(kernel_arena, PAGE_SIZE, M_WAITOK | M_ZERO);
dpcpu =
(void *)kmem_malloc(kernel_arena, DPCPU_SIZE, M_WAITOK | M_ZERO);
 
___
freebsd-xen@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to "freebsd-xen-unsubscr...@freebsd.org"