Skip to contentSkip to conversation

xen/arm64: Suspend to RAM support for Xen

PATCH In review Mirela Simonovic 8 participants 153 messages Nov 12, 2018 – Dec 4, 2018 Page 2 of 2

lore
Share & tools
lore
#119 lore raw

Re: [PATCH 15/18] xen/arm: Resume memory management on Xen resume

In reply to Julien Grall
Quoted 146 lines · Julien Grall

Hi,

Quoted 127 lines · Mirela Simonovic

The MMU needs to be enabled in the resume flow before the context can be restored (we need to be able to access the context data by virtual address in order to restore it). The configuration of system registers prior to branching to the routine that sets up the page tables is copied from xen/arch/arm/arm64/head.S.
After the MMU is enabled, the content of TTBR0_EL2 is changed to point to init_ttbr (page tables used at runtime).

At boot the init_ttbr variable is updated when a secondary CPU is hotplugged. In the scenario where there is only one physical CPU in the system, the init_ttbr would not be initialized for the use in resume flow. To get the variable initialized in all scenarios in this patch we add that the boot CPU updates init_ttbr after it sets the page tables for runtime.

After the memory management is resumed, the SCTLR_WXN in SCTLR_EL2 has to be set in order to configure that a mapping cannot be both writable and executable (this was configured prior to suspend). This is done using an existing function (mmu_init_secondary_cpu).

---
Changes in v2:

- Patch from v1:
"[XEN PATCH 17/21] xen/arm: Set SCTLR_WXN in SCTLR_EL2 on resume" is squashed with this patch, because it is indeed related to resuming the memory management
- Since the original patch was named 'Enable the MMU', and this is not only enabling anymore, but the full resume of functionality, the commit title and message is fixed

---
  xen/arch/arm/arm64/entry.S | 88
++++++++++++++++++++++++++++++++++++++++++++++
  xen/arch/arm/mm.c          |  1 +
  xen/arch/arm/suspend.c     |  6 ++++
  3 files changed, 95 insertions(+)
xen/arch/arm/arm64/entry.S +25 -0
index dbc4717903..5efa30e8ee 100644
@@ -1,6 +1,7 @@
  #include <asm/asm_defns.h>
  #include <asm/current.h>
  #include <asm/macros.h>
+#include <asm/page.h>
  #include <asm/regs.h>
  #include <asm/alternative.h>
  #include <asm/smccc.h>
@@ -534,6 +535,93 @@ ENTRY(__context_switch)
          ret
    ENTRY(hyp_resume)
+        msr   DAIFSet, 0xf           /* Disable all interrupts */
+
+        tlbi  alle2
+        dsb   sy                     /* Ensure completion of TLB flush */
+        isb
+
+        ldr   x0, =start
+        adr   x19, start             /* x19 := paddr (start) */
+        sub   x20, x19, x0           /* x20 := phys-offset */
+
+        /* XXXX call PROCINFO_cpu_init here */
+
+        /* Set up memory attribute type tables */
+        ldr   x0, =MAIRVAL
+        msr   mair_el2, x0
+
+        /* Set up TCR_EL2:
+         * PS -- Based on ID_AA64MMFR0_EL1.PARange
+         * Top byte is used
+         * PT walks use Inner-Shareable accesses,
+         * PT walks are write-back, write-allocate in both cache levels,
+         * 48-bit virtual address space goes through this table. */
+        ldr   x0,
 =(TCR_RES1|TCR_SH0_IS|TCR_ORGN0_WBWA|TCR_IRGN0_WBWA|TCR_T0SZ(64-48))
+        /* ID_AA64MMFR0_EL1[3:0] (PARange) corresponds to TCR_EL2[18:16]

(PS) */

xen/arch/arm/arm64/entry.S +35 -0
+        mrs   x1, ID_AA64MMFR0_EL1
+        bfi   x0, x1, #16, #3
+
+        msr   tcr_el2, x0
+
+        /* Set up the SCTLR_EL2:
+         * Exceptions in LE ARM,
+         * Low-latency IRQs disabled,
+         * Write-implies-XN disabled (for now),
+         * D-cache disabled (for now),
+         * I-cache enabled,
+         * Alignment checking disabled,
+         * MMU translation disabled (for now). */
+        ldr   x0, =(HSCTLR_BASE)
+        msr   SCTLR_EL2, x0
+
+        /* Ensure that any exceptions encountered at EL2
+         * are handled using the EL2 stack pointer, rather
+         * than SP_EL0. */
+        msr spsel, #1
+
+        /* Rebuild the boot pagetable's first-level entries. The structure
+         * is described in mm.c.
+         *
+         * After the CPU enables paging it will add the fixmap mapping
+         * to these page tables, however this may clash with the 1:1
+         * mapping. So each CPU must rebuild the page tables here with
+         * the 1:1 in place. */
+
+        /* If Xen is loaded at exactly XEN_VIRT_START then we don't
+         * need an additional 1:1 mapping, the virtual mapping will
+         * suffice.
+         */
+        cmp   x19, #XEN_VIRT_START
+        cset  x25, eq                /* x25 := identity map in place, or

not */

xen/arch/arm/arm64/entry.S +10 -0
+
+        /* Write Xen's PT's paddr into TTBR0_EL2 */
+        ldr   x4, =boot_pgtable     /* xen_pgtable    */
+        add   x4, x4, x20           /* x4 := paddr (boot_pagetable) */
+        msr   TTBR0_EL2, x4
+
+        /* Set up page tables */
+        bl    setup_page_tables
+
+        ldr   x1, =mmu_resumed      /* Explicit vaddr, not RIP-relative */

xen/arch/arm/arm64/entry.S ENTRY(__context_switch) · line 616

Quoted 10 lines
xen/arch/arm/arm64/entry.S +10 -0
+        mrs   x0, SCTLR_EL2
+        orr   x0, x0, #SCTLR_M      /* Enable MMU */
+        orr   x0, x0, #SCTLR_C      /* Enable D-cache */
+        dsb   sy                    /* Flush PTE writes and finish reads */
+        msr   SCTLR_EL2, x0         /* now paging is enabled */
+        isb                         /* Now, flush the icache */
+        br    x1                    /* Get a proper vaddr into PC */
+
+mmu_resumed:
+        ldr   x4, =init_ttbr         /* VA of TTBR0_EL2 stashed by CPU 0 */

While I know that Xen is switching between page-tables in some place, this should not be done. Indeed, such sequence may break coherency of the TLBs. In order to avoid that, you want to apply the break-before-sequence. I haven't fully think how to solve it in Xen properly today.

Quoted 2 lines

I am quite worried to introduce simlar sequence in Xen before fixing the current sequences.

We can turn this assembly code into a .macro, so that at least when we get around to it, we just need to fix it one place. In fact, I noticed that the code sequence right before "mmu_resumed" and the one right after are both indentical to the ones head.S, it would be good to avoid the duplication if possible.

Quoted 10 lines

xen/arch/arm/arm64/entry.S ENTRY(__context_switch) · line 627

