From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: Miles Chen <miles.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Cc: wsd_upstream-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Subject: Re: [PATCH v3] dma-debug: fix incorrect pfn calculation
Date: Tue, 3 Oct 2017 09:07:52 +0200 [thread overview]
Message-ID: <20171003070752.GA18928@lst.de> (raw)
In-Reply-To: <1506940241.28397.36.camel@mtkswgap22>
On Mon, Oct 02, 2017 at 06:30:41PM +0800, Miles Chen wrote:
> ARCHs like metag and xtensa define their mappings (non-vmalloc and
> non-linear) for dma allocation.
metag basically is a reimplementation of the vmalloc map mechanism
that should be easy to consolidate into the common one :( xtensa
has a weird remapping into a different segment, something that I
vaguely remember mips used to support as well.
> These mapping types are architecture-dependent and should not be used
> outside arch folders. So it is hard to check the mappings and convert
> a virtual address to a correct pfn in lib/dam-debug.c
>
> How about recording only vmalloc (by is_vmalloc_addr()) and linear
> address (by virt_addr_valid()) in lib/dma-debug? Since current
> implementation is not correct for those ARCHs.
>
> if (!is_vmalloc_addr(addr) && !virt_addr_valid(addr))
> return;
>
> or
This looks like a good start, although I'm not sure I'd trust
virt_addr_valid on every little arch. In the worse case we'll
have to exclude offenders from supporting dma debug, so let's go
with that version.
> > > > + entry->pfn = is_vmalloc_addr(virt) ? vmalloc_to_pfn(virt) :
> > > > + page_to_pfn(virt_to_page(virt));
> >
> > Please use normal if/else conditionsals:
>
> Is this for better readability? I'll send another patch for this.
Yes.
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Miles Chen <miles.chen@mediatek.com>
Cc: Christoph Hellwig <hch@lst.de>,
Robin Murphy <robin.murphy@arm.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Andrew Morton <akpm@linux-foundation.org>,
wsd_upstream@mediatek.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, iommu@lists.linux-foundation.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v3] dma-debug: fix incorrect pfn calculation
Date: Tue, 3 Oct 2017 09:07:52 +0200 [thread overview]
Message-ID: <20171003070752.GA18928@lst.de> (raw)
In-Reply-To: <1506940241.28397.36.camel@mtkswgap22>
On Mon, Oct 02, 2017 at 06:30:41PM +0800, Miles Chen wrote:
> ARCHs like metag and xtensa define their mappings (non-vmalloc and
> non-linear) for dma allocation.
metag basically is a reimplementation of the vmalloc map mechanism
that should be easy to consolidate into the common one :( xtensa
has a weird remapping into a different segment, something that I
vaguely remember mips used to support as well.
> These mapping types are architecture-dependent and should not be used
> outside arch folders. So it is hard to check the mappings and convert
> a virtual address to a correct pfn in lib/dam-debug.c
>
> How about recording only vmalloc (by is_vmalloc_addr()) and linear
> address (by virt_addr_valid()) in lib/dma-debug? Since current
> implementation is not correct for those ARCHs.
>
> if (!is_vmalloc_addr(addr) && !virt_addr_valid(addr))
> return;
>
> or
This looks like a good start, although I'm not sure I'd trust
virt_addr_valid on every little arch. In the worse case we'll
have to exclude offenders from supporting dma debug, so let's go
with that version.
> > > > + entry->pfn = is_vmalloc_addr(virt) ? vmalloc_to_pfn(virt) :
> > > > + page_to_pfn(virt_to_page(virt));
> >
> > Please use normal if/else conditionsals:
>
> Is this for better readability? I'll send another patch for this.
Yes.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Miles Chen <miles.chen@mediatek.com>
Cc: Christoph Hellwig <hch@lst.de>,
Robin Murphy <robin.murphy@arm.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Andrew Morton <akpm@linux-foundation.org>,
wsd_upstream@mediatek.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, iommu@lists.linux-foundation.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v3] dma-debug: fix incorrect pfn calculation
Date: Tue, 3 Oct 2017 09:07:52 +0200 [thread overview]
Message-ID: <20171003070752.GA18928@lst.de> (raw)
In-Reply-To: <1506940241.28397.36.camel@mtkswgap22>
On Mon, Oct 02, 2017 at 06:30:41PM +0800, Miles Chen wrote:
> ARCHs like metag and xtensa define their mappings (non-vmalloc and
> non-linear) for dma allocation.
metag basically is a reimplementation of the vmalloc map mechanism
that should be easy to consolidate into the common one :( xtensa
has a weird remapping into a different segment, something that I
vaguely remember mips used to support as well.
> These mapping types are architecture-dependent and should not be used
> outside arch folders. So it is hard to check the mappings and convert
> a virtual address to a correct pfn in lib/dam-debug.c
>
> How about recording only vmalloc (by is_vmalloc_addr()) and linear
> address (by virt_addr_valid()) in lib/dma-debug? Since current
> implementation is not correct for those ARCHs.
>
> if (!is_vmalloc_addr(addr) && !virt_addr_valid(addr))
> return;
>
> or
This looks like a good start, although I'm not sure I'd trust
virt_addr_valid on every little arch. In the worse case we'll
have to exclude offenders from supporting dma debug, so let's go
with that version.
> > > > + entry->pfn = is_vmalloc_addr(virt) ? vmalloc_to_pfn(virt) :
> > > > + page_to_pfn(virt_to_page(virt));
> >
> > Please use normal if/else conditionsals:
>
> Is this for better readability? I'll send another patch for this.
Yes.
next prev parent reply other threads:[~2017-10-03 7:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 3:48 [PATCH v3] dma-debug: fix incorrect pfn calculation miles.chen
2017-09-27 3:48 ` miles.chen
2017-09-27 3:48 ` miles.chen
2017-09-27 10:23 ` Robin Murphy
2017-09-27 10:23 ` Robin Murphy
2017-10-01 8:04 ` Christoph Hellwig
2017-10-01 8:04 ` Christoph Hellwig
2017-10-02 10:30 ` Miles Chen
2017-10-02 10:30 ` Miles Chen
2017-10-02 10:30 ` Miles Chen
2017-10-03 7:07 ` Christoph Hellwig [this message]
2017-10-03 7:07 ` Christoph Hellwig
2017-10-03 7:07 ` 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=20171003070752.GA18928@lst.de \
--to=hch-jcswghmuv9g@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=miles.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=wsd_upstream-NuS5LvNUpcJWk0Htik3J/w@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.