From: Thomas Gleixner <tglx@linutronix•de>
To: LKML <linux-kernel@vger•kernel.org>
Cc: Juri Lelli <juri.lelli@redhat•com>,
linux-aio@kvack•org, Peter Zijlstra <peterz@infradead•org>,
Sebastian Andrzej Siewior <bigeasy@linutronix•de>,
Joonas Lahtinen <joonas.lahtinen@linux•intel.com>,
dri-devel@lists•freedesktop.org,
virtualization@lists•linux-foundation.org,
Ben Segall <bsegall@google•com>,
linux-mm@kvack•org, Huang Rui <ray.huang@amd•com>,
Paul Mackerras <paulus@samba•org>,
Gerd Hoffmann <kraxel@redhat•com>,
Daniel Bristot de Oliveira <bristot@redhat•com>,
sparclinux@vger•kernel.org, Vincent Chen <deanbo422@gmail•com>,
Christoph Hellwig <hch@lst•de>,
Vincent Guittot <vincent.guittot@linaro•org>,
Arnd Bergmann <arnd@arndb•de>, Max Filippov <jcmvbkbc@gmail•com>,
x86@kernel•org, Russell King <linux@armlinux•org.uk>,
linux-csky@vger•kernel.org, Ingo Molnar <mingo@kernel•org>,
David Airlie <airlied@linux•ie>,
VMware Graphics <linux-graphics-maintainer@vmware•com>,
Mel Gorman <mgorman@suse•de>,
nouveau@lists•freedesktop.org, Dave Airlie <airlied@redhat•com>,
linux-snps-arc@lists•infradead.org,
Ben Skeggs <bskeggs@redhat•com>,
linux-xtensa@linux-xtensa•org, Paul McKenney <paulmck@kernel•org>,
intel-gfx@lists•freedesktop.org,
Roland Scheidegger <sroland@vmware•com>,
Josef Bacik <josef@toxicpanda•com>,
Steven Rostedt <rostedt@goodmis•org>,
Linus Torvalds <torvalds@linuxfoundation•org>,
Alexander Viro <viro@zeniv•linux.org.uk>,
spice-devel@lists•freedesktop.org,
David Sterba <dsterba@suse•com>,
Rodrigo Vivi <rodrigo.vivi@intel•com>,
Dietmar Eggemann <dietmar.eggemann@arm•com>,
linux-arm-kernel@lists•infradead.org,
Jani Nikula <jani.nikula@linux•intel.com>,
Chris Zankel <chris@zankel•net>, Michal Simek <monstr@monstr•eu>,
Thomas Bogendoerfer <tsbogend@alpha•franken.de>,
Nick Hu <nickhu@andestech•com>, Chris Mason <clm@fb•com>,
Vineet Gupta <vgupta@synopsys•com>,
linux-mips@vger•kernel.org,
Christian Koenig <christian.koenig@amd•com>,
Benjamin LaHaise <bcrl@kvack•org>,
Daniel Vetter <daniel@ffwll•ch>,
linux-fsdevel@vger•kernel.org,
Andrew Morton <akpm@linux-foundation•org>,
linuxppc-dev@lists•ozlabs.org,
"David S. Miller" <davem@davemloft•net>,
linux-btrfs@vger•kernel.org, Greentime Hu <green.hu@gmail•com>
Subject: [patch V3 32/37] drm/vmgfx: Replace kmap_atomic()
Date: Tue, 03 Nov 2020 10:27:44 +0100 [thread overview]
Message-ID: <20201103095859.836711767@linutronix.de> (raw)
In-Reply-To: 20201103092712.714480842@linutronix.de
There is no reason to disable pagefaults and preemption as a side effect of
kmap_atomic_prot().
Use kmap_local_page_prot() instead and document the reasoning for the
mapping usage with the given pgprot.
Remove the NULL pointer check for the map. These functions return a valid
address for valid pages and the return was bogus anyway as it would have
left preemption and pagefaults disabled.
Signed-off-by: Thomas Gleixner <tglx@linutronix•de>
Cc: VMware Graphics <linux-graphics-maintainer@vmware•com>
Cc: Roland Scheidegger <sroland@vmware•com>
Cc: David Airlie <airlied@linux•ie>
Cc: Daniel Vetter <daniel@ffwll•ch>
Cc: dri-devel@lists•freedesktop.org
---
V3: New patch
---
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
@@ -375,12 +375,12 @@ static int vmw_bo_cpu_blit_line(struct v
copy_size = min_t(u32, copy_size, PAGE_SIZE - src_page_offset);
if (unmap_src) {
- kunmap_atomic(d->src_addr);
+ kunmap_local(d->src_addr);
d->src_addr = NULL;
}
if (unmap_dst) {
- kunmap_atomic(d->dst_addr);
+ kunmap_local(d->dst_addr);
d->dst_addr = NULL;
}
@@ -388,12 +388,8 @@ static int vmw_bo_cpu_blit_line(struct v
if (WARN_ON_ONCE(dst_page >= d->dst_num_pages))
return -EINVAL;
- d->dst_addr =
- kmap_atomic_prot(d->dst_pages[dst_page],
- d->dst_prot);
- if (!d->dst_addr)
- return -ENOMEM;
-
+ d->dst_addr = kmap_local_page_prot(d->dst_pages[dst_page],
+ d->dst_prot);
d->mapped_dst = dst_page;
}
@@ -401,12 +397,8 @@ static int vmw_bo_cpu_blit_line(struct v
if (WARN_ON_ONCE(src_page >= d->src_num_pages))
return -EINVAL;
- d->src_addr =
- kmap_atomic_prot(d->src_pages[src_page],
- d->src_prot);
- if (!d->src_addr)
- return -ENOMEM;
-
+ d->src_addr = kmap_local_page_prot(d->src_pages[src_page],
+ d->src_prot);
d->mapped_src = src_page;
}
diff->do_cpy(diff, d->dst_addr + dst_page_offset,
@@ -436,8 +428,10 @@ static int vmw_bo_cpu_blit_line(struct v
*
* Performs a CPU blit from one buffer object to another avoiding a full
* bo vmap which may exhaust- or fragment vmalloc space.
- * On supported architectures (x86), we're using kmap_atomic which avoids
- * cross-processor TLB- and cache flushes and may, on non-HIGHMEM systems
+ *
+ * On supported architectures (x86), we're using kmap_local_prot() which
+ * avoids cross-processor TLB- and cache flushes. kmap_local_prot() will
+ * either map a highmem page with the proper pgprot on HIGHMEM=y systems or
* reference already set-up mappings.
*
* Neither of the buffer objects may be placed in PCI memory
@@ -500,9 +494,9 @@ int vmw_bo_cpu_blit(struct ttm_buffer_ob
}
out:
if (d.src_addr)
- kunmap_atomic(d.src_addr);
+ kunmap_local(d.src_addr);
if (d.dst_addr)
- kunmap_atomic(d.dst_addr);
+ kunmap_local(d.dst_addr);
return ret;
}
next prev parent reply other threads:[~2020-11-03 12:57 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 9:27 [patch V3 00/37] mm/highmem: Preemptible variant of kmap_atomic & friends Thomas Gleixner
2020-11-03 9:27 ` [patch V3 01/37] mm/highmem: Un-EXPORT __kmap_atomic_idx() Thomas Gleixner
2020-11-03 9:27 ` [patch V3 02/37] highmem: Remove unused functions Thomas Gleixner
2020-11-03 9:27 ` [patch V3 03/37] fs: Remove asm/kmap_types.h includes Thomas Gleixner
2020-11-03 11:12 ` David Sterba
2020-11-03 9:27 ` [patch V3 04/37] sh/highmem: Remove all traces of unused cruft Thomas Gleixner
2020-11-03 9:27 ` [patch V3 05/37] asm-generic: Provide kmap_size.h Thomas Gleixner
2020-11-03 12:25 ` Arnd Bergmann
2020-11-03 9:27 ` [patch V3 06/37] highmem: Provide generic variant of kmap_atomic* Thomas Gleixner
2020-11-03 9:27 ` [patch V3 07/37] highmem: Make DEBUG_HIGHMEM functional Thomas Gleixner
2020-11-03 9:27 ` [patch V3 08/37] x86/mm/highmem: Use generic kmap atomic implementation Thomas Gleixner
2020-11-03 9:27 ` [patch V3 09/37] arc/mm/highmem: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 10/37] ARM: highmem: Switch to generic kmap atomic Thomas Gleixner
2020-11-12 8:10 ` Marek Szyprowski
2020-11-12 11:03 ` Thomas Gleixner
2020-11-12 11:07 ` Sebastian Andrzej Siewior
2020-11-03 9:27 ` [patch V3 11/37] csky/mm/highmem: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 12/37] microblaze/mm/highmem: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 13/37] mips/mm/highmem: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 14/37] nds32/mm/highmem: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 15/37] powerpc/mm/highmem: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 16/37] sparc/mm/highmem: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 17/37] xtensa/mm/highmem: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 18/37] highmem: Get rid of kmap_types.h Thomas Gleixner
2020-11-03 9:27 ` [patch V3 19/37] mm/highmem: Remove the old kmap_atomic cruft Thomas Gleixner
2020-11-03 9:27 ` [patch V3 20/37] io-mapping: Cleanup atomic iomap Thomas Gleixner
2020-11-03 9:27 ` [patch V3 21/37] Documentation/io-mapping: Remove outdated blurb Thomas Gleixner
2020-11-03 9:27 ` [patch V3 22/37] highmem: High implementation details and document API Thomas Gleixner
2020-11-03 17:48 ` Linus Torvalds
2020-11-03 19:00 ` Thomas Gleixner
2020-11-03 9:27 ` [patch V3 23/37] sched: Make migrate_disable/enable() independent of RT Thomas Gleixner
2020-11-03 9:27 ` [patch V3 24/37] sched: highmem: Store local kmaps in task struct Thomas Gleixner
2020-11-03 13:49 ` Thomas Gleixner
2020-11-03 13:51 ` [patch V4 " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 25/37] mm/highmem: Provide kmap_local* Thomas Gleixner
2020-11-03 9:27 ` [patch V3 26/37] io-mapping: Provide iomap_local variant Thomas Gleixner
2020-11-03 9:27 ` [patch V3 27/37] x86/crashdump/32: Simplify copy_oldmem_page() Thomas Gleixner
2020-11-03 9:27 ` [patch V3 28/37] mips/crashdump: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 29/37] ARM: mm: Replace kmap_atomic_pfn() Thomas Gleixner
2020-11-03 9:27 ` [patch V3 30/37] highmem: Remove kmap_atomic_pfn() Thomas Gleixner
2020-11-03 9:27 ` [patch V3 31/37] drm/ttm: Replace kmap_atomic() usage Thomas Gleixner
2020-11-03 9:27 ` Thomas Gleixner [this message]
2020-11-03 9:27 ` [patch V3 33/37] highmem: Remove kmap_atomic_prot() Thomas Gleixner
2020-11-03 9:27 ` [patch V3 34/37] drm/qxl: Replace io_mapping_map_atomic_wc() Thomas Gleixner
2020-11-03 9:27 ` [patch V3 35/37] drm/nouveau/device: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 36/37] drm/i915: " Thomas Gleixner
2020-11-03 9:27 ` [patch V3 37/37] io-mapping: Remove io_mapping_map_atomic_wc() Thomas Gleixner
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=20201103095859.836711767@linutronix.de \
--to=tglx@linutronix$(echo .)de \
--cc=airlied@linux$(echo .)ie \
--cc=airlied@redhat$(echo .)com \
--cc=akpm@linux-foundation$(echo .)org \
--cc=arnd@arndb$(echo .)de \
--cc=bcrl@kvack$(echo .)org \
--cc=bigeasy@linutronix$(echo .)de \
--cc=bristot@redhat$(echo .)com \
--cc=bsegall@google$(echo .)com \
--cc=bskeggs@redhat$(echo .)com \
--cc=chris@zankel$(echo .)net \
--cc=christian.koenig@amd$(echo .)com \
--cc=clm@fb$(echo .)com \
--cc=daniel@ffwll$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=deanbo422@gmail$(echo .)com \
--cc=dietmar.eggemann@arm$(echo .)com \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=dsterba@suse$(echo .)com \
--cc=green.hu@gmail$(echo .)com \
--cc=hch@lst$(echo .)de \
--cc=intel-gfx@lists$(echo .)freedesktop.org \
--cc=jani.nikula@linux$(echo .)intel.com \
--cc=jcmvbkbc@gmail$(echo .)com \
--cc=joonas.lahtinen@linux$(echo .)intel.com \
--cc=josef@toxicpanda$(echo .)com \
--cc=juri.lelli@redhat$(echo .)com \
--cc=kraxel@redhat$(echo .)com \
--cc=linux-aio@kvack$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-btrfs@vger$(echo .)kernel.org \
--cc=linux-csky@vger$(echo .)kernel.org \
--cc=linux-fsdevel@vger$(echo .)kernel.org \
--cc=linux-graphics-maintainer@vmware$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-mips@vger$(echo .)kernel.org \
--cc=linux-mm@kvack$(echo .)org \
--cc=linux-snps-arc@lists$(echo .)infradead.org \
--cc=linux-xtensa@linux-xtensa$(echo .)org \
--cc=linux@armlinux$(echo .)org.uk \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=mgorman@suse$(echo .)de \
--cc=mingo@kernel$(echo .)org \
--cc=monstr@monstr$(echo .)eu \
--cc=nickhu@andestech$(echo .)com \
--cc=nouveau@lists$(echo .)freedesktop.org \
--cc=paulmck@kernel$(echo .)org \
--cc=paulus@samba$(echo .)org \
--cc=peterz@infradead$(echo .)org \
--cc=ray.huang@amd$(echo .)com \
--cc=rodrigo.vivi@intel$(echo .)com \
--cc=rostedt@goodmis$(echo .)org \
--cc=sparclinux@vger$(echo .)kernel.org \
--cc=spice-devel@lists$(echo .)freedesktop.org \
--cc=sroland@vmware$(echo .)com \
--cc=torvalds@linuxfoundation$(echo .)org \
--cc=tsbogend@alpha$(echo .)franken.de \
--cc=vgupta@synopsys$(echo .)com \
--cc=vincent.guittot@linaro$(echo .)org \
--cc=viro@zeniv$(echo .)linux.org.uk \
--cc=virtualization@lists$(echo .)linux-foundation.org \
--cc=x86@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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