[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/12] swiotlb-xen: ensure to issue well-formed XENMEM_exchange requests
- To: Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Tue, 7 Sep 2021 14:05:32 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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; bh=DxJykJMCxYkJPMtlwaWjGcuTROCQKWVJPc/aqT8Eh6U=; b=CtXfxloLrJf41/XtEmZDN/7JY/k3ELuF3QgwEngr7bj2W61JXzXipKAJSXG+YqhWSeHRnO9yVVaELJUZ2AdRYhve5uT/0U9cr8Tf/tA+fd/N+WrL1JdEHSfoXd4X0S/64YD1J3/sAVKBOIGVTkHhrdWj0jCzTsj4CiYkqIss/c2XxK9pS2fuxCofiQfaxhOvR97+PK7QVUjaNlskqLyhdZ/nLmRRpRSMuhUfpwzmxYO0EUHjjZpp8sLsbKg+Jpx5PZh9LlmIzrOVfnydcmeHHkp7iVhKQfBrWVKsVQSkiJ7dNNgSE1pnSySVFgIHFYjlyEp1mcgYn+VoP9LygBUMxA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cKFu6bKu5CqvQSsZeH90PTEjoTPDza5A2H7ptd3U9Ujy947lmUS7J7zarX/yebFT2r5weYEr8lIatS5LGhPg2zOjQwTIZQE8y8YaIGX1dZHIaM/J9joZTKEO9i3dNn/5nk+uzdaIKHEad0GzZmATYPIcpmBg+W2D4adXutXdMNq/2yh+YkWo/m9o0xiKBY00pVH27Oa4MoMze2m5zk9BPcqIwXpl8W40PSkqHrN4WxJcq7MvnjGB+Vl1BPJ6kf0uJwFAGoaUc5dxXC5vwYVnYteO7BLsG6Rk9Cf1XajP9ETMFT2jKq1qKZk9CLnVHuc+KYF2WQkqUsnjSr2agYETcA==
- Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, lkml <linux-kernel@xxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 07 Sep 2021 12:05:38 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
While the hypervisor hasn't been enforcing this, we would still better
avoid issuing requests with GFNs not aligned to the requested order.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
I wonder how useful it is to include the alignment in the panic()
message. I further wonder how useful it is to wrap "bytes" in
PAGE_ALIGN(), when it is a multiple of a segment's size anyway (or at
least was supposed to be, prior to "swiotlb-xen: maintain slab count
properly").
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -231,10 +231,10 @@ retry:
/*
* Get IO TLB memory from any location.
*/
- start = memblock_alloc(PAGE_ALIGN(bytes), PAGE_SIZE);
+ start = memblock_alloc(PAGE_ALIGN(bytes), IO_TLB_SEGSIZE <<
IO_TLB_SHIFT);
if (!start)
- panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
- __func__, PAGE_ALIGN(bytes), PAGE_SIZE);
+ panic("%s: Failed to allocate %lu bytes align=%#x\n",
+ __func__, PAGE_ALIGN(bytes), IO_TLB_SEGSIZE <<
IO_TLB_SHIFT);
/*
* And replace that memory with pages under 4GB.
|