Skip to contentSkip to conversation

Drivers: hv: move panic report code from vmbus to hv early init code

PATCH Applied [email protected] 4 participants 5 messages Apr 14, 2023 – Apr 19, 2023

Subsystems (3)

v2 of 4 Applied Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Drivers: hv: move panic report code from vmbus to hv early init code

From: Long Li <[email protected]>

The panic reporting code was added in commit 81b18bce48af ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic")

It was added to the vmbus driver. The panic reporting has no dependence on vmbus, and can be enabled at an earlier boot time when Hyper-V is initialized.

This patch moves the panic reporting code out of vmbus. There is no functionality changes. During moving, also refactored some cleanup functions into hv_kmsg_dump_unregister(), and removed unused function hv_alloc_hyperv_page().

---

Change log v2:
1. Check on hv_is_isolation_supported() before reporting crash dump
2. Remove hyperv_report_reg(), inline the check condition instead
3. Remove the test NULL on hv_panic_page when freeing it

 drivers/hv/hv.c                |  36 ------
 drivers/hv/hv_common.c         | 229 +++++++++++++++++++++++++++++++++
 drivers/hv/vmbus_drv.c         | 199 ----------------------------
 include/asm-generic/mshyperv.h |   1 -
 4 files changed, 229 insertions(+), 236 deletions(-)
drivers/hv/hv.c +0 -36
index 8b0dd8e5244d..88eca08c7030 100644
@@ -38,42 +38,6 @@ int hv_init(void)
 	return 0;
 }
 
