[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 0/1] xen: fix HVM kexec kernel panic
- To: Dongli Zhang <dongli.zhang@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, x86@xxxxxxxxxx
- From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
- Date: Fri, 25 Feb 2022 17:39:15 -0500
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1O3xyKUv4FtQGNH4I0wtWPNQhC27Zof8tVcpw0UEso0=; b=X1qZyywrE9zcekRPSPOsHnas0ob6hiPP1scFuuIeUty3eWyQn/HINukLbbQZgM9pTtTefgPMeMsKmreOxktyeS8U6cLqUGuRq8VIriso+P52Joj/Ewzzu9+hdagu4GQ3gwtxTeH3Ybpkz1zf8I2WewcVaMo1767G0Z33w2+z5rwIfN0kmVtfjxaSPaAKN82RynZ/AsHzFgG5tdVKmEBDlXl41PL3o3409V9EVqv5w2GRAVvl3QY9BdHQiViSO+7F3A36hzAi3sjq/EWUWQJ4iIAkIBdwIKvi3K0OQUmdsGJQKkeKZTq5fVNW+ZPlKElCsCEk7rXcecjnACroGbuOgw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GNUmQcfu4YvgHUqXpDNenyI2KJh+wxogbf1sCbUtgh2yj1/5Z3ioEt9MbRRuJKlG0m1d4P1PHw93qHWHW4tBLi53nOB/09e8YZ3k0C1I0WF1qQx0lzGooSYckhX7gg2ev+yU59UvnzveCbV96R+Ja03qrSa2d18Rp5Nz5b+DSEfmSELxwG7QUQrEizspvE3IFK54czI1Nv5ywdNvUq4dyqWlb+UAz5wEtsxMzrmMPJHBKVEEtuCUaKIgI7ztoRPnYhxu0GwkM/j5GDr4hNWVpjweu5TndcGvMTmgMu3DqMCbmlnNsvmgcMIawu8BKwUyjfXXoSVv3rTzBRr8TbgcvQ==
- Cc: linux-kernel@xxxxxxxxxxxxxxx, jgross@xxxxxxxx, sstabellini@xxxxxxxxxx, tglx@xxxxxxxxxxxxx, mingo@xxxxxxxxxx, bp@xxxxxxxxx, dave.hansen@xxxxxxxxxxxxxxx, hpa@xxxxxxxxx, joe.jin@xxxxxxxxxx
- Delivery-date: Fri, 25 Feb 2022 22:40:12 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2/24/22 4:50 PM, Dongli Zhang wrote:
This is the v3 of the patch to fix xen kexec kernel panic issue when the
kexec is triggered on VCPU >= 32.
PANIC: early exception 0x0e IP 10:ffffffffa96679b6 error 0 cr2 0x20
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted
5.17.0-rc4xen-00054-gf71077a4d84b-dirty #1
[ 0.000000] Hardware name: Xen HVM domU, BIOS 4.4.4OVM 12/15/2020
[ 0.000000] RIP: 0010:pvclock_clocksource_read+0x6/0xb0
... ...
[ 0.000000] RSP: 0000:ffffffffaae03e10 EFLAGS: 00010082 ORIG_RAX:
0000000000000000
[ 0.000000] RAX: 0000000000000000 RBX: 0000000000010000 RCX: 0000000000000002
[ 0.000000] RDX: 0000000000000003 RSI: ffffffffaac37515 RDI: 0000000000000020
[ 0.000000] RBP: 0000000000011000 R08: 0000000000000000 R09: 0000000000000001
[ 0.000000] R10: ffffffffaae03df8 R11: ffffffffaae03c68 R12: 0000000040000004
[ 0.000000] R13: ffffffffaae03e50 R14: 0000000000000000 R15: 0000000000000000
[ 0.000000] FS: 0000000000000000(0000) GS:ffffffffab588000(0000)
knlGS:0000000000000000
[ 0.000000] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 0.000000] CR2: 0000000000000020 CR3: 00000000ea410000 CR4: 00000000000406a0
[ 0.000000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 0.000000] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 0.000000] Call Trace:
[ 0.000000] <TASK>
[ 0.000000] ? xen_clocksource_read+0x24/0x40
This is done to set xen_sched_clock_offset which I think will not be used for a
while, until sched_clock is called (and the other two uses are for
suspend/resume)
Can we simply defer 'xen_sched_clock_offset = xen_clocksource_read();' until
after all vcpu areas are properly set? Or are there other uses of
xen_clocksource_read() before ?
-boris
[ 0.000000] ? xen_init_time_common+0x5/0x49
[ 0.000000] ? xen_hvm_init_time_ops+0x23/0x45
[ 0.000000] ? xen_hvm_guest_init+0x221/0x25c
[ 0.000000] ? 0xffffffffa9600000
[ 0.000000] ? setup_arch+0x440/0xbd6
[ 0.000000] ? start_kernel+0x6c/0x695
[ 0.000000] ? secondary_startup_64_no_verify+0xd5/0xdb
[ 0.000000] </TASK>
Changed since v1:
- Add commit message to explain why xen_hvm_init_time_ops() is delayed
for any vcpus. (Suggested by Boris Ostrovsky)
- Add a comment in xen_hvm_smp_prepare_boot_cpu() referencing the related
code in xen_hvm_guest_init(). (suggested by Juergen Gross)
Changed since v2:
- Delay for all VCPUs. (Suggested by Boris Ostrovsky)
- Add commit message that why PVM is not supported by this patch
- Test if kexec/kdump works with mainline xen (HVM and PVM)
I have delayed the xen_hvm_init_time_ops() for all VCPUs. Unfortunately,
now I am able to reproduce the clock backward as shown below on some old
versions of xen. I am not able to reproduce on most recent mainline xen.
[ 0.359687] pcpu-alloc: [0] 16 17 18 19 20 21 22 23 [0] 24 25 26 27 28 29 30
31
[ 0.359694] pcpu-alloc: [0] 32 33 34 35 36 37 38 39 [0] 40 41 42 43 44 45 46
47
[ 0.359701] pcpu-alloc: [0] 48 49 50 51 52 53 54 55 [0] 56 57 58 59 60 61 62
63
... clock backward after the clocksource is switched from native to xen...
[ 0.000004] Fallback order for Node 0: 0
[ 0.002967] Built 1 zonelists, mobility grouping on. Total pages: 3527744
[ 0.007129] Policy zone: Normal
[ 0.008937] Kernel command line:
BOOT_IMAGE=/boot/vmlinuz-5.17.0-rc4xen-00054-gf71077a4d84b-dirty
root=UUID=2a5975ab-a059-4697-9aee-7a53ddfeea21 ro text console=ttyS0,115200n8
console=tty1 earlyprintk=tty S0,115200n8 loglevel=7 no_timer_check
reboot=s32 splash crashkernel=512M-:192M vt.handoff=1
[ 0.023880] Unknown kernel command line parameters "text splash
BOOT_IMAGE=/boot/vmlinuz-5.17.0-rc4xen-00054-gf71077a4d84b-dirty", will be passed to
user space.
[ 0.032647] printk: log_buf_len individual max cpu contribution: 4096 bytes
[ 0.036828] printk: log_buf_len total cpu_extra contributions: 258048 bytes
[ 0.041049] printk: log_buf_len min size: 262144 bytes
[ 0.044481] printk: log_buf_len: 524288 bytes
Since now I am able to reproduce the clock backward on old xen version,
please let me know if I should re-use the v2 of this patch, as it has been
running well in our env well for very long time.
https://lore.kernel.org/all/20211028012543.8776-1-dongli.zhang@xxxxxxxxxx/
BTW, I have tested that 'soft_reset' does not work with mainline xen, even
when I directly trigger kexec with below commands.
# kexec -l /boot/vmlinuz-5.17.0-rc4xen-00054-gf71077a4d84b-dirty \
--initrd=/boot/initrd.img-5.17.0-rc4xen-00054-gf71077a4d84b-dirty \
--reuse-cmdline
# kexec -e
Thank you very much!
Dongli Zhang
|