Quoted 10 lines
xen/arch/arm/arm64/entry.S +8 -0
+        ldr   x4, [x4]               /* Actual value */
+        dsb   sy
+        msr   TTBR0_EL2, x4
+        dsb   sy
+        isb
+        tlbi  alle2
+        dsb   sy                     /* Ensure completion of TLB flush */
+        isb
          b .
    /*

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#120 lore raw

Re: [PATCH 15/18] xen/arm: Resume memory management on Xen resume

Hi,

Quoted 7 lines · Stefano Stabellini
Quoted 1 line · Julien Grall

On 11/12/18 11:30 AM, Mirela Simonovic wrote:

We can turn this assembly code into a .macro, so that at least when we get around to it, we just need to fix it one place. In fact, I noticed that the code sequence right before "mmu_resumed" and the one right after are both indentical to the ones head.S, it would be good to avoid the duplication if possible.

This does not address my concern. We want to have suspend/resume compliant to the Arm architecture (at least to our best knowledge). Hiding it in a macro/function is not going to make it compliant.

Nobody wants its platform randomly crashing on suspend/resume because the Arm Arm was knowingly not followed. This is more critical than the boot one as we are going to call that more often. So what is the action plan to correctly resume memory management in this series?

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#121 lore raw

Re: [PATCH 15/18] xen/arm: Resume memory management on Xen resume

Quoted 11 lines · Julien Grall

Hi,

Quoted 7 lines · Stefano Stabellini
Quoted 1 line · Julien Grall

On 11/12/18 11:30 AM, Mirela Simonovic wrote:

We can turn this assembly code into a .macro, so that at least when we get around to it, we just need to fix it one place. In fact, I noticed that the code sequence right before "mmu_resumed" and the one right after are both indentical to the ones head.S, it would be good to avoid the duplication if possible.

Quoted 8 lines

This does not address my concern. We want to have suspend/resume compliant to the Arm architecture (at least to our best knowledge). Hiding it in a macro/function is not going to make it compliant.

Nobody wants its platform randomly crashing on suspend/resume because the Arm Arm was knowingly not followed. This is more critical than the boot one as we are going to call that more often. So what is the action plan to correctly resume memory management in this series?

My suggestion does not address your concern, but at least it limits the spreading of errors code-wise.

It is only natural for a contributor to start from existing code to write new code. It just happens that the existing code is broken, thus, the new code is broken too. We can't really expect any different :)

If we want the contributor to fix this, given that the change is a difficult modification to delicate assembly code, we need to provide detailed documentation and/or sample code. Otherwise I can't see how it can go well.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#122 lore raw

Re: [PATCH 15/18] xen/arm: Resume memory management on Xen resume

Hi,

Quoted 14 lines · Stefano Stabellini
Quoted 13 lines · Julien Grall
Quoted 7 lines · Stefano Stabellini
Quoted 1 line · Julien Grall

On 11/12/18 11:30 AM, Mirela Simonovic wrote:

We can turn this assembly code into a .macro, so that at least when we get around to it, we just need to fix it one place. In fact, I noticed that the code sequence right before "mmu_resumed" and the one right after are both indentical to the ones head.S, it would be good to avoid the duplication if possible.

This does not address my concern. We want to have suspend/resume compliant to the Arm architecture (at least to our best knowledge). Hiding it in a macro/function is not going to make it compliant.

Quoted 7 lines
Quoted 4 lines

Nobody wants its platform randomly crashing on suspend/resume because the Arm Arm was knowingly not followed. This is more critical than the boot one as we are going to call that more often. So what is the action plan to correctly resume memory management in this series?

My suggestion does not address your concern, but at least it limits the spreading of errors code-wise.

You can't build a great building on a weak foundation.

Quoted 2 lines

It is only natural for a contributor to start from existing code to
write new code. It just happens that the existing code is broken, thus, > the new code is broken too. We can't really expect any different :)

I didn't expect anything different. In fact, I explained why the code is wrong and asked what is the plan to fix it. I would have expect you or the contributor to come back with suggestion how to fix this.

Instead you suggested to keep wrong code in Xen with no plan to resolve it.

Quoted 5 lines

If we want the contributor to fix this, given that the change is a difficult modification to delicate assembly code, we need to provide detailed documentation and/or sample code. Otherwise I can't see how it can go well.

I don't think it is that difficult at least compare to implementing suspend/resume. There are far more corner case in the latter.

The rules are fairly simple here:
1) You cannot switch between TTBR without disabling the MMU and
therefore use an ID map
2) We always need to keep an ID map in place to allow turning off the MMU
3) Replacing a valid mapping should follow the break-before make
4) Memory written with MMU/cache off should be precede by clean and
followed by invalidate

The best example might be KVM boot code yet the page-tables are very simplistic compare to Xen. Linux is not a good example because EL1 supports 2 set of page-tables.

I am happy to provide more details if someone is going to look at it.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#123 lore raw

PATCH 16/18 xen/arm: Save/restore context on suspend/resume

In reply to Mirela Simonovic

The context of CPU general purpose and system control registers has to be saved on suspend and restored on resume. This is implemented in hyp_suspend and before the return from hyp_resume function. The hyp_suspend is invoked just before the PSCI system suspend call is issued to the ATF. The hyp_suspend has to return a non-zero value so that the calling 'if' statement evaluates to true, causing the system suspend to be invoked. Upon the resume, context saved on suspend will be restored, including the link register. Therefore, after restoring the context the control flow will return to the address pointed by the saved link register, which is the place from which the hyp_suspend was called. To ensure that the calling 'if' statement doesn't again evaluate to true and initiate system suspend, hyp_resume has to return a zero value after restoring the context.
Note that the order of saving register context into cpu_context structure has to match the order of restoring.
Since the suspend/resume is supported only for arm64, we define a null cpu_context structure so arm32 could compile.

---
 xen/arch/arm/arm64/entry.S    | 89 ++++++++++++++++++++++++++++++++++++++++++-
 xen/arch/arm/suspend.c        | 28 ++++++++++++--
 xen/include/asm-arm/suspend.h | 22 +++++++++++
 3 files changed, 135 insertions(+), 4 deletions(-)
xen/arch/arm/arm64/entry.S +88 -1
index 5efa30e8ee..861a401b18 100644
@@ -534,6 +534,52 @@ ENTRY(__context_switch)
         mov     sp, x9
         ret
 
+/*
+ * void hyp_suspend(struct cpu_context *ptr)
+ *
+ * x0 - pointer to the storage where callee's context will be saved
+ *
+ * CPU context saved here will be restored on resume in hyp_resume function.
+ * hyp_suspend shall return a non-zero value. Upon restoring context
+ * hyp_resume shall return value zero instead. From C code that invokes
+ * hyp_suspend, the return value is interpreted to determine whether the context
+ * is saved (hyp_suspend) or restored (hyp_resume).
+ */
+ENTRY(hyp_suspend)
+        /* Store callee-saved registers */
+        stp     x19, x20, [x0], #16
+        stp     x21, x22, [x0], #16
+        stp     x23, x24, [x0], #16
+        stp     x25, x26, [x0], #16
+        stp     x27, x28, [x0], #16
+        stp     x29, lr, [x0], #16
+
+        /* Store stack-pointer */
+        mov     x2, sp
+        str     x2, [x0], #8
+
+        /* Store system control registers */
+        mrs     x2, VBAR_EL2
+        str     x2, [x0], #8
+        mrs     x2, VTCR_EL2
+        str     x2, [x0], #8
+        mrs     x2, VTTBR_EL2
+        str     x2, [x0], #8
+        mrs     x2, TPIDR_EL2
+        str     x2, [x0], #8
+        mrs     x2, MDCR_EL2
+        str     x2, [x0], #8
+        mrs     x2, HSTR_EL2
+        str     x2, [x0], #8
+        mrs     x2, CPTR_EL2
+        str     x2, [x0], #8
+        mrs     x2, HCR_EL2
+        str     x2, [x0], #8
+
+        /* hyp_suspend must return a non-zero value */
+        mov     x0, #1
+        ret
+
 ENTRY(hyp_resume)
         msr   DAIFSet, 0xf           /* Disable all interrupts */
 
@@ -622,7 +668,48 @@ mmu_resumed:
         tlbi  alle2
         dsb   sy                     /* Ensure completion of TLB flush */
         isb
-        b .
+
+        /* Now we can access the cpu_context, so restore the context here */
+        ldr     x0, =cpu_context
+
+        /* Restore callee-saved registers */
+        ldp     x19, x20, [x0], #16
+        ldp     x21, x22, [x0], #16
+        ldp     x23, x24, [x0], #16
+        ldp     x25, x26, [x0], #16
+        ldp     x27, x28, [x0], #16
+        ldp     x29, lr, [x0], #16
+
+        /* Restore stack pointer */
+        ldr     x2, [x0], #8
+        mov     sp, x2
+
+        /* Restore system control registers */
+        ldr     x2, [x0], #8
+        msr     VBAR_EL2, x2
+        ldr     x2, [x0], #8
+        msr     VTCR_EL2, x2
+        ldr     x2, [x0], #8
+        msr     VTTBR_EL2, x2
+        ldr     x2, [x0], #8
+        msr     TPIDR_EL2, x2
+        ldr     x2, [x0], #8
+        msr     MDCR_EL2, x2
+        ldr     x2, [x0], #8
+        msr     HSTR_EL2, x2
+        ldr     x2, [x0], #8
+        msr     CPTR_EL2, x2
+        ldr     x2, [x0], #8
+        msr     HCR_EL2, x2
+        isb
+
+        /* Since context is restored return from this function will appear as
+         * return from hyp_suspend. To distinguish a return from hyp_suspend
+         * which is called upon finalizing the suspend, as opposed to return
+         * from this function which executes on resume, we need to return zero
+         * value here. */
+        mov x0, #0
+        ret
 
 /*
  * Local variables:
xen/arch/arm/suspend.c +25 -3
index 365c32ec3c..423d9c0e90 100644
@@ -3,6 +3,9 @@
 #include <asm/cpufeature.h>
 #include <asm/event.h>
 #include <asm/psci.h>
+#include <asm/suspend.h>
+
+struct cpu_context cpu_context;
 
 /* Reset values of VCPU architecture specific registers */
 static void vcpu_arch_reset(struct vcpu *v)
