linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dongli Zhang <dongli.zhang@oracle.com>
To: iommu@lists.linux-foundation.org, linux-doc@vger.kernel.org,
	x86@kernel.org
Cc: linux-kernel@vger.kernel.org, joe.jin@oracle.com,
	hch@infradead.org, m.szyprowski@samsung.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	corbet@lwn.net
Subject: [PATCH v1 4/4] swiotlb: panic if nslabs is too small
Date: Sat, 11 Jun 2022 01:25:14 -0700	[thread overview]
Message-ID: <20220611082514.37112-5-dongli.zhang@oracle.com> (raw)
In-Reply-To: <20220611082514.37112-1-dongli.zhang@oracle.com>

Panic on purpose if nslabs is too small, in order to sync with the remap
retry logic.

In addition, print the number of bytes for tlb alloc failure.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
 kernel/dma/swiotlb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index fd21f4162f4b..1758b724c7a8 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -242,6 +242,9 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
 	if (swiotlb_force_disable)
 		return;
 
+	if (nslabs < IO_TLB_MIN_SLABS)
+		panic("%s: nslabs = %lu too small\n", __func__, nslabs);
+
 	/*
 	 * By default allocate the bounce buffer memory from low memory, but
 	 * allow to pick a location everywhere for hypervisors with guest
@@ -254,7 +257,8 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
 	else
 		tlb = memblock_alloc_low(bytes, PAGE_SIZE);
 	if (!tlb) {
-		pr_warn("%s: failed to allocate tlb structure\n", __func__);
+		pr_warn("%s: Failed to allocate %zu bytes tlb structure\n",
+			__func__, bytes);
 		return;
 	}
 
-- 
2.17.1


  parent reply	other threads:[~2022-06-11  8:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-11  8:25 [PATCH v1 0/4] swiotlb: some cleanup Dongli Zhang
2022-06-11  8:25 ` [PATCH v1 1/4] swiotlb: remove unused swiotlb_force Dongli Zhang
2022-06-11  8:25 ` [PATCH v1 2/4] swiotlb: remove useless return Dongli Zhang
2022-06-11  8:25 ` [PATCH v1 3/4] x86/swiotlb: fix param usage in boot-options.rst Dongli Zhang
2022-06-11  8:25 ` Dongli Zhang [this message]
2022-06-13  6:49   ` [PATCH v1 4/4] swiotlb: panic if nslabs is too small Dongli Zhang
2022-08-20  1:20   ` Yu Zhao
2022-08-22  9:49     ` Robin Murphy
2022-08-22 11:26       ` Christoph Hellwig
2022-08-22 12:32         ` Robin Murphy
2022-08-22 22:27           ` Dongli Zhang
2022-08-22 23:10             ` Yu Zhao
2022-08-22 23:47               ` Dongli Zhang
2022-06-22 10:43 ` [PATCH v1 0/4] swiotlb: some cleanup Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220611082514.37112-5-dongli.zhang@oracle.com \
    --to=dongli.zhang@oracle.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joe.jin@oracle.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).