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>
prev parent reply other threads:[~2017-10-03 7:07 UTC|newest]
Thread overview: 5+ 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 10:23 ` Robin Murphy
2017-10-01 8:04 ` Christoph Hellwig
2017-10-02 10:30 ` Miles Chen
2017-10-03 7:07 ` Christoph Hellwig [this message]
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@lst.de \
--cc=akpm@linux-foundation.org \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=miles.chen@mediatek.com \
--cc=robin.murphy@arm.com \
--cc=wsd_upstream@mediatek.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;
as well as URLs for NNTP newsgroup(s).