@@ -113,6 +116,11 @@ static void vcpu_suspend(register_t epoint, register_t cid)
     _arch_set_info_guest(v, &ctxt);
 }
 
+#ifndef CONFIG_ARM_64
+/* not supported on ARM_32 */
+int32_t hyp_suspend(struct cpu_context *ptr) { return 1; }
+#endif
+
 /* Xen suspend. Note: data is not used (suspend is the suspend to RAM) */
 static long system_suspend(void *data)
 {
@@ -141,9 +149,23 @@ static long system_suspend(void *data)
         goto resume_irqs;
     }
 
-    status = call_psci_system_suspend();
-    if ( status )
-        dprintk(XENLOG_ERR, "PSCI system suspend failed, err=%d\n", status);
+    if ( hyp_suspend(&cpu_context) )
+    {
+        status = call_psci_system_suspend();
+        /*
+         * If suspend is finalized properly by above system suspend PSCI call,
+         * the code below in this 'if' branch will never execute. Execution
+         * will continue from hyp_resume which is the hypervisor's resume point.
+         * In hyp_resume CPU context will be restored and since link-register is
+         * restored as well, it will appear to return from hyp_suspend. The
+         * difference in returning from hyp_suspend on system suspend versus
+         * resume is in function's return value: on suspend, the return value is
+         * a non-zero value, on resume it is zero. That is why the control flow
+         * will not re-enter this 'if' branch on resume.
+         */
+        if ( status )
+            dprintk(XENLOG_ERR, "PSCI system suspend failed, err=%d\n", status);
+    }
 
     system_state = SYS_STATE_resume;
 
xen/include/asm-arm/suspend.h +22 -0
index 7604e2e2e2..a39071566a 100644
@@ -1,8 +1,30 @@
 #ifndef __ASM_ARM_SUSPEND_H__
 #define __ASM_ARM_SUSPEND_H__
 
+#ifdef CONFIG_ARM_64
+struct cpu_context {
+    uint64_t callee_regs[12];
+    uint64_t sp;
+    uint64_t vbar_el2;
+    uint64_t vtcr_el2;
+    uint64_t vttbr_el2;
+    uint64_t tpidr_el2;
+    uint64_t mdcr_el2;
+    uint64_t hstr_el2;
+    uint64_t cptr_el2;
+    uint64_t hcr_el2;
+} __aligned(16);
+#else
+struct cpu_context {
+    uint8_t pad;
+};
+#endif
+
+extern struct cpu_context cpu_context;
+
 int32_t domain_suspend(register_t epoint, register_t cid);
 void hyp_resume(void);
+int32_t hyp_suspend(struct cpu_context *ptr);
 
 #endif
 
Signature · 7 lines
2.13.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#124 lore raw

PATCH 17/18 xen/arm: Resume Dom0 after Xen resumes

In reply to Mirela Simonovic

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

---
 xen/arch/arm/suspend.c | 3 +++
 1 file changed, 3 insertions(+)
xen/arch/arm/suspend.c +3 -0
index 423d9c0e90..a05aea9c25 100644
@@ -189,6 +189,9 @@ resume_nonboot_cpus:
     system_state = SYS_STATE_active;
     dsb(sy);
 
+    /* Wake-up hardware domain (should always resume after Xen) */
+    vcpu_unblock(hardware_domain->vcpu[0]);
+
     return status;
 }
 
Signature · 7 lines
2.13.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#125 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Hi,

Quoted 2 lines · Mirela Simonovic

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

Please explain why you always need to resume Dom0 afterwards.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#126 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Hi Julien,

Quoted 9 lines · Julien Grall

Hi,

Quoted 2 lines · Mirela Simonovic

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

Please explain why you always need to resume Dom0 afterwards.

We don't need to, but that is what is promised in the design spec.

Quoted 4 lines

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#127 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Quoted 7 lines · Mirela Simonovic

Hi Julien,

Quoted 3 lines · Julien Grall

Hi,

Quoted 9 lines
Quoted 6 lines · Mirela Simonovic
Quoted 2 lines

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

Please explain why you always need to resume Dom0 afterwards.

We don't need to, but that is what is promised in the design spec.

To be more specific - a domU that doesn't depend on dom0 can resume and work happily without dom0 being resumed, i.e. just Xen and domU resume. So patch "[PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes" is not a must (when there are no PV drivers involved).

Quoted 4 lines
Quoted 4 lines

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#128 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Quoted 9 lines · Mirela Simonovic
Quoted 7 lines · Mirela Simonovic

Hi Julien,

Quoted 3 lines · Julien Grall

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · Mirela Simonovic
Quoted 2 lines

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

Please explain why you always need to resume Dom0 afterwards.

We don't need to, but that is what is promised in the design spec.

You surely had some rationale when writing the promise in the design document, right?

So what is the reason behind it? I don't want to resume a domain if that's not necessary.

Quoted 6 lines
Quoted 1 line

To be more specific - a domU that doesn't depend on dom0 can resume and work happily without dom0 being resumed, i.e. just Xen and domU resume. So patch "[PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes" is not a must (when there are no PV drivers involved).

PV backends don't necessarily reside in the hardware domain. So how is this going to work for the other case?

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#129 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Hi Julien,

Quoted 30 lines · Julien Grall
Quoted 9 lines · Mirela Simonovic
Quoted 7 lines · Mirela Simonovic

Hi Julien,

Quoted 3 lines · Julien Grall

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · Mirela Simonovic
Quoted 2 lines

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

Please explain why you always need to resume Dom0 afterwards.

We don't need to, but that is what is promised in the design spec.

You surely had some rationale when writing the promise in the design document, right?

So what is the reason behind it? I don't want to resume a domain if that's not necessary.

Quoted 2 lines
Quoted 1 line
Quoted 8 lines
Quoted 4 lines

To be more specific - a domU that doesn't depend on dom0 can resume and work happily without dom0 being resumed, i.e. just Xen and domU resume. So patch "[PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes" is not a must (when there are no PV drivers involved).

PV backends don't necessarily reside in the hardware domain. So how is this going to work for the other case?

I honestly believe that this is not necessary, and is sub-optimal. It relies on an assumption that dom0 contains all the PV drivers, which is not always correct.

I would prefer if someone can tell us that any frontend will trigger an event to the backend, and the event would go through Xen. That way, this event would cause a domain containing the backend driver to resume. I think this is the best possible solution, but it relies on an assumption that the event will go through Xen, and I'm not knowledgeable enough to claim that this is indeed the case. If this assumption is correct, I strongly suggest to remove this patch and let the wake-up for all domains happen automatically after the Xen resumes.

Quoted 4 lines

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#130 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Quoted 1 line · Mirela Simonovic

Hi Julien,

Hi Mirela,

Quoted 37 lines · Julien Grall
Quoted 35 lines · Mirela Simonovic
Quoted 9 lines
Quoted 7 lines · Mirela Simonovic

Hi Julien,

Quoted 3 lines · Julien Grall

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · Mirela Simonovic
Quoted 2 lines

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

Please explain why you always need to resume Dom0 afterwards.

We don't need to, but that is what is promised in the design spec.

You surely had some rationale when writing the promise in the design document, right?

So what is the reason behind it? I don't want to resume a domain if that's not necessary.

Quoted 6 lines
Quoted 1 line

To be more specific - a domU that doesn't depend on dom0 can resume and work happily without dom0 being resumed, i.e. just Xen and domU resume. So patch "[PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes" is not a must (when there are no PV drivers involved).

Quoted 7 lines
Quoted 3 lines

PV backends don't necessarily reside in the hardware domain. So how is this going to work for the other case?

I honestly believe that this is not necessary, and is sub-optimal. It relies on an assumption that dom0 contains all the PV drivers, which is not always correct.

Well, there are other reasons to resume the hardware domain. The hardware domain owns most the devices and may be part of the suspend/resume path.

As you tie the host suspend to the hardware domain suspend, it may makes sense to resume at the same time. It is the kind of rationale I would expect in the commit message.

Quoted 7 lines

I would prefer if someone can tell us that any frontend will trigger an event to the backend, and the event would go through Xen. That way, this event would cause a domain containing the backend driver to resume. I think this is the best possible solution, but it relies on an assumption that the event will go through Xen, and I'm not knowledgeable enough to claim that this is indeed the case.

I think it is should work, the best way to find out if building a test case for it.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#131 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Quoted 68 lines · Julien Grall
Quoted 1 line · Mirela Simonovic

Hi Julien,

Hi Mirela,

Quoted 40 lines · Julien Grall
Quoted 38 lines · Mirela Simonovic
Quoted 10 lines
Quoted 8 lines · Mirela Simonovic

