mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Petr Tesařík" <petr@tesarici.cz>
To: Michael Kelley <mikelley@microsoft.com>
Cc: hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com,
	decui@microsoft.com, tiala@microsoft.com,
	petr.tesarik.ext@huawei.com, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] swiotlb: Fix debugfs reporting of reserved memory pools
Date: Thu, 13 Apr 2023 20:52:44 +0200	[thread overview]
Message-ID: <20230413205244.70dcbdeb@meshulam.tesarici.cz> (raw)
In-Reply-To: <1681400250-2032-1-git-send-email-mikelley@microsoft.com>

On Thu, 13 Apr 2023 08:37:30 -0700
Michael Kelley <mikelley@microsoft.com> wrote:

> For io_tlb_nslabs, the debugfs code reports the correct value for a
> specific reserved memory pool.  But for io_tlb_used, the value reported
> is always for the default pool, not the specific reserved pool. Fix this.
> 
> Fixes: 5c850d31880e ("swiotlb: fix passing local variable to debugfs_create_ulong()")
> Signed-off-by: Michael Kelley <mikelley@microsoft.com>
> ---
> 
> I don't have a way to test this directly with OF reserved memory, but I
> cobbled together a hack to call rmem_swiotlb_device_init() multiple times
> for different size reserved pools. I verified that reserved pool debugfs entries
> are created as expected and that the value of io_tlb_used is *not* the value
> from the default pool.

Yeah, the only in-tree user is Mediatek Asurada, and I don't have one
either...

The patch looks good to me. But you know, I'm now well-known for
breaking things because of insufficient testing. ;-)

Petr T

>  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 dac42a2..db43de82 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -930,7 +930,9 @@ bool is_swiotlb_active(struct device *dev)
>  
>  static int io_tlb_used_get(void *data, u64 *val)
>  {
> -	*val = mem_used(&io_tlb_default_mem);
> +	struct io_tlb_mem *mem = data;
> +
> +	*val = mem_used(mem);
>  	return 0;
>  }
>  DEFINE_DEBUGFS_ATTRIBUTE(fops_io_tlb_used, io_tlb_used_get, NULL,
> "%llu\n"); @@ -943,7 +945,7 @@ static void
> swiotlb_create_debugfs_files(struct io_tlb_mem *mem, return;
>  
>  	debugfs_create_ulong("io_tlb_nslabs", 0400, mem->debugfs,
> &mem->nslabs);
> -	debugfs_create_file("io_tlb_used", 0400, mem->debugfs, NULL,
> +	debugfs_create_file("io_tlb_used", 0400, mem->debugfs, mem,
>  			&fops_io_tlb_used);
>  }
>  


  reply	other threads:[~2023-04-13 18:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 15:37 Michael Kelley
2023-04-13 18:52 ` Petr Tesařík [this message]
2023-04-16  6:26 ` 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=20230413205244.70dcbdeb@meshulam.tesarici.cz \
    --to=petr@tesarici.cz \
    --cc=decui@microsoft.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mikelley@microsoft.com \
    --cc=petr.tesarik.ext@huawei.com \
    --cc=robin.murphy@arm.com \
    --cc=tiala@microsoft.com \
    /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

all inboxes | Powered by JetHome®