From: Konrad Rzeszutek Wilk <konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Subject: Re: [PATCH] swiotlb: Clean up reporting
Date: Wed, 11 Jul 2018 15:16:11 -0400 [thread overview]
Message-ID: <20180711191610.GC29513@char.US.ORACLE.com> (raw)
In-Reply-To: <20180710232222.GA32002@beast>
On Tue, Jul 10, 2018 at 04:22:22PM -0700, Kees Cook wrote:
> This removes needless use of '%p', and refactors the printk calls to
> use pr_*() helpers instead.
>
> Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Christoph, volunteered to pick this patch up in his tree. Thank you!
> ---
> kernel/dma/swiotlb.c | 18 ++++++++----------
> 1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 904541055792..4f8a6dbf0b60 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -17,6 +17,8 @@
> * 08/12/11 beckyb Add highmem support
> */
>
> +#define pr_fmt(fmt) "software IO TLB: " fmt
> +
> #include <linux/cache.h>
> #include <linux/dma-direct.h>
> #include <linux/mm.h>
> @@ -162,20 +164,16 @@ static bool no_iotlb_memory;
> void swiotlb_print_info(void)
> {
> unsigned long bytes = io_tlb_nslabs << IO_TLB_SHIFT;
> - unsigned char *vstart, *vend;
>
> if (no_iotlb_memory) {
> - pr_warn("software IO TLB: No low mem\n");
> + pr_warn("No low mem\n");
> return;
> }
>
> - vstart = phys_to_virt(io_tlb_start);
> - vend = phys_to_virt(io_tlb_end);
> -
> - printk(KERN_INFO "software IO TLB [mem %#010llx-%#010llx] (%luMB) mapped at [%p-%p]\n",
> + pr_info("mapped [mem %#010llx-%#010llx] (%luMB)\n",
> (unsigned long long)io_tlb_start,
> (unsigned long long)io_tlb_end,
> - bytes >> 20, vstart, vend - 1);
> + bytes >> 20);
> }
>
> /*
> @@ -275,7 +273,7 @@ swiotlb_init(int verbose)
> if (io_tlb_start)
> memblock_free_early(io_tlb_start,
> PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
> - pr_warn("Cannot allocate SWIOTLB buffer");
> + pr_warn("Cannot allocate buffer");
> no_iotlb_memory = true;
> }
>
> @@ -317,8 +315,8 @@ swiotlb_late_init_with_default_size(size_t default_size)
> return -ENOMEM;
> }
> if (order != get_order(bytes)) {
> - printk(KERN_WARNING "Warning: only able to allocate %ld MB "
> - "for software IO TLB\n", (PAGE_SIZE << order) >> 20);
> + pr_warn("only able to allocate %ld MB\n",
> + (PAGE_SIZE << order) >> 20);
> io_tlb_nslabs = SLABS_PER_PAGE << order;
> }
> rc = swiotlb_late_init_with_tbl(vstart, io_tlb_nslabs);
> --
> 2.17.1
>
>
> --
> Kees Cook
> Pixel Security
WARNING: multiple messages have this Message-ID (diff)
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>,
iommu@lists.linux-foundation.org
Subject: Re: [PATCH] swiotlb: Clean up reporting
Date: Wed, 11 Jul 2018 15:16:11 -0400 [thread overview]
Message-ID: <20180711191610.GC29513@char.US.ORACLE.com> (raw)
In-Reply-To: <20180710232222.GA32002@beast>
On Tue, Jul 10, 2018 at 04:22:22PM -0700, Kees Cook wrote:
> This removes needless use of '%p', and refactors the printk calls to
> use pr_*() helpers instead.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Christoph, volunteered to pick this patch up in his tree. Thank you!
> ---
> kernel/dma/swiotlb.c | 18 ++++++++----------
> 1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 904541055792..4f8a6dbf0b60 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -17,6 +17,8 @@
> * 08/12/11 beckyb Add highmem support
> */
>
> +#define pr_fmt(fmt) "software IO TLB: " fmt
> +
> #include <linux/cache.h>
> #include <linux/dma-direct.h>
> #include <linux/mm.h>
> @@ -162,20 +164,16 @@ static bool no_iotlb_memory;
> void swiotlb_print_info(void)
> {
> unsigned long bytes = io_tlb_nslabs << IO_TLB_SHIFT;
> - unsigned char *vstart, *vend;
>
> if (no_iotlb_memory) {
> - pr_warn("software IO TLB: No low mem\n");
> + pr_warn("No low mem\n");
> return;
> }
>
> - vstart = phys_to_virt(io_tlb_start);
> - vend = phys_to_virt(io_tlb_end);
> -
> - printk(KERN_INFO "software IO TLB [mem %#010llx-%#010llx] (%luMB) mapped at [%p-%p]\n",
> + pr_info("mapped [mem %#010llx-%#010llx] (%luMB)\n",
> (unsigned long long)io_tlb_start,
> (unsigned long long)io_tlb_end,
> - bytes >> 20, vstart, vend - 1);
> + bytes >> 20);
> }
>
> /*
> @@ -275,7 +273,7 @@ swiotlb_init(int verbose)
> if (io_tlb_start)
> memblock_free_early(io_tlb_start,
> PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
> - pr_warn("Cannot allocate SWIOTLB buffer");
> + pr_warn("Cannot allocate buffer");
> no_iotlb_memory = true;
> }
>
> @@ -317,8 +315,8 @@ swiotlb_late_init_with_default_size(size_t default_size)
> return -ENOMEM;
> }
> if (order != get_order(bytes)) {
> - printk(KERN_WARNING "Warning: only able to allocate %ld MB "
> - "for software IO TLB\n", (PAGE_SIZE << order) >> 20);
> + pr_warn("only able to allocate %ld MB\n",
> + (PAGE_SIZE << order) >> 20);
> io_tlb_nslabs = SLABS_PER_PAGE << order;
> }
> rc = swiotlb_late_init_with_tbl(vstart, io_tlb_nslabs);
> --
> 2.17.1
>
>
> --
> Kees Cook
> Pixel Security
next prev parent reply other threads:[~2018-07-11 19:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-10 23:22 [PATCH] swiotlb: Clean up reporting Kees Cook
2018-07-10 23:22 ` Kees Cook
2018-07-11 19:16 ` Konrad Rzeszutek Wilk [this message]
2018-07-11 19:16 ` Konrad Rzeszutek Wilk
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=20180711191610.GC29513@char.US.ORACLE.com \
--to=konrad.wilk-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
--cc=hch-jcswGhMUV9g@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.