Hi Julien,

Quoted 3 lines · Julien Grall

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · Mirela Simonovic
Quoted 2 lines

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

Please explain why you always need to resume Dom0 afterwards.

We don't need to, but that is what is promised in the design spec.

You surely had some rationale when writing the promise in the design document,
right?

So what is the reason behind it? I don't want to resume a domain if that's not
necessary.

Quoted 6 lines
Quoted 1 line

To be more specific - a domU that doesn't depend on dom0 can resume and work happily without dom0 being resumed, i.e. just Xen and domU resume. So patch "[PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes" is not a must (when there are no PV drivers involved).

Quoted 8 lines
Quoted 4 lines

PV backends don't necessarily reside in the hardware domain. So how is this
going to work for the other case?

I honestly believe that this is not necessary, and is sub-optimal. It relies on an assumption that dom0 contains all the PV drivers, which is not always correct.

Well, there are other reasons to resume the hardware domain. The hardware domain owns most the devices and may be part of the suspend/resume path.

As you tie the host suspend to the hardware domain suspend, it may makes sense to resume at the same time. It is the kind of rationale I would expect in the commit message.

Quoted 6 lines

I would prefer if someone can tell us that any frontend will trigger an event to the backend, and the event would go through Xen. That way, this event would cause a domain containing the backend driver to resume. I think this is the best possible solution, but it relies on an assumption that the event will go through Xen, and I'm not knowledgeable enough to claim that this is indeed the case.

Quoted 2 lines

I think it is should work, the best way to find out if building a test case for it.

Yes, PV protocols use hypercalls to send notifications to the other end. Specifically, the function at the Linux side is include/xen/events.h:notify_remote_via_evtchn. The Xen implementation for the hypercall is xen/common/event_channel.c:evtchn_send, where 'rd' is the destination domain.

It should be possible to figure out which domain needs to awaken from there.

It would fantastic to have that in this patch series, and might not be too difficult to do. However, I also think that always waking up the hardware domain could be a decent way to start and could be OK for this patch series which is the very first to introduce suspend/resume functionalities on Xen on ARM. But the limitation should be well explained in the commit message, as Julien wrote, and possibly even as an in-code comment with a TODO.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#132 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Quoted 72 lines · Stefano Stabellini
Quoted 68 lines · Julien Grall
Quoted 1 line · Mirela Simonovic

Hi Julien,

Hi Mirela,

Quoted 40 lines · Julien Grall
Quoted 38 lines · Mirela Simonovic
Quoted 10 lines
Quoted 8 lines · Mirela Simonovic

Hi Julien,

Quoted 3 lines · Julien Grall

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · Mirela Simonovic
Quoted 2 lines

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

Please explain why you always need to resume Dom0 afterwards.

We don't need to, but that is what is promised in the design spec.

You surely had some rationale when writing the promise in the design document,
right?

So what is the reason behind it? I don't want to resume a domain if that's not
necessary.

Quoted 6 lines
Quoted 1 line

To be more specific - a domU that doesn't depend on dom0 can resume and work happily without dom0 being resumed, i.e. just Xen and domU resume. So patch "[PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes" is not a must (when there are no PV drivers involved).

Quoted 8 lines
Quoted 4 lines

PV backends don't necessarily reside in the hardware domain. So how is this
going to work for the other case?

I honestly believe that this is not necessary, and is sub-optimal. It relies on an assumption that dom0 contains all the PV drivers, which is not always correct.

Well, there are other reasons to resume the hardware domain. The hardware domain owns most the devices and may be part of the suspend/resume path.

As you tie the host suspend to the hardware domain suspend, it may makes sense to resume at the same time. It is the kind of rationale I would expect in the commit message.

Quoted 6 lines

I would prefer if someone can tell us that any frontend will trigger an event to the backend, and the event would go through Xen. That way, this event would cause a domain containing the backend driver to resume. I think this is the best possible solution, but it relies on an assumption that the event will go through Xen, and I'm not knowledgeable enough to claim that this is indeed the case.

Quoted 2 lines

I think it is should work, the best way to find out if building a test case for it.

Quoted 8 lines

Yes, PV protocols use hypercalls to send notifications to the other end. Specifically, the function at the Linux side is include/xen/events.h:notify_remote_via_evtchn. The Xen implementation for the hypercall is xen/common/event_channel.c:evtchn_send, where 'rd' is the destination domain.

It should be possible to figure out which domain needs to awaken from there.

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject), which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Quoted 7 lines

It would fantastic to have that in this patch series, and might not be too difficult to do. However, I also think that always waking up the hardware domain could be a decent way to start and could be OK for this patch series which is the very first to introduce suspend/resume functionalities on Xen on ARM. But the limitation should be well explained in the commit message, as Julien wrote, and possibly even as an in-code comment with a TODO.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#133 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Hi Stefano,

Quoted 80 lines · Stefano Stabellini
Quoted 78 lines · Stefano Stabellini
Quoted 68 lines · Julien Grall
Quoted 1 line · Mirela Simonovic

Hi Julien,

Hi Mirela,

Quoted 40 lines · Julien Grall
Quoted 38 lines · Mirela Simonovic
Quoted 10 lines
Quoted 8 lines · Mirela Simonovic

Hi Julien,

Quoted 3 lines · Julien Grall

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · Mirela Simonovic
Quoted 2 lines

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

Please explain why you always need to resume Dom0 afterwards.

We don't need to, but that is what is promised in the design spec.

You surely had some rationale when writing the promise in the design document,
right?

So what is the reason behind it? I don't want to resume a domain if that's not
necessary.

Quoted 6 lines
Quoted 1 line

To be more specific - a domU that doesn't depend on dom0 can resume and work happily without dom0 being resumed, i.e. just Xen and domU resume. So patch "[PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes" is not a must (when there are no PV drivers involved).

Quoted 8 lines
Quoted 4 lines

PV backends don't necessarily reside in the hardware domain. So how is this
going to work for the other case?

I honestly believe that this is not necessary, and is sub-optimal. It relies on an assumption that dom0 contains all the PV drivers, which is not always correct.

Well, there are other reasons to resume the hardware domain. The hardware domain owns most the devices and may be part of the suspend/resume path.

As you tie the host suspend to the hardware domain suspend, it may makes sense to resume at the same time. It is the kind of rationale I would expect in the commit message.

Quoted 6 lines

I would prefer if someone can tell us that any frontend will trigger an event to the backend, and the event would go through Xen. That way, this event would cause a domain containing the backend driver to resume. I think this is the best possible solution, but it relies on an assumption that the event will go through Xen, and I'm not knowledgeable enough to claim that this is indeed the case.

Quoted 2 lines

I think it is should work, the best way to find out if building a test case for it.

Yes, PV protocols use hypercalls to send notifications to the other end. Specifically, the function at the Linux side is include/xen/events.h:notify_remote_via_evtchn. The Xen implementation for the hypercall is xen/common/event_channel.c:evtchn_send, where 'rd' is the destination domain.

Quoted 8 lines
Quoted 2 lines

It should be possible to figure out which domain needs to awaken from there.

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject), which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Absolutely, that sounds great :) Then we could just drop this patch. Of course, we need to test to confirm

Quoted 9 lines
Quoted 8 lines

It would fantastic to have that in this patch series, and might not be too difficult to do. However, I also think that always waking up the hardware domain could be a decent way to start and could be OK for this patch series which is the very first to introduce suspend/resume functionalities on Xen on ARM. But the limitation should be well explained in the commit message, as Julien wrote, and possibly even as an in-code comment with a TODO.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#134 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Quoted 87 lines · Mirela Simonovic

Hi Stefano,

Quoted 83 lines · Stefano Stabellini
Quoted 80 lines · Stefano Stabellini
Quoted 68 lines · Julien Grall
Quoted 1 line · Mirela Simonovic

Hi Julien,

Hi Mirela,

Quoted 40 lines · Julien Grall
Quoted 38 lines · Mirela Simonovic
Quoted 10 lines
Quoted 8 lines · Mirela Simonovic

Hi Julien,

Quoted 3 lines · Julien Grall

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines · Mirela Simonovic
Quoted 2 lines

The resume of Dom0 should always follow Xen's resume. This is done by unblocking the first vCPU of Dom0.

Please explain why you always need to resume Dom0 afterwards.

We don't need to, but that is what is promised in the design spec.

You surely had some rationale when writing the promise in the design document,
right?

So what is the reason behind it? I don't want to resume a domain if that's not
necessary.

Quoted 6 lines
Quoted 1 line

