Linux IOMMU Development
 help / color / mirror / Atom feed
From: "Conor.Dooley--- via iommu" <iommu@lists.linux-foundation.org>
To: <hch@lst.de>, <iommu@lists.linux-foundation.org>
Cc: xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com,
	sstabellini@kernel.org
Subject: Re: [PATCH 1/3] swiotlb: don't panic when the swiotlb buffer can't be allocated
Date: Fri, 13 May 2022 07:47:01 +0000	[thread overview]
Message-ID: <9ca9706e-7781-12a1-c4c7-ce3d27902ce2@microchip.com> (raw)
In-Reply-To: <20220511125805.1377025-2-hch@lst.de>

On 11/05/2022 13:58, Christoph Hellwig wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> For historical reasons the switlb code paniced when the metadata could
> not be allocated, but just printed a warning when the actual main
> swiotlb buffer could not be allocated.  Restore this somewhat unexpected
> behavior as changing it caused a boot failure on the Microchip RISC-V
> PolarFire SoC Icicle kit.
> 
> Fixes: 6424e31b1c05 ("swiotlb: remove swiotlb_init_with_tbl and swiotlb_init_late_with_tbl")
> Reported-by: Conor Dooley <Conor.Dooley@microchip.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Tested-by: Conor Dooley <Conor.Dooley@microchip.com>

FWIW:
Acked-by: Conor Dooley <conor.dooley@microchip.com>

> ---
>   kernel/dma/swiotlb.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index e2ef0864eb1e5..3e992a308c8a1 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -254,8 +254,10 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
>                  tlb = memblock_alloc(bytes, PAGE_SIZE);
>          else
>                  tlb = memblock_alloc_low(bytes, PAGE_SIZE);
> -       if (!tlb)
> -               panic("%s: failed to allocate tlb structure\n", __func__);
> +       if (!tlb) {
> +               pr_warn("%s: failed to allocate tlb structure\n", __func__);
> +               return;
> +       }
> 
>          if (remap && remap(tlb, nslabs) < 0) {
>                  memblock_free(tlb, PAGE_ALIGN(bytes));
> --
> 2.30.2
> 

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2022-05-13 12:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11 12:58 swiotlb regression fixe Christoph Hellwig
2022-05-11 12:58 ` [PATCH 1/3] swiotlb: don't panic when the swiotlb buffer can't be allocated Christoph Hellwig
2022-05-13  1:31   ` Stefano Stabellini
2022-05-13  7:47   ` Conor.Dooley--- via iommu [this message]
2022-05-11 12:58 ` [PATCH 2/3] swiotlb: use the right nslabs value in swiotlb_init_remap Christoph Hellwig
2022-05-13  1:39   ` Stefano Stabellini
2022-05-11 12:58 ` [PATCH 3/3] swiotlb: use the right nslabs-derived sizes in swiotlb_init_late Christoph Hellwig
2022-05-13  1:44   ` Stefano Stabellini

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=9ca9706e-7781-12a1-c4c7-ce3d27902ce2@microchip.com \
    --to=iommu@lists.linux-foundation.org \
    --cc=Conor.Dooley@microchip.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=hch@lst.de \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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