From nobody Tue Dec 16 07:25:26 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FAAC34FB19; Tue, 6 May 2025 00:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746493011; cv=none; b=pvqETdVqjFkBXWW6TVYe0QqbFa6EQsKY+DamQS1XvPv/ez05U4DNniVDiDzvH4v89+K7hvfDfX80McJ1sWd3NJnqfwA5cF/2kF6L2vuQBLw3/2G0OQhpFPH94acu/59N3Ymb47z/rwFD3SjdduTcKyWcWQa3MLxma5Sgimpshd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746493011; c=relaxed/simple; bh=KXhn6Y28CWw7SHrD0L20soN5/9bptpnT4a0FcY/qBd4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=Uq842eRTzE47FatH8+EpL+9fFHtNPfdiwuQgXo0YEEC0tc7yXMCsV1wxooguZjPul/bxpDjTu0TiNqz2qCAwjoxv3J8PbCujjKBeKkmD4RHNMYtnUOIUv6vQxyUvXVNsypy/R7BsecrXNzsY2h3i0QWhYD2u3Ourg6zQu7V9Iz0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b=QzMDCDaS; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b="QzMDCDaS" Received: by linux.microsoft.com (Postfix, from userid 1202) id 53D592115DC2; Mon, 5 May 2025 17:56:44 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 53D592115DC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1746493004; bh=t61EzT3XMgXNN1USOK5BwI5jrOfGuZzmM3tXBa1w7Cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QzMDCDaS+do82auib7/8d/X+ARpIQnf2bRJjFyEVjoX34FJE5WAHAKFyeGfxkvtjT XyZKiunbVLtCJe697+riB264id8qBNJ+1oqOo1FZt5apXHEsNRcr4VUCarE5RzyVz3 5vskgQtf5Od5igujU/Javho4JFluwxnMSgnavbG4= From: longli@linuxonhyperv.com To: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Greg Kroah-Hartman , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Long Li , stable@vger.kernel.org Subject: [Patch v3 1/5] Drivers: hv: Allocate interrupt and monitor pages aligned to system page boundary Date: Mon, 5 May 2025 17:56:33 -0700 Message-Id: <1746492997-4599-2-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1746492997-4599-1-git-send-email-longli@linuxonhyperv.com> References: <1746492997-4599-1-git-send-email-longli@linuxonhyperv.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Long Li There are use cases that interrupt and monitor pages are mapped to user-mode through UIO, so they need to be system page aligned. Some Hyper-V allocation APIs introduced earlier broke those requirements. Fix this by using page allocation functions directly for interrupt and monitor pages. Cc: stable@vger.kernel.org Fixes: ca48739e59df ("Drivers: hv: vmbus: Move Hyper-V page allocator to ar= ch neutral code") Signed-off-by: Long Li --- drivers/hv/connection.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index 8351360bba16..be490c598785 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -206,11 +206,20 @@ int vmbus_connect(void) INIT_LIST_HEAD(&vmbus_connection.chn_list); mutex_init(&vmbus_connection.channel_mutex); =20 + /* + * The following Hyper-V interrupt and monitor pages can be used by + * UIO for mapping to user-space, so they should always be allocated on + * system page boundaries. The system page size must be >=3D the Hyper-V + * page size. + */ + BUILD_BUG_ON(PAGE_SIZE < HV_HYP_PAGE_SIZE); + /* * Setup the vmbus event connection for channel interrupt * abstraction stuff */ - vmbus_connection.int_page =3D hv_alloc_hyperv_zeroed_page(); + vmbus_connection.int_page =3D + (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO); if (vmbus_connection.int_page =3D=3D NULL) { ret =3D -ENOMEM; goto cleanup; @@ -225,8 +234,8 @@ int vmbus_connect(void) * Setup the monitor notification facility. The 1st page for * parent->child and the 2nd page for child->parent */ - vmbus_connection.monitor_pages[0] =3D hv_alloc_hyperv_page(); - vmbus_connection.monitor_pages[1] =3D hv_alloc_hyperv_page(); + vmbus_connection.monitor_pages[0] =3D (void *)__get_free_page(GFP_KERNEL); + vmbus_connection.monitor_pages[1] =3D (void *)__get_free_page(GFP_KERNEL); if ((vmbus_connection.monitor_pages[0] =3D=3D NULL) || (vmbus_connection.monitor_pages[1] =3D=3D NULL)) { ret =3D -ENOMEM; @@ -342,21 +351,23 @@ void vmbus_disconnect(void) destroy_workqueue(vmbus_connection.work_queue); =20 if (vmbus_connection.int_page) { - hv_free_hyperv_page(vmbus_connection.int_page); + free_page((unsigned long)vmbus_connection.int_page); vmbus_connection.int_page =3D NULL; } =20 if (vmbus_connection.monitor_pages[0]) { if (!set_memory_encrypted( (unsigned long)vmbus_connection.monitor_pages[0], 1)) - hv_free_hyperv_page(vmbus_connection.monitor_pages[0]); + free_page((unsigned long) + vmbus_connection.monitor_pages[0]); vmbus_connection.monitor_pages[0] =3D NULL; } =20 if (vmbus_connection.monitor_pages[1]) { if (!set_memory_encrypted( (unsigned long)vmbus_connection.monitor_pages[1], 1)) - hv_free_hyperv_page(vmbus_connection.monitor_pages[1]); + free_page((unsigned long) + vmbus_connection.monitor_pages[1]); vmbus_connection.monitor_pages[1] =3D NULL; } } --=20 2.34.1 From nobody Tue Dec 16 07:25:26 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 41EFB350141; Tue, 6 May 2025 00:56:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746493013; cv=none; b=jPAHdoaZ1SSPTTcVlFDopu1W+Hf4p89pV6zuuCdwEsSQgqhexWqugmNk1hwU3SeaPOmGYKdr6eY6njF9ujjwpg5Cc/23luwno/6n7RfDKQ1IKhGDI3KExgbaLAmjp7ojEA8Px1LnAKF6Tz7+O9BbQ1Z4WTKRrlPq2oE45d9p/WI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746493013; c=relaxed/simple; bh=+OL/J5iI/IZyyfqUWRcvylHqsCK6N6ObqpoSB+oKM4E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=Cz80qbYvBuHdJy1GeU/RhPD9FnY5YKl55Vr3sg8BTWdNEFsu4fJrCFrcCZsgNifs9Taw6XN0jrz/sbn6QECiTiXT/Z1VahQTTZmeR1Y2MRZ0ft9adZhH03DWgj2maG+LeX+v+6wyPe30lE9KzDvGIdPzCXOUgMRZQLjft/i8jM0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b=lw2pwBbH; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b="lw2pwBbH" Received: by linux.microsoft.com (Postfix, from userid 1202) id 353F92115DC4; Mon, 5 May 2025 17:56:45 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 353F92115DC4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1746493005; bh=vVyQcEwBGYmE+cSxfvdI6O2L9frTYHcEH9sNNAqwQo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lw2pwBbHJJrOMBab+V6kJdq1VXiU1MdVm02B7AlSpf25KM6iIR5xIGUnc0mOq4n1a fNIRdG7m/BWPxcnginVQTn/e3wRO/Evjsb24FDCajFTmQ9SNQLcXd0BVd/DQCnRFsS WsjCCb82tXZoclPGKFXd0hAwJh592n5UD6Dx878g= From: longli@linuxonhyperv.com To: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Greg Kroah-Hartman , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Long Li , stable@vger.kernel.org Subject: [Patch v3 2/5] uio_hv_generic: Use correct size for interrupt and monitor pages Date: Mon, 5 May 2025 17:56:34 -0700 Message-Id: <1746492997-4599-3-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1746492997-4599-1-git-send-email-longli@linuxonhyperv.com> References: <1746492997-4599-1-git-send-email-longli@linuxonhyperv.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Long Li Interrupt and monitor pages should be in Hyper-V page size (4k bytes). This can be different from the system page size. This size is read and used by the user-mode program to determine the mapped data region. An example of such user-mode program is the VMBus driver in DPDK. Cc: stable@vger.kernel.org Fixes: 95096f2fbd10 ("uio-hv-generic: new userspace i/o driver for VMBus") Signed-off-by: Long Li --- drivers/uio/uio_hv_generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index 1b19b5647495..08385b04c4ab 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -287,13 +287,13 @@ hv_uio_probe(struct hv_device *dev, pdata->info.mem[INT_PAGE_MAP].name =3D "int_page"; pdata->info.mem[INT_PAGE_MAP].addr =3D (uintptr_t)vmbus_connection.int_page; - pdata->info.mem[INT_PAGE_MAP].size =3D PAGE_SIZE; + pdata->info.mem[INT_PAGE_MAP].size =3D HV_HYP_PAGE_SIZE; pdata->info.mem[INT_PAGE_MAP].memtype =3D UIO_MEM_LOGICAL; =20 pdata->info.mem[MON_PAGE_MAP].name =3D "monitor_page"; pdata->info.mem[MON_PAGE_MAP].addr =3D (uintptr_t)vmbus_connection.monitor_pages[1]; - pdata->info.mem[MON_PAGE_MAP].size =3D PAGE_SIZE; + pdata->info.mem[MON_PAGE_MAP].size =3D HV_HYP_PAGE_SIZE; pdata->info.mem[MON_PAGE_MAP].memtype =3D UIO_MEM_LOGICAL; =20 if (channel->device_id =3D=3D HV_NIC) { --=20 2.34.1 From nobody Tue Dec 16 07:25:26 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34CAC34FB1A; Tue, 6 May 2025 00:56:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746493009; cv=none; b=kVNKQbumyKm6a10woWlsx2j2GrC3B3fvBckNxArKsEWO75LGUbJVaNlocb4dvae0pMG2eKrqNGliKXCO017mDNBH+7/YJI8Vs0pFgV6T5p8KHVmPcwhJPiVcfZ6Z6hvlPmmdhkM5a6H9DHALG6khcPlJzjpbcUtC2kS5E1wwCHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746493009; c=relaxed/simple; bh=+1GkP85qI28LngPRsSnKVGf3zYfY0BfHkC9fcaE0ldc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=UFnXRMzbN3iRTzq1Y8kNGNv2zR1w8ta3UBT3sfiaRjLugkm1YnOl256OrA3a1TdbOXY6mJcrqwxKtNcOTuXeZ84dg4CmE3jZMZZMYdUJXpTk5NGa0FSyRAVxedpDepmx4/fUmLyNIY1P+6d00vT9AfhBuV1R+I9l1NbnpOQpozk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b=XBd81uXB; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b="XBd81uXB" Received: by linux.microsoft.com (Postfix, from userid 1202) id DA8CD2115DC6; Mon, 5 May 2025 17:56:46 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DA8CD2115DC6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1746493006; bh=U5Gq4AetPfFX7oMakCEVyoFLthNpyCTSJ5kkn3ju7TI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XBd81uXBcvQA/vmrNcbJMawuyF5dVb/mBt4m2oltAllu9BBKfmbbjVypBX0HwSM8+ CXFwkmWZptHknHXVP7DzJvC/3GCE7BAbLjX1k153X/HE6qjf1CwVqQHLci2fJZw2xx OAfvhCuYDAb1mS8REeqKNDFxRHGIKDT9RzwJODcY= From: longli@linuxonhyperv.com To: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Greg Kroah-Hartman , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Long Li , stable@vger.kernel.org Subject: [Patch v3 3/5] uio_hv_generic: Align ring size to system page Date: Mon, 5 May 2025 17:56:35 -0700 Message-Id: <1746492997-4599-4-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1746492997-4599-1-git-send-email-longli@linuxonhyperv.com> References: <1746492997-4599-1-git-send-email-longli@linuxonhyperv.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Long Li Following the ring header, the ring data should align to system page boundary. Adjust the size if necessary. Cc: stable@vger.kernel.org Fixes: 95096f2fbd10 ("uio-hv-generic: new userspace i/o driver for VMBus") Signed-off-by: Long Li --- drivers/uio/uio_hv_generic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index 08385b04c4ab..cb2e7e0e1540 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -256,6 +256,9 @@ hv_uio_probe(struct hv_device *dev, if (!ring_size) ring_size =3D SZ_2M; =20 + /* Adjust ring size if necessary to have it page aligned */ + ring_size =3D VMBUS_RING_SIZE(ring_size); + pdata =3D devm_kzalloc(&dev->device, sizeof(*pdata), GFP_KERNEL); if (!pdata) return -ENOMEM; --=20 2.34.1 From nobody Tue Dec 16 07:25:26 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53370297A7A; Tue, 6 May 2025 00:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746493009; cv=none; b=lSy3psvvPEBg99KIrSpC4IckV7SewaMnI15q9KY6Laf9OMynrhiIA/QTLpyykoeatYwT0hTLa25hhrKMCpKSpGXuDSnKPzJ54fzLrAut4Kx5ucCk7ILJDuYengGSYidYqNOWQM8txxTceUHXrkHkLiWb/B/5X0jSnTUamVeqQ/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746493009; c=relaxed/simple; bh=wrgaENVci0P+r4viKopRMHVU9QIEi4adrnMipn6O+sU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=cvb25TLFMAJP9/KLSPNXbrpfAgkfEfugNYaNIQF4CHAkBTdB8VcBP5zm1gZg88pWTxT7mvBi+esOKl4qNgQHz+hAs9DqEbEBa0E+HnZ1V4VVe0CyrmuqvHxmRejBxxpqH55+u4+M6r6ylMOQYI9FpfaJ1Z+H/uQ5Flofuj5Stcg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b=o3s59huh; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b="o3s59huh" Received: by linux.microsoft.com (Postfix, from userid 1202) id 044D3204E7F7; Mon, 5 May 2025 17:56:48 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 044D3204E7F7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1746493008; bh=8jbp63pflYYMxnViW5Z1+xVgB+8SXsI21hIdEexRN78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o3s59huhmwiOwbGcGSxJkJ3L3wW6IEAmRnuOOKBiFcWgW3yuESzfYFfEfoX5YOpqt jbn8uvkof160BuFuu36iBc8+y1T+3U6fexz0vJ8SAGpStizXSOTxFK7vKEMKJlrOID 7pTJoLr8mIfHd42ti6eec1oD4pA8ncFbCmaiHSzo= From: longli@linuxonhyperv.com To: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Greg Kroah-Hartman , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Long Li Subject: [Patch v3 4/5] Drivers: hv: Use kzalloc for panic page allocation Date: Mon, 5 May 2025 17:56:36 -0700 Message-Id: <1746492997-4599-5-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1746492997-4599-1-git-send-email-longli@linuxonhyperv.com> References: <1746492997-4599-1-git-send-email-longli@linuxonhyperv.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Long Li To prepare for removal of hv_alloc_* and hv_free* functions, use kzalloc/kfree directly for panic reporting page. Signed-off-by: Long Li --- drivers/hv/hv_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index a7d7494feaca..a5a6250b1a12 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -272,7 +272,7 @@ static void hv_kmsg_dump_unregister(void) atomic_notifier_chain_unregister(&panic_notifier_list, &hyperv_panic_report_block); =20 - hv_free_hyperv_page(hv_panic_page); + kfree(hv_panic_page); hv_panic_page =3D NULL; } =20 @@ -280,7 +280,7 @@ static void hv_kmsg_dump_register(void) { int ret; =20 - hv_panic_page =3D hv_alloc_hyperv_zeroed_page(); + hv_panic_page =3D kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL); if (!hv_panic_page) { pr_err("Hyper-V: panic message page memory allocation failed\n"); return; @@ -289,7 +289,7 @@ static void hv_kmsg_dump_register(void) ret =3D kmsg_dump_register(&hv_kmsg_dumper); if (ret) { pr_err("Hyper-V: kmsg dump register error 0x%x\n", ret); - hv_free_hyperv_page(hv_panic_page); + kfree(hv_panic_page); hv_panic_page =3D NULL; } } --=20 2.34.1 From nobody Tue Dec 16 07:25:26 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 251CC34FAFD; Tue, 6 May 2025 00:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746493010; cv=none; b=YQzJM7PcGnNTQKOHLS3cndDVyQGoqGHRBKj0oSpWuExCCA1fwKDq3ck54YvONUGEjvZxY6a3t8dj/nXdJpZMUqHh7W70AhutkMVAV41DraLKUCsSDe4WcIsOWD2KTDBK2R4KrcwQmnR2dw68yQpwgtd++Qja8vDdTSrEMX+hfyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746493010; c=relaxed/simple; bh=JruDkI3GXfZf4tHR86VsgRMY60DqpXC3BKMs+rXCqF8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=f4qQM50VV4kQoTAuvedr25cYtR7yVd8PqUJxxqOLLC7Ms/2ctfR/BLwoCQnNnwHkV2beIzPbk1vjgUnFoQ/Drc7MHTQFFmqmx2gdVto3C7xc8AoXtZ3CUnye0mVfjz2+RsK+EI+ku1mCpQ0eBe9WItwso0sTG4053csUOHc5jwA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b=LAHLp1/z; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b="LAHLp1/z" Received: by linux.microsoft.com (Postfix, from userid 1202) id EE4FB2115DC7; Mon, 5 May 2025 17:56:48 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EE4FB2115DC7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1746493008; bh=trr1tx7SJkPMB80H3ADWZz7ZMck5EyVgqKue45Oc6PI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LAHLp1/zxAngy3CbIhfsUJrm3vw2IhYMUe8iWEySu3BHdBoXx+Uxn0BwCDD8tEzL2 LQIWHuOBUX7TsVp3xY42AsuI09/j3AAvb7vy7yEW6ZLKDn064BJdma2uk0elZTfTSV /FXoqyunXy57V3R9KuZSBxqtGjEHSPncsVh83NJI= From: longli@linuxonhyperv.com To: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Greg Kroah-Hartman , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Long Li Subject: [Patch v3 5/5] Drivers: hv: Remove hv_alloc/free_* helpers Date: Mon, 5 May 2025 17:56:37 -0700 Message-Id: <1746492997-4599-6-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1746492997-4599-1-git-send-email-longli@linuxonhyperv.com> References: <1746492997-4599-1-git-send-email-longli@linuxonhyperv.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Long Li There are no users for those functions, remove them. Signed-off-by: Long Li --- drivers/hv/hv_common.c | 39 ---------------------------------- include/asm-generic/mshyperv.h | 4 ---- 2 files changed, 43 deletions(-) diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index a5a6250b1a12..421376cea17e 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -105,45 +105,6 @@ void __init hv_common_free(void) hv_synic_eventring_tail =3D NULL; } =20 -/* - * 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 =3D=3D HV_HYP_PAGE_SIZE) - return (void *)__get_free_page(GFP_KERNEL); - else - return kmalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL); -} -EXPORT_SYMBOL_GPL(hv_alloc_hyperv_page); - -void *hv_alloc_hyperv_zeroed_page(void) -{ - if (PAGE_SIZE =3D=3D HV_HYP_PAGE_SIZE) - return (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO); - else - return kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL); -} -EXPORT_SYMBOL_GPL(hv_alloc_hyperv_zeroed_page); - -void hv_free_hyperv_page(void *addr) -{ - if (PAGE_SIZE =3D=3D HV_HYP_PAGE_SIZE) - free_page((unsigned long)addr); - else - kfree(addr); -} -EXPORT_SYMBOL_GPL(hv_free_hyperv_page); - static void *hv_panic_page; =20 /* diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index ccccb1cbf7df..4033508fbb11 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -236,10 +236,6 @@ int hv_common_cpu_init(unsigned int cpu); int hv_common_cpu_die(unsigned int cpu); void hv_identify_partition_type(void); =20 -void *hv_alloc_hyperv_page(void); -void *hv_alloc_hyperv_zeroed_page(void); -void hv_free_hyperv_page(void *addr); - /** * hv_cpu_number_to_vp_number() - Map CPU to VP. * @cpu_number: CPU number in Linux terms --=20 2.34.1