To be more specific - a domU that doesn't depend on dom0 can resume and work happily without dom0 being resumed, i.e. just Xen and domU resume. So patch "[PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes" is not a must (when there are no PV drivers involved).

Quoted 8 lines
Quoted 4 lines

PV backends don't necessarily reside in the hardware domain. So how is this
going to work for the other case?

I honestly believe that this is not necessary, and is sub-optimal. It relies on an assumption that dom0 contains all the PV drivers, which is not always correct.

Well, there are other reasons to resume the hardware domain. The hardware domain owns most the devices and may be part of the suspend/resume path.

As you tie the host suspend to the hardware domain suspend, it may makes sense to resume at the same time. It is the kind of rationale I would expect in the commit message.

Quoted 6 lines

I would prefer if someone can tell us that any frontend will trigger an event to the backend, and the event would go through Xen. That way, this event would cause a domain containing the backend driver to resume. I think this is the best possible solution, but it relies on an assumption that the event will go through Xen, and I'm not knowledgeable enough to claim that this is indeed the case.

Quoted 2 lines

I think it is should work, the best way to find out if building a test case for it.

Yes, PV protocols use hypercalls to send notifications to the other end. Specifically, the function at the Linux side is include/xen/events.h:notify_remote_via_evtchn. The Xen implementation for the hypercall is xen/common/event_channel.c:evtchn_send, where 'rd' is the destination domain.

It should be possible to figure out which domain needs to awaken from there.

Quoted 7 lines
Quoted 5 lines

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject), which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Absolutely, that sounds great :) Then we could just drop this patch.

I don't think you can drop this patch... As you tie the host suspend to the hardware domain suspend, it may makes sense to resume at the same time.

Otherwise we should provide a separate hypercall to suspend/resume the host.

The whole point of the thread is we need to document why the decision was made in one way or another. So when someone look at it in 2 years time, we know why it has been done like that.

Cheers,

Signature · 5 lines
Julien Grall
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#135 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Quoted 14 lines · Julien Grall
Quoted 13 lines · Mirela Simonovic
Quoted 10 lines · Stefano Stabellini
Quoted 3 lines

It should be possible to figure out which domain needs to awaken from
there.

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject),
which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Quoted 8 lines
Quoted 2 lines

Absolutely, that sounds great :) Then we could just drop this patch.

I don't think you can drop this patch... As you tie the host suspend to
the hardware domain suspend, it may makes sense to resume at the same time.

FWIW, I think that too.

In fact, let's assume a *fully* disaggregated setup, where dom0 only has the toolstack, while it has no hardware, no PV backend, etc... If we don't resume it explicitly together with Xen, who is going to resume it? :-O

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Software Engineer @ SUSE https://www.suse.com/

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#136 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Quoted 23 lines · Dario Faggioli
Quoted 14 lines · Julien Grall
Quoted 13 lines · Mirela Simonovic
Quoted 10 lines · Stefano Stabellini
Quoted 3 lines

It should be possible to figure out which domain needs to awaken from
there.

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject),
which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Quoted 8 lines
Quoted 2 lines

Absolutely, that sounds great :) Then we could just drop this patch.

I don't think you can drop this patch... As you tie the host suspend to
the hardware domain suspend, it may makes sense to resume at the same time.

Quoted 6 lines

FWIW, I think that too.

In fact, let's assume a *fully* disaggregated setup, where dom0 only has the toolstack, while it has no hardware, no PV backend, etc... If we don't resume it explicitly together with Xen, who is going to resume it? :-O

Yes, that's right. However, it should work for driver domains: there is no need to wake up driver domains explicitly because they will be woken up by the frontends?

Quoted 5 lines

<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Software Engineer @ SUSE https://www.suse.com/

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#137 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Hi,

Quoted 27 lines · Stefano Stabellini
Quoted 25 lines · Dario Faggioli
Quoted 14 lines · Julien Grall
Quoted 13 lines · Mirela Simonovic
Quoted 10 lines · Stefano Stabellini
Quoted 3 lines

It should be possible to figure out which domain needs to awaken from
there.

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject),
which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Quoted 8 lines
Quoted 2 lines

Absolutely, that sounds great :) Then we could just drop this patch.

I don't think you can drop this patch... As you tie the host suspend to
the hardware domain suspend, it may makes sense to resume at the same time.

FWIW, I think that too.

Quoted 9 lines
Quoted 4 lines

In fact, let's assume a *fully* disaggregated setup, where dom0 only has the toolstack, while it has no hardware, no PV backend, etc... If we don't resume it explicitly together with Xen, who is going to resume it? :-O

Yes, that's right. However, it should work for driver domains: there is no need to wake up driver domains explicitly because they will be woken up by the frontends?

I think we all agree, except some of us weren't so clear about it :) For now, dom0 issues suspend and should resume as well when Xen suspends. This is done in the series, resume is covered by this patch, and commit message should be clarified.

If a domU has a backend, we should verify that it can be woken-up by an event triggered by a frontend driver in another domain.

One day, this patch could be dropped/reverted if one come up with a different logic for triggering Xen suspend. This should be of the table for now, but a good option to remember for future.

Quoted 6 lines
Quoted 6 lines

<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Software Engineer @ SUSE https://www.suse.com/

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#138 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Quoted 37 lines · Mirela Simonovic

Hi,

Quoted 32 lines · Stefano Stabellini
Quoted 29 lines · Dario Faggioli
Quoted 14 lines · Julien Grall
Quoted 13 lines · Mirela Simonovic
Quoted 10 lines · Stefano Stabellini
Quoted 3 lines

It should be possible to figure out which domain needs to awaken from
there.

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject),
which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Quoted 8 lines
Quoted 2 lines

Absolutely, that sounds great :) Then we could just drop this patch.

I don't think you can drop this patch... As you tie the host suspend to
the hardware domain suspend, it may makes sense to resume at the same time.

FWIW, I think that too.

In fact, let's assume a *fully* disaggregated setup, where dom0 only has the toolstack, while it has no hardware, no PV backend, etc... If we don't resume it explicitly together with Xen, who is going to resume it? :-O

Quoted 8 lines
Quoted 4 lines

Yes, that's right. However, it should work for driver domains: there is no need to wake up driver domains explicitly because they will be woken up by the frontends?

I think we all agree, except some of us weren't so clear about it :) For now, dom0 issues suspend and should resume as well when Xen suspends. This is done in the series, resume is covered by this patch,

resumes

Quoted 15 lines

and commit message should be clarified.

If a domU has a backend, we should verify that it can be woken-up by an event triggered by a frontend driver in another domain.

One day, this patch could be dropped/reverted if one come up with a different logic for triggering Xen suspend. This should be of the table for now, but a good option to remember for future.

Quoted 6 lines
Quoted 6 lines

<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Software Engineer @ SUSE https://www.suse.com/

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#139 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Hi,

Quoted 33 lines · Mirela Simonovic
Quoted 30 lines · Mirela Simonovic

Hi,

Quoted 25 lines · Stefano Stabellini
Quoted 23 lines · Dario Faggioli
Quoted 22 lines · Julien Grall
Quoted 13 lines · Mirela Simonovic
Quoted 10 lines · Stefano Stabellini
Quoted 3 lines

It should be possible to figure out which domain needs to awaken from
there.

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject),
which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Quoted 2 lines

Absolutely, that sounds great :) Then we could just drop this patch.

I don't think you can drop this patch... As you tie the host suspend to
the hardware domain suspend, it may makes sense to resume at the same time.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

FWIW, I think that too.

In fact, let's assume a *fully* disaggregated setup, where dom0 only has the toolstack, while it has no hardware, no PV backend, etc... If we don't resume it explicitly together with Xen, who is going to resume it? :-O

Forgot to answer this - when someone needs a toolstack, it will try to type. That will raise a UART interrupt (UART used by Xen console). It could be implemented that a UART interrupt by default wakes up dom0 if it's asleep.
But I would keep anything like that out of this series.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Yes, that's right. However, it should work for driver domains: there is no need to wake up driver domains explicitly because they will be woken up by the frontends?

Quoted 20 lines
Quoted 3 lines

I think we all agree, except some of us weren't so clear about it :) For now, dom0 issues suspend and should resume as well when Xen suspends. This is done in the series, resume is covered by this patch,

resumes

Quoted 15 lines

and commit message should be clarified.

If a domU has a backend, we should verify that it can be woken-up by an event triggered by a frontend driver in another domain.

One day, this patch could be dropped/reverted if one come up with a different logic for triggering Xen suspend. This should be of the table for now, but a good option to remember for future.

Quoted 6 lines
Quoted 6 lines

<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Software Engineer @ SUSE https://www.suse.com/

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#140 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

