Skip to contentSkip to conversation

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

PATCH In review [email protected] 2 participants 2 messages Apr 20, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 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().

---
Change log v4:
1. Rebase to hyperv-next

Change log v3:
1. Rebase to linux-next

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 | 231 +++++++++++++++++++++++++++++++++++++++++
 drivers/hv/vmbus_drv.c | 199 -----------------------------------
 3 files changed, 231 insertions(+), 235 deletions(-)
drivers/hv/hv.c +0 -36
index 4e1407d59ba0..de6708dbe0df 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 +231 -0

269 lines not on this page · raw message

drivers/hv/vmbus_drv.c +0 -199

253 lines not on this page · raw message

Signature · 1 line
2.32.0
maintainer
#1 lore raw
Quoted 9 lines · On Thu, Apr 20, 2023 at 03:49:06PM -0700, [email protected] wrote:

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.

Quoted 6 lines

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().

Thanks. Queued up for hyperv-next.