From: Matthew Wilcox <willy@infradead.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: dm-devel@redhat.com, eric.dumazet@gmail.com, mst@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, linux-mm@kvack.org,
edumazet@google.com, bhutchings@solarflare.com,
Andrew Morton <akpm@linux-foundation.org>,
David Miller <davem@davemloft.net>,
Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM
Date: Fri, 20 Apr 2018 04:47:12 -0700 [thread overview]
Message-ID: <20180420114712.GB10788@bombadil.infradead.org> (raw)
In-Reply-To: <alpine.LRH.2.02.1804191207380.31175@file01.intranet.prod.int.rdu2.redhat.com>
On Thu, Apr 19, 2018 at 12:12:38PM -0400, Mikulas Patocka wrote:
> Unfortunatelly, some kernel code has bugs - it uses kvmalloc and then
> uses DMA-API on the returned memory or frees it with kfree. Such bugs were
> found in the virtio-net driver, dm-integrity or RHEL7 powerpc-specific
> code.
Maybe it's time to have the SG code handle vmalloced pages? This is
becoming more and more common with vmapped stacks (and some of our
workarounds are hideous -- allocate 4 bytes with kmalloc because we can't
DMA onto the stack any more?). We already have a few places which do
handle sgs of vmalloced addresses, such as the nx crypto driver:
if (is_vmalloc_addr(start_addr))
sg_addr = page_to_phys(vmalloc_to_page(start_addr))
+ offset_in_page(sg_addr);
else
sg_addr = __pa(sg_addr);
and videobuf:
pg = vmalloc_to_page(virt);
if (NULL == pg)
goto err;
BUG_ON(page_to_pfn(pg) >= (1 << (32 - PAGE_SHIFT)));
sg_set_page(&sglist[i], pg, PAGE_SIZE, 0);
Yes, there's the potential that we have to produce two SG entries for a
virtually contiguous region if it crosses a page boundary, and our APIs
aren't set up right to make it happen. But this is something we should
consider fixing ... otherwise we'll end up with dozens of driver hacks.
The videobuf implementation was already copy-and-pasted into the saa7146
driver, for example.
next prev parent reply other threads:[~2018-04-20 11:47 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <alpine.LRH.2.02.1804181029270.19294@file01.intranet.prod.int.rdu2.redhat.com>
[not found] ` <3e65977e-53cd-bf09-bc4b-0ce40e9091fe@gmail.com>
2018-04-18 16:44 ` [PATCH] net: don't use kvzalloc for DMA memory Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804181218270.19136@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-18 16:51 ` Eric Dumazet
2018-04-18 16:51 ` Eric Dumazet
2018-04-18 17:46 ` David Miller
[not found] ` <5f4e1286-b79f-0b9f-9a30-47d7654f3889@gmail.com>
2018-04-18 17:47 ` David Miller
2018-04-18 17:55 ` Mikulas Patocka
2018-04-18 18:00 ` Michael S. Tsirkin
2018-04-18 17:49 ` Mikulas Patocka
[not found] ` <20180418.134651.2225112489265654270.davem@davemloft.net>
2018-04-18 17:53 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804181350050.17942@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-19 16:12 ` [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804191207380.31175@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-19 16:25 ` Eric Dumazet
2018-04-19 16:28 ` Mikulas Patocka
2018-04-19 16:43 ` Michael S. Tsirkin
2018-04-19 18:28 ` Vlastimil Babka
2018-04-19 19:47 ` Andrew Morton
[not found] ` <20180419124751.8884e516e99825d83da3d87a@linux-foundation.org>
2018-04-19 21:19 ` Mikulas Patocka
2018-04-19 23:22 ` Andrew Morton
[not found] ` <20180419162250.00bf82e2c40b4960a7e23cdc@linux-foundation.org>
2018-04-20 12:16 ` Mikulas Patocka
[not found] ` <20180419193554-mutt-send-email-mst@kernel.org>
2018-04-19 21:27 ` [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG Mikulas Patocka
2018-04-20 11:47 ` Matthew Wilcox [this message]
2018-04-20 12:20 ` [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804200817230.22382@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-23 15:25 ` Michael S. Tsirkin
2018-04-20 13:08 ` Michal Hocko
2018-04-20 13:41 ` Matthew Wilcox
[not found] ` <20180420134136.GD10788@bombadil.infradead.org>
2018-04-20 13:49 ` Michal Hocko
[not found] ` <20180420134901.GB17484@dhcp22.suse.cz>
2018-04-20 20:56 ` Mikulas Patocka
2018-04-20 20:54 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804201635180.25408@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-20 21:02 ` Matthew Wilcox
[not found] ` <20180420210200.GH10788@bombadil.infradead.org>
2018-04-20 21:21 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804201704580.25408@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-21 14:47 ` Matthew Wilcox
[not found] ` <20180421144757.GC14610@bombadil.infradead.org>
2018-04-22 13:03 ` Michal Hocko
2018-04-23 14:06 ` Mikulas Patocka
[not found] ` <20180422130356.GG17484@dhcp22.suse.cz>
2018-04-23 14:24 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804231006440.22488@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-23 15:10 ` Michal Hocko
[not found] ` <20180423151015.GT17484@dhcp22.suse.cz>
2018-04-23 23:20 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804221733520.7995@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-23 15:15 ` Michal Hocko
[not found] ` <20180423151545.GU17484@dhcp22.suse.cz>
2018-04-24 0:06 ` [PATCH v3] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG Mikulas Patocka
2018-04-24 0:25 ` [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804232003100.2299@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-24 3:46 ` [PATCH v3] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG Matthew Wilcox
[not found] ` <alpine.DEB.2.21.1804231945410.58980@chino.kir.corp.google.com>
2018-04-24 11:04 ` Mikulas Patocka
[not found] ` <20180424034643.GA26636@bombadil.infradead.org>
2018-04-24 12:29 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804240818530.28016@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-24 17:16 ` Matthew Wilcox
[not found] ` <20180424171651.GC30577@bombadil.infradead.org>
2018-04-24 18:41 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804241428120.8296@file01.intranet.prod.int.rdu2.redhat.com>
2018-05-15 1:13 ` Joonsoo Kim
2018-04-24 12:51 ` Michal Hocko
2018-04-24 15:50 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804241142340.15660@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-24 16:29 ` Michal Hocko
[not found] ` <20180424162906.GM17484@dhcp22.suse.cz>
2018-04-24 17:00 ` Mikulas Patocka
2018-04-24 17:03 ` Michal Hocko
2018-04-24 17:28 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804241319390.28995@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-24 17:38 ` Michal Hocko
[not found] ` <20180424173836.GR17484@dhcp22.suse.cz>
2018-04-25 20:02 ` [PATCH] fault-injection: reorder config entries Mikulas Patocka
2018-04-26 3:21 ` Randy Dunlap
2018-04-25 20:02 ` [PATCH v4] fault-injection: introduce kvmalloc fallback options Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804251556060.30569@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-25 20:20 ` Randy Dunlap
2018-04-25 20:57 ` [PATCH v5] " Mikulas Patocka
2018-04-25 21:11 ` Randy Dunlap
[not found] ` <alpine.DEB.2.21.1804251417470.166306@chino.kir.corp.google.com>
2018-04-25 21:22 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804251720090.9428@file01.intranet.prod.int.rdu2.redhat.com>
[not found] ` <1524694663.4100.21.camel@HansenPartnership.com>
2018-04-25 22:42 ` [dm-devel] " Mikulas Patocka
2018-04-25 23:00 ` Mikulas Patocka
[not found] ` <1524697697.4100.23.camel@HansenPartnership.com>
2018-04-26 14:55 ` Mikulas Patocka
[not found] ` <23266.8532.619051.784274@quad.stoffel.home>
2018-04-26 21:50 ` Mikulas Patocka
2018-04-26 22:21 ` Michael S. Tsirkin
[not found] ` <20180427005213-mutt-send-email-mst@kernel.org>
2018-04-26 22:52 ` Mikulas Patocka
2018-04-27 8:25 ` Michal Hocko
[not found] ` <20180427082555.GC17484@dhcp22.suse.cz>
2018-04-27 10:20 ` Mikulas Patocka
2018-04-27 23:20 ` Mikulas Patocka
[not found] ` <23271.24580.695738.853532@quad.stoffel.home>
2018-04-30 21:07 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804301622480.4454@file01.intranet.prod.int.rdu2.redhat.com>
[not found] ` <23273.48986.516559.317965@quad.stoffel.home>
2018-05-03 17:40 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804251830540.25124@file01.intranet.prod.int.rdu2.redhat.com>
[not found] ` <alpine.DEB.2.21.1804251546240.58229@chino.kir.corp.google.com>
2018-04-25 22:56 ` Mikulas Patocka
2018-04-26 12:58 ` Michal Hocko
2018-04-26 14:28 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804261006120.32722@file01.intranet.prod.int.rdu2.redhat.com>
[not found] ` <1524753932.3226.5.camel@HansenPartnership.com>
2018-04-26 15:05 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804261100170.12157@file01.intranet.prod.int.rdu2.redhat.com>
[not found] ` <1524756256.3226.7.camel@HansenPartnership.com>
2018-04-26 15:44 ` Mikulas Patocka
2018-04-26 15:59 ` Michael S. Tsirkin
[not found] ` <20180426184845-mutt-send-email-mst@kernel.org>
2018-04-26 16:07 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804261202350.24656@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-26 18:49 ` Michael S. Tsirkin
[not found] ` <20180426214011-mutt-send-email-mst@kernel.org>
2018-04-26 18:54 ` Mikulas Patocka
2018-04-26 19:14 ` Michael S. Tsirkin
[not found] ` <20180426220523-mutt-send-email-mst@kernel.org>
2018-04-26 19:36 ` Mikulas Patocka
2018-04-26 19:45 ` Michael S. Tsirkin
2018-04-26 20:05 ` Mikulas Patocka
2018-04-26 18:58 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804261454380.23716@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-26 19:05 ` Michael S. Tsirkin
2018-04-26 15:55 ` Mikulas Patocka
[not found] ` <alpine.LRH.2.02.1804232006540.2299@file01.intranet.prod.int.rdu2.redhat.com>
2018-04-24 13:31 ` [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM Michal Hocko
[not found] ` <20180424133146.GG17484@dhcp22.suse.cz>
2018-04-24 15:30 ` Mikulas Patocka
2018-04-24 16:12 ` Michal Hocko
2018-04-24 16:29 ` Michal Hocko
2018-04-24 16:33 ` Mikulas Patocka
2018-05-02 0:36 ` Andrew Morton
2018-05-02 13:33 ` Mike Snitzer
2018-05-03 17:32 ` [PATCH] " Mikulas Patocka
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=20180420114712.GB10788@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=dm-devel@redhat.com \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mpatocka@redhat.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=vbabka@suse.cz \
--cc=virtualization@lists.linux-foundation.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;
as well as URLs for NNTP newsgroup(s).