In reply to Mirela Simonovic
Quoted 1 line · Mirela Simonovic

Hi,

Hi Mirela,

Quoted 45 lines
Quoted 27 lines · Stefano Stabellini
Quoted 25 lines · Dario Faggioli
Quoted 14 lines · Julien Grall
Quoted 13 lines · Mirela Simonovic
Quoted 10 lines · Stefano Stabellini
Quoted 3 lines

It should be possible to figure out which domain needs to awaken from
there.

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject),
which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Quoted 8 lines
Quoted 2 lines

Absolutely, that sounds great :) Then we could just drop this patch.

I don't think you can drop this patch... As you tie the host suspend to
the hardware domain suspend, it may makes sense to resume at the same time.

FWIW, I think that too.

Quoted 9 lines
Quoted 4 lines

In fact, let's assume a *fully* disaggregated setup, where dom0 only has the toolstack, while it has no hardware, no PV backend, etc... If we don't resume it explicitly together with Xen, who is going to resume it? :-O

Yes, that's right. However, it should work for driver domains: there is no need to wake up driver domains explicitly because they will be woken up by the frontends?

I think we all agree, except some of us weren't so clear about it :) For now, dom0 issues suspend and should resume as well when Xen suspends. This is done in the series, resume is covered by this patch, and commit message should be clarified.

Quoted 6 lines

If a domU has a backend, we should verify that it can be woken-up by an event triggered by a frontend driver in another domain.

One day, this patch could be dropped/reverted if one come up with a different logic for triggering Xen suspend. This should be of the table for now, but a good option to remember for future.

Such change cannot be easily dropped because some hardware domain OS may rely on that behavior.

I am also interested to see how this is going to fit with the Dom0less use case. The end goal is to have no Dom0/Hardware domain. So how do you expect suspend/resume to work in that case? Note that I am not asking to implement it :).

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#141 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Hi Julien,

Quoted 60 lines · Julien Grall
Quoted 1 line · Mirela Simonovic

Hi,

Hi Mirela,

Quoted 45 lines
Quoted 27 lines · Stefano Stabellini
Quoted 25 lines · Dario Faggioli
Quoted 14 lines · Julien Grall
Quoted 13 lines · Mirela Simonovic
Quoted 10 lines · Stefano Stabellini
Quoted 3 lines

It should be possible to figure out which domain needs to awaken from
there.

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject),
which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Quoted 8 lines
Quoted 2 lines

Absolutely, that sounds great :) Then we could just drop this patch.

I don't think you can drop this patch... As you tie the host suspend to
the hardware domain suspend, it may makes sense to resume at the same time.

FWIW, I think that too.

Quoted 9 lines
Quoted 4 lines

In fact, let's assume a *fully* disaggregated setup, where dom0 only has the toolstack, while it has no hardware, no PV backend, etc... If we don't resume it explicitly together with Xen, who is going to resume it? :-O

Yes, that's right. However, it should work for driver domains: there is no need to wake up driver domains explicitly because they will be woken up by the frontends?

I think we all agree, except some of us weren't so clear about it :) For now, dom0 issues suspend and should resume as well when Xen suspends. This is done in the series, resume is covered by this patch, and commit message should be clarified.

Quoted 6 lines

If a domU has a backend, we should verify that it can be woken-up by an event triggered by a frontend driver in another domain.

One day, this patch could be dropped/reverted if one come up with a different logic for triggering Xen suspend. This should be of the table for now, but a good option to remember for future.

Quoted 8 lines

Such change cannot be easily dropped because some hardware domain OS may rely on that behavior.

I am also interested to see how this is going to fit with the Dom0less use case. The end goal is to have no Dom0/Hardware domain. So how do you expect suspend/resume to work in that case? Note that I am not asking to implement it :).

From the implementation perspective and future changes which would be required in this series it's not going to be the problem to support dom0less approach - just one line of code (the if statement that checks whether the hardware domain suspended) has to be replaced with some other check. That other check would be a new condition to suspend Xen that needs to be implemented. What that check would do depends on the system architecture and target use cases that are specific to dom0less architecture. I'm not so familiar with dom0less work, so can't really say what would be the best approach to suspend condition rules.
Do you have some whitepaper or anything similar that describes an example of a target system architecture and/or use cases for dom0less setup?
In dom0less world, who creates other domains? Is some domain still more privileged than the others? E.g. is there a domain which knows about other domains in the system so that it could do the coordination in EL1?

Thanks,
Mirela

Quoted 4 lines

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#142 lore raw

Re: [PATCH 17/18] xen/arm: Resume Dom0 after Xen resumes

Hi Mirela,

Quoted 72 lines · Mirela Simonovic

Hi Julien,

Quoted 60 lines · Julien Grall
Quoted 1 line · Mirela Simonovic

Hi,

Hi Mirela,

Quoted 45 lines
Quoted 27 lines · Stefano Stabellini
Quoted 25 lines · Dario Faggioli
Quoted 14 lines · Julien Grall
Quoted 13 lines · Mirela Simonovic
Quoted 10 lines · Stefano Stabellini
Quoted 3 lines

It should be possible to figure out which domain needs to awaken from
there.

Actually, evtchn_send eventually will trigger a proper interrupt injection into the domain (xen/arch/arm/vgic.c:arch_evtchn_inject),
which will necessarely wake it up. So it is possible that it will already work without any need for additional changes?

Quoted 8 lines
Quoted 2 lines

Absolutely, that sounds great :) Then we could just drop this patch.

I don't think you can drop this patch... As you tie the host suspend to
the hardware domain suspend, it may makes sense to resume at the same time.

FWIW, I think that too.

Quoted 9 lines
Quoted 4 lines

In fact, let's assume a *fully* disaggregated setup, where dom0 only has the toolstack, while it has no hardware, no PV backend, etc... If we don't resume it explicitly together with Xen, who is going to resume it? :-O

Yes, that's right. However, it should work for driver domains: there is no need to wake up driver domains explicitly because they will be woken up by the frontends?

I think we all agree, except some of us weren't so clear about it :) For now, dom0 issues suspend and should resume as well when Xen suspends. This is done in the series, resume is covered by this patch, and commit message should be clarified.

Quoted 6 lines

If a domU has a backend, we should verify that it can be woken-up by an event triggered by a frontend driver in another domain.

One day, this patch could be dropped/reverted if one come up with a different logic for triggering Xen suspend. This should be of the table for now, but a good option to remember for future.

Quoted 8 lines

Such change cannot be easily dropped because some hardware domain OS may rely on that behavior.

I am also interested to see how this is going to fit with the Dom0less use case. The end goal is to have no Dom0/Hardware domain. So how do you expect suspend/resume to work in that case? Note that I am not asking to implement it :).

Quoted 13 lines

From the implementation perspective and future changes which would be
required in this series it's not going to be the problem to support dom0less approach - just one line of code (the if statement that checks whether the hardware domain suspended) has to be replaced with some other check. That other check would be a new condition to suspend Xen that needs to be implemented. What that check would do depends on the system architecture and target use cases that are specific to dom0less architecture. I'm not so familiar with dom0less work, so can't really say what would be the best approach to suspend condition rules.
Do you have some whitepaper or anything similar that describes an example of a target system architecture and/or use cases for dom0less setup?

Have a look at docs/features/dom0less.markdown

Quoted 4 lines

In dom0less world, who creates other domains? Is some domain still more privileged than the others? E.g. is there a domain which knows about other domains in the system so that it could do the coordination in EL1?

It depends on your setup. In some setup, all the domains could be created by Xen and therefore there are no guest more privileged than one. But in other setup, you may still have a privilege domain (i.e hwdom/dom0).

What I want to avoid is if we tie ourself to an ABI than can't be changed anymore. In the guest context, I guess considering that Xen will suspend/resuming when Xen is suspending/resuming is probably a safe bet.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#143 lore raw

PATCH 18/18 xen/arm: Suspend/resume console on Xen suspend/resume

In reply to Mirela Simonovic

This is done using generic console_suspend/resume functions that cause uart driver specific suspend/resume handlers to be called for each initialized port (if the port has suspend/resume driver handlers implemented).

---
 xen/arch/arm/suspend.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
xen/arch/arm/suspend.c +14 -0
index a05aea9c25..6d7d69539b 100644
@@ -1,5 +1,6 @@
 #include <xen/sched.h>
 #include <xen/cpu.h>
+#include <xen/console.h>
 #include <asm/cpufeature.h>
 #include <asm/event.h>
 #include <asm/psci.h>
@@ -149,6 +150,15 @@ static long system_suspend(void *data)
         goto resume_irqs;
     }
 