-/*
- * Functions for allocating and freeing memory with size and
- * alignment HV_HYP_PAGE_SIZE. These functions are needed because
- * the guest page size may not be the same as the Hyper-V page
- * size. We depend upon kmalloc() aligning power-of-two size
- * allocations to the allocation size boundary, so that the
- * allocated memory appears to Hyper-V as a page of the size
- * it expects.
- */
-
-void *hv_alloc_hyperv_page(void)
-{
-	BUILD_BUG_ON(PAGE_SIZE <  HV_HYP_PAGE_SIZE);
-
-	if (PAGE_SIZE == HV_HYP_PAGE_SIZE)
-		return (void *)__get_free_page(GFP_KERNEL);
-	else
-		return kmalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL);
-}
-
-void *hv_alloc_hyperv_zeroed_page(void)
-{
-	if (PAGE_SIZE == HV_HYP_PAGE_SIZE)
-		return (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
-	else
-		return kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL);
-}
-
-void hv_free_hyperv_page(unsigned long addr)
-{
-	if (PAGE_SIZE == HV_HYP_PAGE_SIZE)
-		free_page(addr);
-	else
-		kfree((void *)addr);
-}
-
 /*
  * hv_post_message - Post a message using the hypervisor message IPC.
  *
drivers/hv/hv_common.c +229 -0

267 lines not on this page · raw message

drivers/hv/vmbus_drv.c +0 -199

253 lines not on this page · raw message

include/asm-generic/mshyperv.h +0 -1
index 8845a2eca339..df0dbccd719a 100644
@@ -186,7 +186,6 @@ void __init hv_common_free(void);
 int hv_common_cpu_init(unsigned int cpu);
 int hv_common_cpu_die(unsigned int cpu);
 
-void *hv_alloc_hyperv_page(void);
 void *hv_alloc_hyperv_zeroed_page(void);
 void hv_free_hyperv_page(unsigned long addr);
 
Signature · 1 line
2.32.0
Reviewed-by on v2 1/1
#1 lore raw

From: [email protected] <[email protected]> Sent: Thursday, April 13, 2023 6:27 PM

Quoted 21 lines

The panic reporting code was added in commit 81b18bce48af ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic")

It was added to the vmbus driver. The panic reporting has no dependence on vmbus, and can be enabled at an earlier boot time when Hyper-V is initialized.

This patch moves the panic reporting code out of vmbus. There is no functionality changes. During moving, also refactored some cleanup functions into hv_kmsg_dump_unregister(), and removed unused function hv_alloc_hyperv_page().

---

Change log v2:
1. Check on hv_is_isolation_supported() before reporting crash dump
2. Remove hyperv_report_reg(), inline the check condition instead
3. Remove the test NULL on hv_panic_page when freeing it

Quoted 5 lines
 drivers/hv/hv.c                |  36 ------
 drivers/hv/hv_common.c         | 229 +++++++++++++++++++++++++++++++++
 drivers/hv/vmbus_drv.c         | 199 ----------------------------
 include/asm-generic/mshyperv.h |   1 -
 4 files changed, 229 insertions(+), 236 deletions(-)
maintainer Applied
#2 lore raw
Quoted 22 lines · Michael Kelley (LINUX)

From: [email protected] <[email protected]> Sent: Thursday, April 13, 2023 6:27 PM

Quoted 21 lines

The panic reporting code was added in commit 81b18bce48af ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic")

It was added to the vmbus driver. The panic reporting has no dependence on vmbus, and can be enabled at an earlier boot time when Hyper-V is initialized.

This patch moves the panic reporting code out of vmbus. There is no functionality changes. During moving, also refactored some cleanup functions into hv_kmsg_dump_unregister(), and removed unused function hv_alloc_hyperv_page().

---

Change log v2:
1. Check on hv_is_isolation_supported() before reporting crash dump
2. Remove hyperv_report_reg(), inline the check condition instead
3. Remove the test NULL on hv_panic_page when freeing it

Quoted 7 lines
Quoted 5 lines
 drivers/hv/hv.c                |  36 ------
 drivers/hv/hv_common.c         | 229 +++++++++++++++++++++++++++++++++
 drivers/hv/vmbus_drv.c         | 199 ----------------------------
 include/asm-generic/mshyperv.h |   1 -
 4 files changed, 229 insertions(+), 236 deletions(-)

Applied to hyperv-next. Thanks.

maintainer
#3 lore raw
Quoted 29 lines · Wei Liu
Quoted 28 lines · Michael Kelley (LINUX)

From: [email protected] <[email protected]> Sent: Thursday, April 13, 2023 6:27 PM

Quoted 26 lines

The panic reporting code was added in commit 81b18bce48af ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic")

It was added to the vmbus driver. The panic reporting has no dependence on vmbus, and can be enabled at an earlier boot time when Hyper-V is initialized.

This patch moves the panic reporting code out of vmbus. There is no functionality changes. During moving, also refactored some cleanup functions into hv_kmsg_dump_unregister(), and removed unused function hv_alloc_hyperv_page().

---

Change log v2:
1. Check on hv_is_isolation_supported() before reporting crash dump
2. Remove hyperv_report_reg(), inline the check condition instead
3. Remove the test NULL on hv_panic_page when freeing it

 drivers/hv/hv.c                |  36 ------
 drivers/hv/hv_common.c         | 229 +++++++++++++++++++++++++++++++++
 drivers/hv/vmbus_drv.c         | 199 ----------------------------
 include/asm-generic/mshyperv.h |   1 -
 4 files changed, 229 insertions(+), 236 deletions(-)
Quoted 3 lines
Quoted 1 line

Applied to hyperv-next. Thanks.

This broke allmodconfig. I've removed it from the tree. Please fix and resend.

Thanks,
Wei.

#4 lore raw
Quoted 36 lines

Subject: Re: [PATCH v2] Drivers: hv: move panic report code from vmbus to hv early init code

Quoted 20 lines · Wei Liu
Quoted 19 lines · Michael Kelley (LINUX)

From: [email protected] <[email protected]> Sent:
Thursday, April 13, 2023 6:27 PM

Quoted 17 lines

The panic reporting code was added in commit 81b18bce48af ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic")

It was added to the vmbus driver. The panic reporting has no dependence on vmbus, and can be enabled at an earlier boot time when Hyper-V is initialized.

This patch moves the panic reporting code out of vmbus. There is no functionality changes. During moving, also refactored some cleanup functions into hv_kmsg_dump_unregister(), and removed unused function hv_alloc_hyperv_page().

---

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Change log v2:
1. Check on hv_is_isolation_supported() before reporting crash dump 2. Remove hyperv_report_reg(), inline the check condition instead 3. Remove the test NULL on hv_panic_page when freeing it

 drivers/hv/hv.c                |  36 ------
 drivers/hv/hv_common.c         | 229

+++++++++++++++++++++++++++++++++

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
 drivers/hv/vmbus_drv.c         | 199 ----------------------------
 include/asm-generic/mshyperv.h |   1 -
 4 files changed, 229 insertions(+), 236 deletions(-)
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Applied to hyperv-next. Thanks.

This broke allmodconfig. I've removed it from the tree. Please fix and resend.

Thanks,
Wei.

I'm rebasing the patch to latest hyper-v branch, and send v3.

Thanks,
Long