+    dprintk(XENLOG_DEBUG, "Suspend\n");
+    status = console_suspend();
+    if ( status )
+    {
+        dprintk(XENLOG_ERR, "Failed to suspend the console, err=%d\n", status);
+        system_state = SYS_STATE_resume;
+        goto resume_console;
+    }
+
     if ( hyp_suspend(&cpu_context) )
     {
         status = call_psci_system_suspend();
@@ -175,6 +185,10 @@ static long system_suspend(void *data)
      */
     mmu_init_secondary_cpu();
 
+resume_console:
+    console_resume();
+    dprintk(XENLOG_DEBUG, "Resume\n");
+
     gic_resume();
 
 resume_irqs:
Signature · 7 lines
2.13.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#144 lore raw

Re: [PATCH 18/18] xen/arm: Suspend/resume console on Xen suspend/resume

Hi Mirela,

Quoted 23 lines · Mirela Simonovic

This is done using generic console_suspend/resume functions that cause uart driver specific suspend/resume handlers to be called for each initialized port (if the port has suspend/resume driver handlers implemented).

---
  xen/arch/arm/suspend.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
xen/arch/arm/suspend.c +1 -0
index a05aea9c25..6d7d69539b 100644
@@ -1,5 +1,6 @@
  #include <xen/sched.h>
  #include <xen/cpu.h>
+#include <xen/console.h>
  #include <asm/cpufeature.h>
  #include <asm/event.h>
  #include <asm/psci.h>

xen/arch/arm/suspend.c static long system_suspend(void *data) · line 153

Quoted 4 lines
xen/arch/arm/suspend.c +1 -0
@@ -149,6 +150,15 @@ static long system_suspend(void *data)
          goto resume_irqs;
      }
 
+    dprintk(XENLOG_DEBUG, "Suspend\n");

This message may not appear on the console unless it is synchronized (see console_start_sync). Also, it might be a useful message in non-debug build.

Ideally the suspend/resume logic should not be much different than x86 (see arch/x86/acpi/power.c).

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#145 lore raw
In reply to Mirela Simonovic

Hi,

One thing I screwed - I forgot to remove changes log from an internal review, so please ignore it. This is officially the first version.

Thanks,
Mirela

Quoted 165 lines · Mirela Simonovic

This series contains support for suspend to RAM (in the following text just 'suspend') for Xen on arm64. The implementation is aligned with the design specification that has been proposed on xen-devel list:
https://lists.xenproject.org/archives/html/xen-devel/2017-12/msg01574.html

At a high-level the series contains:
1) Support for suspending guests via virtual PSCI SYSTEM_SUSPEND call
2) Support for resuming a guest on an interrupt targeted to that guest
3) Support for suspending Xen after dom0 finalizes the suspend
4) Support for resuming Xen on an interrupt that is targeted to a guest

--------------------------------------------------------------------------------
In more details:

*** About suspending/resuming guests

The patches included in this series allow PSCI compliant guests that have support for suspend to RAM (e.g. echo mem > /sys/power/state in Linux) to suspend and resume on top of Xen without any EL1 code changes.

During their suspend procedure guests will hot-unplug their secondary CPUs, triggering Xen's virtual CPU_OFF PSCI implementation, and then finalize the suspend from their boot CPU, triggering Xen's virtual SYSTEM_SUSPEND PSCI. Guests will save/restore their own EL1 context on suspend/resume.

A guest is expected to leave enabled interrupts that are considered to be its
wake-up sources. Those interrupts will be able to wake up the guest. This holds
regardless of the state of the underlying software layers, i.e. whether Xen gets
suspended or not doesn't affect the ability of the guest to wake up.

First argument of SYSTEM_SUSPEND PSCI call is a resume entry point, from which
the guest assumes to start on resume. On resume, guests assume to be running in
an environment whose state matches the CPU state after reset, e.g. with reset
register values, MMU disabled, etc. To ensure this, Xen has to 'reset' the VCPU context and save the resume entry point into program counter before the
guest's VCPU gets scheduled in on resume. This is done when the guest finalizes
its suspend by calling PSCI SYSTEM_SUSPEND. In addition, we need to ensure that
the resume-ready VCPU's context does not get overwritten later upon the context
switch when the VCPU is scheduled out.
Xen also needs to take care that the guest's view of GIC and timer gets saved.
Also, while a guest is suspended its watchdogs are paused, in order to avoid
watchdog triggered shutdown of a guest that has been asleep for a period of time
that is longer than the watchdog period.

After this point, from Xen's point of view a suspended guest has one VCPU blocked, waiting for an interrupt. When such an interrupt comes, Xen will unblock the VCPU of the suspended domain, which results in the guest resuming.

*** About suspending/resuming Xen

Xen starts its own suspend procedure once dom0 is suspended. Dom0 is considered to be the decision maker for EL1 and EL2.
On suspend, Xen will first freeze all domains. Then, Xen disables physical secondary CPUs, which leads to physical CPU_OFF to be called by each secondary
CPU. After that Xen finalizes the suspend from the boot CPU.

This consists of suspending the timer, i.e. suppressing its interrupts (we don't
want to be woken up by a timer, there is no VCPU ready to be scheduled). Then
the state of GIC is saved, console is suspended, and CPU context is saved. The
saved context tells where Xen needs to continue execution on resume. Since Xen will resume with MMU disabled, the first thing to do in resume is to
resume memory management in order to be able to access the context that needs to
be restored (we know virtual address of the context data). Finally Xen calls
SYSTEM_SUSPEND PSCI to the EL3.

When resuming, all the steps done in suspend need to be reverted. This is completed by unblocking dom0's VCPU, because we always want the dom0 to resume,
regardless of the target domain whose interrupt woke up Xen.

*** Handling of unprivileged guests during Xen suspend/resume

Any domU that is not suspended when dom0 suspends will be frozen, domUs that are
already suspended remain suspended. On resume the suspended domUs still remain
suspended (unless their wake interrupt caused Xen to wake) while the others will
be thawed.

For more details please refer to patches or the design specification:
https://lists.xenproject.org/archives/html/xen-devel/2017-12/msg01574.html

--------------------------------------------------------------------------------
The series does not include:
a) UART driver-specific suspend/resume that gets called when console suspends
b) SMMU suspend/resume
c) Suspend coordination support that would allow dom0 to request domUs to suspend
These will be submitted in the following series.

Mirela Simonovic (16):
xen/arm: Implement PSCI system suspend call (virtual interface) xen/arm: Save GIC and virtual timer context when the domain suspends xen/arm: While a domain is suspended put its watchdogs on pause xen/arm: Trigger Xen suspend when Dom0 completes suspend xen/x86: Move freeze/thaw_domains into common files xen/arm: Freeze domains on suspend and thaw them on resume xen/arm: Disable/enable non-boot physical CPUs on suspend/resume xen/arm: Add rcu_barrier() before enabling non-boot CPUs on resume xen/arm: Implement GIC suspend/resume functions (gicv2 only) xen/arm: Suspend/resume GIC on system suspend/resume xen/arm: Suspend/resume timer interrupt generation xen/arm: Implement PSCI SYSTEM_SUSPEND call (physical interface) xen/arm: Resume memory management on Xen resume
xen/arm: Save/restore context on suspend/resume
xen/arm: Resume Dom0 after Xen resumes
xen/arm: Suspend/resume console on Xen suspend/resume

Saeed Nowshadi (2):
xen/arm: Move code that initializes VCPU context into a separate
function
xen/arm: Convert setting MMU page tables code into a routine

 xen/arch/arm/Makefile            |   1 +
 xen/arch/arm/arm64/entry.S       | 178 ++++++++++++++++++++++++
 xen/arch/arm/arm64/head.S        | 265 ++++++++++++++++++-----------------
 xen/arch/arm/domain.c            |  62 ++++++---
 xen/arch/arm/gic-v2.c            | 147 ++++++++++++++++++++
 xen/arch/arm/gic.c               |  27 ++++
 xen/arch/arm/mm.c                |   1 +
 xen/arch/arm/psci.c              |  16 +++
 xen/arch/arm/suspend.c           | 292
+++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/time.c              |  22 +++
 xen/arch/arm/vpsci.c             |  19 +++
 xen/arch/x86/acpi/power.c        |  28 ----
 xen/common/domain.c              |  29 ++++
 xen/common/schedule.c            |  38 +++++
 xen/include/asm-arm/gic.h        |   8 ++
 xen/include/asm-arm/perfc_defn.h |   1 +
 xen/include/asm-arm/psci.h       |   3 +
 xen/include/asm-arm/suspend.h    |  39 ++++++
 xen/include/asm-arm/time.h       |   3 +
 xen/include/xen/domain.h         |   1 +
 xen/include/xen/sched.h          |  11 ++
 xen/include/xen/timer.h          |   3 +
 22 files changed, 1019 insertions(+), 175 deletions(-)
 create mode 100644 xen/arch/arm/suspend.c
 create mode 100644 xen/include/asm-arm/suspend.h
Quoted 4 lines

--
2.13.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#146 lore raw
In reply to Mirela Simonovic

Hi Mirela,

Thank you for posting the series. Could you provide a branch with the patch applied?

Quoted 3 lines · Mirela Simonovic

--------------------------------------------------------------------------------
The series does not include:
a) UART driver-specific suspend/resume that gets called when console suspends

I feel it will be difficult to test this series without UART driver support. Would it be possible to integrate them in that series?

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#147 lore raw

Hi Julien,

Quoted 6 lines · Julien Grall

Hi Mirela,

Thank you for posting the series. Could you provide a branch with the patch applied?

I have applied patches on top of upstream/staging.

Quoted 11 lines · Mirela Simonovic
Quoted 1 line

--------------------------------------------------------------------------------

Quoted 2 lines

The series does not include:
a) UART driver-specific suspend/resume that gets called when console

suspends

I feel it will be difficult to test this series without UART driver support. Would it be possible to integrate them in that series?

Yes that's possible, but you'll need more than a UART driver's suspend/resume to test this. E.g. for testing the series on Xilinx Ultrascale+ MPSoC we need a set of patches that provides the basic platform support needed to boot, which is not yet upstreamed. Luckily, the suspend support is independent (ARM specific).
Please let me check with Xilinx people and Stefano how to deal with this, and I'll come back with a real answer.

Thanks,
Mirela

Quoted 5 lines

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#148 lore raw
Quoted 1 line · Mirela Simonovic

Hi Julien,

Hi Mirela,

Please configure your e-mail client to avoid quoting using "space". Otherwise, this is going to make difficult to follow the discussions.

Quoted 9 lines · On Mon, Nov 12, 2018 at 12:50 PM Julien Grall <[email protected]…

Hi Mirela,

Thank you for posting the series. Could you provide a branch with the patch applied?

I have applied patches on top of upstream/staging.

patches are applied every day to staging. So can you please provide the exact commit?

Also, it is common for big series to provide a branch with the patch series applied. This makes easier for people to try your series.

Quoted 8 lines · Mirela Simonovic

>
--------------------------------------------------------------------------------
> The series does not include:
> a) UART driver-specific suspend/resume that gets called when
console suspends

Quoted 5 lines

I feel it will be difficult to test this series without UART driver support. Would it be possible to integrate them in that series?

Yes that's possible, but you'll need more than a UART driver's suspend/resume to test this. E.g. for testing the series on Xilinx Ultrascale+ MPSoC we need a set of patches that provides the basic platform support needed to boot, which is not yet upstreamed. Luckily, the suspend support is independent (ARM specific).

I am a bit confused. I thought it was possible to boot Xen out-of-box on the Zynq MP. What is missing?

Quoted 1 line

Please let me check with Xilinx people and Stefano how to deal with this, and I'll come back with a real answer.

If that's too difficult to provide in short term. Then I would appreciate if testing is done on another platform (e.g Foundation Model). So I can at least verify the series before we merge it.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#149 lore raw

Hi Julien,

Quoted 9 lines · Julien Grall
Quoted 1 line · Mirela Simonovic

Hi Julien,

Hi Mirela,

Please configure your e-mail client to avoid quoting using "space". Otherwise, this is going to make difficult to follow the discussions.

Sure, sorry.

Quoted 5 lines
Quoted 5 lines

On Mon, Nov 12, 2018 at 12:50 PM Julien Grall <[email protected] <mailto:[email protected]>> wrote:

Hi Mirela,

Quoted 9 lines
Quoted 5 lines

Thank you for posting the series. Could you provide a branch with the patch applied?

I have applied patches on top of upstream/staging.

patches are applied every day to staging. So can you please provide the exact commit?

Oh yes, the staging already moved. It was this one: 388c55b tools/misc: fix hard tabs in xen-hvmctx.c

Quoted 24 lines

Also, it is common for big series to provide a branch with the patch series applied. This makes easier for people to try your series.

Quoted 12 lines · Mirela Simonovic

>
--------------------------------------------------------------------------------
> The series does not include:
> a) UART driver-specific suspend/resume that gets called when
console suspends

I feel it will be difficult to test this series without UART driver support. Would it be possible to integrate them in that series?

Quoted 5 lines

Yes that's possible, but you'll need more than a UART driver's suspend/resume to test this. E.g. for testing the series on Xilinx Ultrascale+ MPSoC we need a set of patches that provides the basic platform support needed to boot, which is not yet upstreamed. Luckily, the suspend support is independent (ARM specific).

I am a bit confused. I thought it was possible to boot Xen out-of-box on the Zynq MP. What is missing?

Quoted 7 lines
Quoted 2 lines

Please let me check with Xilinx people and Stefano how to deal with this, and I'll come back with a real answer.

If that's too difficult to provide in short term. Then I would appreciate if testing is done on another platform (e.g Foundation Model). So I can at least verify the series before we merge it.

No, it's not difficult at all, I just need Xilinx support on this.

Quoted 4 lines

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#150 lore raw
In reply to Julien Grall
Quoted 7 lines · Julien Grall

Hi Mirela,

Thank you for posting the series. Could you provide a branch with the patch applied?

Quoted 1 line · Mirela Simonovic
Quoted 7 lines
Quoted 4 lines

--------------------------------------------------------------------------------
The series does not include:
a) UART driver-specific suspend/resume that gets called when console suspends

I feel it will be difficult to test this series without UART driver support. Would it be possible to integrate them in that series?

Actually, you can test this series simply using upstream Linux and upstream Xen + this series. You can use echo mem > /sys/power/state in dom0 to go into suspend, and for example setup an RTC wakeup event to wakeup after a certain amount of time. For instance echo +30 > /sys/class/rtc/rtc0/wakealarm.

For the Xilinx MPSoC, Linux 4.19 works fine with defconfig. Linux 4.20 (current master) gained EEMI support, but I tested it and it seems to suspend successfully even if Xen doesn't know how to handle the EEMI calls that Linux makes when suspending.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#151 lore raw

Hi Stefano,

Quoted 13 lines · Stefano Stabellini
Quoted 12 lines · Julien Grall

Hi Mirela,

Thank you for posting the series. Could you provide a branch with the patch applied?

Quoted 5 lines · Mirela Simonovic

--------------------------------------------------------------------------------
The series does not include:
a) UART driver-specific suspend/resume that gets called when console suspends

Quoted 8 lines
Quoted 2 lines

I feel it will be difficult to test this series without UART driver support. Would it be possible to integrate them in that series?

Actually, you can test this series simply using upstream Linux and upstream Xen + this series. You can use echo mem > /sys/power/state in dom0 to go into suspend, and for example setup an RTC wakeup event to wakeup after a certain amount of time. For instance echo +30 > /sys/class/rtc/rtc0/wakealarm.

I am quite surprised this series is enough given there are a BUG() in the suspend path for the console.

So what is your xen command line?

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#152 lore raw
Quoted 28 lines · Julien Grall

Hi Stefano,

Quoted 19 lines · Stefano Stabellini
Quoted 9 lines · Julien Grall

Hi Mirela,

Thank you for posting the series. Could you provide a branch with the patch
applied?

Quoted 2 lines · Mirela Simonovic
Quoted 8 lines
Quoted 4 lines

--------------------------------------------------------------------------------
The series does not include:
a) UART driver-specific suspend/resume that gets called when console suspends

I feel it will be difficult to test this series without UART driver support.
Would it be possible to integrate them in that series?

Quoted 5 lines

Actually, you can test this series simply using upstream Linux and upstream Xen + this series. You can use echo mem > /sys/power/state in dom0 to go into suspend, and for example setup an RTC wakeup event to wakeup after a certain amount of time. For instance echo +30 > /sys/class/rtc/rtc0/wakealarm.

Quoted 4 lines

I am quite surprised this series is enough given there are a BUG() in the suspend path for the console.

So what is your xen command line?

No, I made a mistake in rebasing Mirela's branch: I tested a branch which included the two unsent patches that removed exactly the BUG() you are talking about. Without those two patches, Xen is unable to resume correctly on the MPSoC due to the UART.

Mirela, it is better to include the two patches in your next version of the series. If you think they are not up to quality for being merged upstream, i.e. they are just hacks for testing, that's OK, tag them with [PATCH DO-NOT-APPLY] to make it clear. It is also useful to post a git branch in your 0 email when the patch series is large.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel