Re: [RFC PATCH net-next v8 14/14] selftests: add ncdevmem, netcat for devmem TCP
On Tue, Apr 02, 2024 at 05:20:51PM -0700, Mina Almasry wrote: > +static char *server_ip = "192.168.1.4"; > +static char *client_ip = "192.168.1.2"; > +static char *port = "5201"; > +static size_t do_validation; > +static int start_queue = 8; > +static int num_queues = 8; > +static char *ifname = "eth1"; > +static unsigned int ifindex = 3; > +static char *nic_pci_addr = ":06:00.0"; It seems this is set but never used. Thanks.
Re: [RFC PATCH net-next v6 02/15] net: page_pool: create hooks for custom page providers
On Mon, Apr 01, 2024 at 12:22:24PM -0700, Mina Almasry wrote: > On Thu, Mar 28, 2024 at 12:31 AM Christoph Hellwig wrote: > > > > On Tue, Mar 26, 2024 at 01:19:20PM -0700, Mina Almasry wrote: > > > > > > Are you envisioning that dmabuf support would be added to the block > > > layer > > > > Yes. > > > > > (which I understand is part of the VFS and not driver specific), > > > > The block layer isn't really the VFS, it's just another core stack > > like the network stack. > > > > > or as part of the specific storage driver (like nvme for example)? If > > > we can add dmabuf support to the block layer itself that sounds > > > awesome. We may then be able to do devmem TCP on all/most storage > > > devices without having to modify each individual driver. > > > > I suspect we'll still need to touch the drivers to understand it, > > but hopefully all the main infrastructure can live in the block layer. > > > > > In your estimation, is adding dmabuf support to the block layer > > > something technically feasible & acceptable upstream? I notice you > > > suggested it so I'm guessing yes to both, but I thought I'd confirm. > > > > I think so, and I know there has been quite some interest to at least > > pre-register userspace memory so that the iommu overhead can be > > pre-loaded. It also is a much better interface for Peer to Peer > > transfers than what we currently have. > > Thanks for copying me on this. This sounds really great. Also P2PDMA requires PCI root complex to support this kind of direct transfer, and IIUC dmabuf does not have such hardware dependency. > > I think this is positively thrilling news for me. I was worried that > adding devmemTCP support to storage devices would involve using a > non-dmabuf standard of buffer sharing like pci_p2pdma_ > (drivers/pci/p2pdma.c) and that would require messy changes to > pci_p2pdma_ that would get nacked. Also it would require adding > pci_p2pdma_ support to devmem TCP, which is a can of worms. If adding > dma-buf support to storage devices is feasible and desirable, that's a > much better approach IMO. (a) it will maybe work with devmem TCP > without any changes needed on the netdev side of things and (b) > dma-buf support may be generically useful and a good contribution even > outside of devmem TCP. I think the major difference is its interface, which exposes an mmap memory region instead of fd: https://lwn.net/Articles/906092/. > > I don't have a concrete user for devmem TCP for storage devices but > the use case is very similar to GPU and I imagine the benefits in perf > can be significant in some setups. We have storage use cases at ByteDance, we use NVME SSD to cache videos transferred through network, so moving data directly from SSD to NIC would help a lot. Thanks!
Re: [PATCH] dma-buf: free dmabuf->name in dma_buf_release()
On Tue, Feb 25, 2020 at 5:54 PM Andrew Morton wrote: > > On Tue, 25 Feb 2020 12:44:46 -0800 Cong Wang wrote: > > > dma-buff name can be set via DMA_BUF_SET_NAME ioctl, but once set > > it never gets freed. > > > > Free it in dma_buf_release(). > > > > ... > > > > --- a/drivers/dma-buf/dma-buf.c > > +++ b/drivers/dma-buf/dma-buf.c > > @@ -108,6 +108,7 @@ static int dma_buf_release(struct inode *inode, struct > > file *file) > > dma_resv_fini(dmabuf->resv); > > > > module_put(dmabuf->owner); > > + kfree(dmabuf->name); > > kfree(dmabuf); > > return 0; > > } > > ow. Is that ioctl privileged? It looks unprivileged to me, as I don't see capable() called along the path. Thanks. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] dma-buf: free dmabuf->name in dma_buf_release()
dma-buff name can be set via DMA_BUF_SET_NAME ioctl, but once set it never gets freed. Free it in dma_buf_release(). Fixes: bb2bb9030425 ("dma-buf: add DMA_BUF_SET_NAME ioctls") Reported-by: syzbot+b2098bc44728a4efb...@syzkaller.appspotmail.com Acked-by: Chenbo Feng Cc: Sumit Semwal Cc: Andrew Morton Cc: Linus Torvalds Signed-off-by: Cong Wang --- drivers/dma-buf/dma-buf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index d4097856c86b..c343c7c10b4c 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -108,6 +108,7 @@ static int dma_buf_release(struct inode *inode, struct file *file) dma_resv_fini(dmabuf->resv); module_put(dmabuf->owner); + kfree(dmabuf->name); kfree(dmabuf); return 0; } -- 2.21.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] dma-buf: free dmabuf->name in dma_buf_release()
dma-buff name can be set via DMA_BUF_SET_NAME ioctl, but once set it never gets freed. Free it in dma_buf_release(). Fixes: bb2bb9030425 ("dma-buf: add DMA_BUF_SET_NAME ioctls") Reported-by: syzbot+b2098bc44728a4efb...@syzkaller.appspotmail.com Cc: Greg Hackmann Cc: Chenbo Feng Cc: Sumit Semwal Signed-off-by: Cong Wang --- drivers/dma-buf/dma-buf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index ce41cd9b758a..2427398ff22a 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -108,6 +108,7 @@ static int dma_buf_release(struct inode *inode, struct file *file) dma_resv_fini(dmabuf->resv); module_put(dmabuf->owner); + kfree(dmabuf->name); kfree(dmabuf); return 0; } -- 2.21.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 7/7] module: avoid exporting module_mutex
drm_fb_helper_modinit() calls find_module() which only needs rcu_read_lock_sched(). The rest seems still have to hold module_mutex to prevent module insertion/deletion. Instead of exporting module_mutex for them, export two functions lock_modules()/unlock_modules() and hide module_mutex. Cc: Eric Dumazet Cc: "Paul E. McKenney" Cc: Rusty Russell Signed-off-by: Cong Wang --- drivers/gpu/drm/drm_fb_helper.c |4 ++-- include/linux/module.h |3 ++- kernel/kprobes.c|4 ++-- kernel/module.c | 24 ++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index aada26f..a3aee0e 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1451,9 +1451,9 @@ static int __init drm_fb_helper_modinit(void) const char *name = "fbcon"; struct module *fbcon; - mutex_lock(_mutex); + rcu_read_lock_sched(); fbcon = find_module(name); - mutex_unlock(_mutex); + rcu_read_unlock_sched(); if (!fbcon) request_module_nowait(name); diff --git a/include/linux/module.h b/include/linux/module.h index 4598bf0..5cf6428 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -374,7 +374,8 @@ struct module #define MODULE_ARCH_INIT {} #endif -extern struct mutex module_mutex; +extern void lock_modules(void); +extern void unlock_modules(void); /* FIXME: It'd be nice to isolate modules during init, too, so they aren't used before they (may) fail. But presently too much code diff --git a/kernel/kprobes.c b/kernel/kprobes.c index c62b854..0670fb1 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -562,7 +562,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) LIST_HEAD(free_list); /* Lock modules while optimizing kprobes */ - mutex_lock(_mutex); + lock_modules(); mutex_lock(_mutex); /* @@ -587,7 +587,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) do_free_cleaned_kprobes(_list); mutex_unlock(_mutex); - mutex_unlock(_mutex); + unlock_modules(); /* Step 5: Kick optimizer again if needed */ if (!list_empty(_list) || !list_empty(_list)) diff --git a/kernel/module.c b/kernel/module.c index 2e7a5c5..b60f882 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -95,8 +95,20 @@ * 2) module_use links, * 3) module_addr_min/module_addr_max. * (delete uses stop_machine/add uses RCU list operations). */ -DEFINE_MUTEX(module_mutex); -EXPORT_SYMBOL_GPL(module_mutex); +static DEFINE_MUTEX(module_mutex); + +void lock_modules(void) +{ + mutex_lock(_mutex); +} +EXPORT_SYMBOL(lock_modules); + +void unlock_modules(void) +{ + mutex_unlock(_mutex); +} +EXPORT_SYMBOL(unlock_modules); + static LIST_HEAD(modules); #ifdef CONFIG_KGDB_KDB struct list_head *kdb_modules = /* kdb needs the list of modules */ @@ -1715,7 +1727,7 @@ void set_all_modules_text_rw(void) { struct module *mod; - mutex_lock(_mutex); + lock_modules(); list_for_each_entry_rcu(mod, , list) { if ((mod->module_core) && (mod->core_text_size)) { set_page_attributes(mod->module_core, @@ -1728,7 +1740,7 @@ void set_all_modules_text_rw(void) set_memory_rw); } } - mutex_unlock(_mutex); + unlock_modules(); } /* Iterate through all modules and set each module's text as RO */ @@ -1736,7 +1748,7 @@ void set_all_modules_text_ro(void) { struct module *mod; - mutex_lock(_mutex); + lock_modules(); list_for_each_entry_rcu(mod, , list) { if ((mod->module_core) && (mod->core_text_size)) { set_page_attributes(mod->module_core, @@ -1749,7 +1761,7 @@ void set_all_modules_text_ro(void) set_memory_ro); } } - mutex_unlock(_mutex); + unlock_modules(); } #else static inline void set_section_ro_nx(void *base, unsigned long text_size, unsigned long ro_size, unsigned long total_size) { } -- 1.7.7.6
[PATCH 7/7] module: avoid exporting module_mutex
drm_fb_helper_modinit() calls find_module() which only needs rcu_read_lock_sched(). The rest seems still have to hold module_mutex to prevent module insertion/deletion. Instead of exporting module_mutex for them, export two functions lock_modules()/unlock_modules() and hide module_mutex. Cc: Eric Dumazet eric.duma...@gmail.com Cc: Paul E. McKenney paul...@linux.vnet.ibm.com Cc: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Cong Wang xiyou.wangc...@gmail.com --- drivers/gpu/drm/drm_fb_helper.c |4 ++-- include/linux/module.h |3 ++- kernel/kprobes.c|4 ++-- kernel/module.c | 24 ++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index aada26f..a3aee0e 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1451,9 +1451,9 @@ static int __init drm_fb_helper_modinit(void) const char *name = fbcon; struct module *fbcon; - mutex_lock(module_mutex); + rcu_read_lock_sched(); fbcon = find_module(name); - mutex_unlock(module_mutex); + rcu_read_unlock_sched(); if (!fbcon) request_module_nowait(name); diff --git a/include/linux/module.h b/include/linux/module.h index 4598bf0..5cf6428 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -374,7 +374,8 @@ struct module #define MODULE_ARCH_INIT {} #endif -extern struct mutex module_mutex; +extern void lock_modules(void); +extern void unlock_modules(void); /* FIXME: It'd be nice to isolate modules during init, too, so they aren't used before they (may) fail. But presently too much code diff --git a/kernel/kprobes.c b/kernel/kprobes.c index c62b854..0670fb1 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -562,7 +562,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) LIST_HEAD(free_list); /* Lock modules while optimizing kprobes */ - mutex_lock(module_mutex); + lock_modules(); mutex_lock(kprobe_mutex); /* @@ -587,7 +587,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) do_free_cleaned_kprobes(free_list); mutex_unlock(kprobe_mutex); - mutex_unlock(module_mutex); + unlock_modules(); /* Step 5: Kick optimizer again if needed */ if (!list_empty(optimizing_list) || !list_empty(unoptimizing_list)) diff --git a/kernel/module.c b/kernel/module.c index 2e7a5c5..b60f882 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -95,8 +95,20 @@ * 2) module_use links, * 3) module_addr_min/module_addr_max. * (delete uses stop_machine/add uses RCU list operations). */ -DEFINE_MUTEX(module_mutex); -EXPORT_SYMBOL_GPL(module_mutex); +static DEFINE_MUTEX(module_mutex); + +void lock_modules(void) +{ + mutex_lock(module_mutex); +} +EXPORT_SYMBOL(lock_modules); + +void unlock_modules(void) +{ + mutex_unlock(module_mutex); +} +EXPORT_SYMBOL(unlock_modules); + static LIST_HEAD(modules); #ifdef CONFIG_KGDB_KDB struct list_head *kdb_modules = modules; /* kdb needs the list of modules */ @@ -1715,7 +1727,7 @@ void set_all_modules_text_rw(void) { struct module *mod; - mutex_lock(module_mutex); + lock_modules(); list_for_each_entry_rcu(mod, modules, list) { if ((mod-module_core) (mod-core_text_size)) { set_page_attributes(mod-module_core, @@ -1728,7 +1740,7 @@ void set_all_modules_text_rw(void) set_memory_rw); } } - mutex_unlock(module_mutex); + unlock_modules(); } /* Iterate through all modules and set each module's text as RO */ @@ -1736,7 +1748,7 @@ void set_all_modules_text_ro(void) { struct module *mod; - mutex_lock(module_mutex); + lock_modules(); list_for_each_entry_rcu(mod, modules, list) { if ((mod-module_core) (mod-core_text_size)) { set_page_attributes(mod-module_core, @@ -1749,7 +1761,7 @@ void set_all_modules_text_ro(void) set_memory_ro); } } - mutex_unlock(module_mutex); + unlock_modules(); } #else static inline void set_section_ro_nx(void *base, unsigned long text_size, unsigned long ro_size, unsigned long total_size) { } -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/2] module: avoid exporting module_mutex
Avoid exporting internal locks to modules, export two functions lock_modules()/unlock_modules() for them instead. Cc: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Cong Wang xiyou.wangc...@gmail.com --- drivers/gpu/drm/drm_fb_helper.c |4 ++-- include/linux/module.h |3 ++- kernel/kprobes.c|4 ++-- kernel/module.c | 16 ++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index aada26f..c184759 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1451,9 +1451,9 @@ static int __init drm_fb_helper_modinit(void) const char *name = fbcon; struct module *fbcon; - mutex_lock(module_mutex); + lock_modules(); fbcon = find_module(name); - mutex_unlock(module_mutex); + unlock_modules(); if (!fbcon) request_module_nowait(name); diff --git a/include/linux/module.h b/include/linux/module.h index 4598bf0..5cf6428 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -374,7 +374,8 @@ struct module #define MODULE_ARCH_INIT {} #endif -extern struct mutex module_mutex; +extern void lock_modules(void); +extern void unlock_modules(void); /* FIXME: It'd be nice to isolate modules during init, too, so they aren't used before they (may) fail. But presently too much code diff --git a/kernel/kprobes.c b/kernel/kprobes.c index c62b854..0670fb1 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -562,7 +562,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) LIST_HEAD(free_list); /* Lock modules while optimizing kprobes */ - mutex_lock(module_mutex); + lock_modules(); mutex_lock(kprobe_mutex); /* @@ -587,7 +587,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) do_free_cleaned_kprobes(free_list); mutex_unlock(kprobe_mutex); - mutex_unlock(module_mutex); + unlock_modules(); /* Step 5: Kick optimizer again if needed */ if (!list_empty(optimizing_list) || !list_empty(unoptimizing_list)) diff --git a/kernel/module.c b/kernel/module.c index e0b12f7..1165d5d 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -95,8 +95,20 @@ * 2) module_use links, * 3) module_addr_min/module_addr_max. * (delete uses stop_machine/add uses RCU list operations). */ -DEFINE_MUTEX(module_mutex); -EXPORT_SYMBOL_GPL(module_mutex); +static DEFINE_MUTEX(module_mutex); + +void lock_modules(void) +{ + mutex_lock(module_mutex); +} +EXPORT_SYMBOL(lock_modules); + +void unlock_modules(void) +{ + mutex_unlock(module_mutex); +} +EXPORT_SYMBOL(unlock_modules); + static LIST_HEAD(modules); #ifdef CONFIG_KGDB_KDB struct list_head *kdb_modules = modules; /* kdb needs the list of modules */ -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[V2 PATCH 2/3] module: avoid exporting module_mutex
Avoid exporting internal locks to modules, export two functions lock_modules()/unlock_modules() for them instead. Cc: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Cong Wang xiyou.wangc...@gmail.com --- drivers/gpu/drm/drm_fb_helper.c |4 ++-- include/linux/module.h |3 ++- kernel/kprobes.c|4 ++-- kernel/module.c | 24 ++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index aada26f..c184759 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1451,9 +1451,9 @@ static int __init drm_fb_helper_modinit(void) const char *name = fbcon; struct module *fbcon; - mutex_lock(module_mutex); + lock_modules(); fbcon = find_module(name); - mutex_unlock(module_mutex); + unlock_modules(); if (!fbcon) request_module_nowait(name); diff --git a/include/linux/module.h b/include/linux/module.h index 4598bf0..5cf6428 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -374,7 +374,8 @@ struct module #define MODULE_ARCH_INIT {} #endif -extern struct mutex module_mutex; +extern void lock_modules(void); +extern void unlock_modules(void); /* FIXME: It'd be nice to isolate modules during init, too, so they aren't used before they (may) fail. But presently too much code diff --git a/kernel/kprobes.c b/kernel/kprobes.c index c62b854..0670fb1 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -562,7 +562,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) LIST_HEAD(free_list); /* Lock modules while optimizing kprobes */ - mutex_lock(module_mutex); + lock_modules(); mutex_lock(kprobe_mutex); /* @@ -587,7 +587,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) do_free_cleaned_kprobes(free_list); mutex_unlock(kprobe_mutex); - mutex_unlock(module_mutex); + unlock_modules(); /* Step 5: Kick optimizer again if needed */ if (!list_empty(optimizing_list) || !list_empty(unoptimizing_list)) diff --git a/kernel/module.c b/kernel/module.c index f0f8d4a..db402a8 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -95,8 +95,20 @@ * 2) module_use links, * 3) module_addr_min/module_addr_max. * (delete uses stop_machine/add uses RCU list operations). */ -DEFINE_MUTEX(module_mutex); -EXPORT_SYMBOL_GPL(module_mutex); +static DEFINE_MUTEX(module_mutex); + +void lock_modules(void) +{ + mutex_lock(module_mutex); +} +EXPORT_SYMBOL(lock_modules); + +void unlock_modules(void) +{ + mutex_unlock(module_mutex); +} +EXPORT_SYMBOL(unlock_modules); + static LIST_HEAD(modules); #ifdef CONFIG_KGDB_KDB struct list_head *kdb_modules = modules; /* kdb needs the list of modules */ @@ -1713,7 +1725,7 @@ void set_all_modules_text_rw(void) { struct module *mod; - mutex_lock(module_mutex); + lock_modules(); list_for_each_entry(mod, modules, list) { if ((mod-module_core) (mod-core_text_size)) { set_page_attributes(mod-module_core, @@ -1726,7 +1738,7 @@ void set_all_modules_text_rw(void) set_memory_rw); } } - mutex_unlock(module_mutex); + unlock_modules(); } /* Iterate through all modules and set each module's text as RO */ @@ -1734,7 +1746,7 @@ void set_all_modules_text_ro(void) { struct module *mod; - mutex_lock(module_mutex); + lock_modules(); list_for_each_entry(mod, modules, list) { if ((mod-module_core) (mod-core_text_size)) { set_page_attributes(mod-module_core, @@ -1747,7 +1759,7 @@ void set_all_modules_text_ro(void) set_memory_ro); } } - mutex_unlock(module_mutex); + unlock_modules(); } #else static inline void set_section_ro_nx(void *base, unsigned long text_size, unsigned long ro_size, unsigned long total_size) { } -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[V2 PATCH 2/3] module: avoid exporting module_mutex
Avoid exporting internal locks to modules, export two functions lock_modules()/unlock_modules() for them instead. Cc: Rusty Russell Signed-off-by: Cong Wang --- drivers/gpu/drm/drm_fb_helper.c |4 ++-- include/linux/module.h |3 ++- kernel/kprobes.c|4 ++-- kernel/module.c | 24 ++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index aada26f..c184759 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1451,9 +1451,9 @@ static int __init drm_fb_helper_modinit(void) const char *name = "fbcon"; struct module *fbcon; - mutex_lock(_mutex); + lock_modules(); fbcon = find_module(name); - mutex_unlock(_mutex); + unlock_modules(); if (!fbcon) request_module_nowait(name); diff --git a/include/linux/module.h b/include/linux/module.h index 4598bf0..5cf6428 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -374,7 +374,8 @@ struct module #define MODULE_ARCH_INIT {} #endif -extern struct mutex module_mutex; +extern void lock_modules(void); +extern void unlock_modules(void); /* FIXME: It'd be nice to isolate modules during init, too, so they aren't used before they (may) fail. But presently too much code diff --git a/kernel/kprobes.c b/kernel/kprobes.c index c62b854..0670fb1 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -562,7 +562,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) LIST_HEAD(free_list); /* Lock modules while optimizing kprobes */ - mutex_lock(_mutex); + lock_modules(); mutex_lock(_mutex); /* @@ -587,7 +587,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) do_free_cleaned_kprobes(_list); mutex_unlock(_mutex); - mutex_unlock(_mutex); + unlock_modules(); /* Step 5: Kick optimizer again if needed */ if (!list_empty(_list) || !list_empty(_list)) diff --git a/kernel/module.c b/kernel/module.c index f0f8d4a..db402a8 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -95,8 +95,20 @@ * 2) module_use links, * 3) module_addr_min/module_addr_max. * (delete uses stop_machine/add uses RCU list operations). */ -DEFINE_MUTEX(module_mutex); -EXPORT_SYMBOL_GPL(module_mutex); +static DEFINE_MUTEX(module_mutex); + +void lock_modules(void) +{ + mutex_lock(_mutex); +} +EXPORT_SYMBOL(lock_modules); + +void unlock_modules(void) +{ + mutex_unlock(_mutex); +} +EXPORT_SYMBOL(unlock_modules); + static LIST_HEAD(modules); #ifdef CONFIG_KGDB_KDB struct list_head *kdb_modules = /* kdb needs the list of modules */ @@ -1713,7 +1725,7 @@ void set_all_modules_text_rw(void) { struct module *mod; - mutex_lock(_mutex); + lock_modules(); list_for_each_entry(mod, , list) { if ((mod->module_core) && (mod->core_text_size)) { set_page_attributes(mod->module_core, @@ -1726,7 +1738,7 @@ void set_all_modules_text_rw(void) set_memory_rw); } } - mutex_unlock(_mutex); + unlock_modules(); } /* Iterate through all modules and set each module's text as RO */ @@ -1734,7 +1746,7 @@ void set_all_modules_text_ro(void) { struct module *mod; - mutex_lock(_mutex); + lock_modules(); list_for_each_entry(mod, , list) { if ((mod->module_core) && (mod->core_text_size)) { set_page_attributes(mod->module_core, @@ -1747,7 +1759,7 @@ void set_all_modules_text_ro(void) set_memory_ro); } } - mutex_unlock(_mutex); + unlock_modules(); } #else static inline void set_section_ro_nx(void *base, unsigned long text_size, unsigned long ro_size, unsigned long total_size) { } -- 1.7.7.6
[PATCH 2/2] module: avoid exporting module_mutex
Avoid exporting internal locks to modules, export two functions lock_modules()/unlock_modules() for them instead. Cc: Rusty Russell Signed-off-by: Cong Wang --- drivers/gpu/drm/drm_fb_helper.c |4 ++-- include/linux/module.h |3 ++- kernel/kprobes.c|4 ++-- kernel/module.c | 16 ++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index aada26f..c184759 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1451,9 +1451,9 @@ static int __init drm_fb_helper_modinit(void) const char *name = "fbcon"; struct module *fbcon; - mutex_lock(_mutex); + lock_modules(); fbcon = find_module(name); - mutex_unlock(_mutex); + unlock_modules(); if (!fbcon) request_module_nowait(name); diff --git a/include/linux/module.h b/include/linux/module.h index 4598bf0..5cf6428 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -374,7 +374,8 @@ struct module #define MODULE_ARCH_INIT {} #endif -extern struct mutex module_mutex; +extern void lock_modules(void); +extern void unlock_modules(void); /* FIXME: It'd be nice to isolate modules during init, too, so they aren't used before they (may) fail. But presently too much code diff --git a/kernel/kprobes.c b/kernel/kprobes.c index c62b854..0670fb1 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -562,7 +562,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) LIST_HEAD(free_list); /* Lock modules while optimizing kprobes */ - mutex_lock(_mutex); + lock_modules(); mutex_lock(_mutex); /* @@ -587,7 +587,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) do_free_cleaned_kprobes(_list); mutex_unlock(_mutex); - mutex_unlock(_mutex); + unlock_modules(); /* Step 5: Kick optimizer again if needed */ if (!list_empty(_list) || !list_empty(_list)) diff --git a/kernel/module.c b/kernel/module.c index e0b12f7..1165d5d 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -95,8 +95,20 @@ * 2) module_use links, * 3) module_addr_min/module_addr_max. * (delete uses stop_machine/add uses RCU list operations). */ -DEFINE_MUTEX(module_mutex); -EXPORT_SYMBOL_GPL(module_mutex); +static DEFINE_MUTEX(module_mutex); + +void lock_modules(void) +{ + mutex_lock(_mutex); +} +EXPORT_SYMBOL(lock_modules); + +void unlock_modules(void) +{ + mutex_unlock(_mutex); +} +EXPORT_SYMBOL(unlock_modules); + static LIST_HEAD(modules); #ifdef CONFIG_KGDB_KDB struct list_head *kdb_modules = /* kdb needs the list of modules */ -- 1.7.7.6
[PATCH 56/60] gma500: remove the second argument of k[un]map_atomic()
Signed-off-by: Cong Wang --- drivers/gpu/drm/gma500/mmu.c | 30 +++--- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/gma500/mmu.c b/drivers/gpu/drm/gma500/mmu.c index c904d73..e80ee82 100644 --- a/drivers/gpu/drm/gma500/mmu.c +++ b/drivers/gpu/drm/gma500/mmu.c @@ -125,14 +125,14 @@ static void psb_page_clflush(struct psb_mmu_driver *driver, struct page* page) int i; uint8_t *clf; - clf = kmap_atomic(page, KM_USER0); + clf = kmap_atomic(page); mb(); for (i = 0; i < clflush_count; ++i) { psb_clflush(clf); clf += clflush_add; } mb(); - kunmap_atomic(clf, KM_USER0); + kunmap_atomic(clf); } static void psb_pages_clflush(struct psb_mmu_driver *driver, @@ -325,7 +325,7 @@ static struct psb_mmu_pt *psb_mmu_alloc_pt(struct psb_mmu_pd *pd) spin_lock(lock); - v = kmap_atomic(pt->p, KM_USER0); + v = kmap_atomic(pt->p); clf = (uint8_t *) v; ptes = (uint32_t *) v; for (i = 0; i < (PAGE_SIZE / sizeof(uint32_t)); ++i) @@ -341,7 +341,7 @@ static struct psb_mmu_pt *psb_mmu_alloc_pt(struct psb_mmu_pd *pd) mb(); } - kunmap_atomic(v, KM_USER0); + kunmap_atomic(v); spin_unlock(lock); pt->count = 0; @@ -376,18 +376,18 @@ struct psb_mmu_pt *psb_mmu_pt_alloc_map_lock(struct psb_mmu_pd *pd, continue; } - v = kmap_atomic(pd->p, KM_USER0); + v = kmap_atomic(pd->p); pd->tables[index] = pt; v[index] = (page_to_pfn(pt->p) << 12) | pd->pd_mask; pt->index = index; - kunmap_atomic((void *) v, KM_USER0); + kunmap_atomic((void *) v); if (pd->hw_context != -1) { psb_mmu_clflush(pd->driver, (void *) [index]); atomic_set(>driver->needs_tlbflush, 1); } } - pt->v = kmap_atomic(pt->p, KM_USER0); + pt->v = kmap_atomic(pt->p); return pt; } @@ -404,7 +404,7 @@ static struct psb_mmu_pt *psb_mmu_pt_map_lock(struct psb_mmu_pd *pd, spin_unlock(lock); return NULL; } - pt->v = kmap_atomic(pt->p, KM_USER0); + pt->v = kmap_atomic(pt->p); return pt; } @@ -413,9 +413,9 @@ static void psb_mmu_pt_unmap_unlock(struct psb_mmu_pt *pt) struct psb_mmu_pd *pd = pt->pd; uint32_t *v; - kunmap_atomic(pt->v, KM_USER0); + kunmap_atomic(pt->v); if (pt->count == 0) { - v = kmap_atomic(pd->p, KM_USER0); + v = kmap_atomic(pd->p); v[pt->index] = pd->invalid_pde; pd->tables[pt->index] = NULL; @@ -424,7 +424,7 @@ static void psb_mmu_pt_unmap_unlock(struct psb_mmu_pt *pt) (void *) [pt->index]); atomic_set(>driver->needs_tlbflush, 1); } - kunmap_atomic(pt->v, KM_USER0); + kunmap_atomic(pt->v); spin_unlock(>driver->lock); psb_mmu_free_pt(pt); return; @@ -457,7 +457,7 @@ void psb_mmu_mirror_gtt(struct psb_mmu_pd *pd, down_read(>sem); spin_lock(>lock); - v = kmap_atomic(pd->p, KM_USER0); + v = kmap_atomic(pd->p); v += start; while (gtt_pages--) { @@ -467,7 +467,7 @@ void psb_mmu_mirror_gtt(struct psb_mmu_pd *pd, /*ttm_tt_cache_flush(>p, num_pages);*/ psb_pages_clflush(pd->driver, >p, num_pages); - kunmap_atomic(v, KM_USER0); + kunmap_atomic(v); spin_unlock(>lock); if (pd->hw_context != -1) @@ -830,9 +830,9 @@ int psb_mmu_virtual_to_pfn(struct psb_mmu_pd *pd, uint32_t virtual, uint32_t *v; spin_lock(lock); - v = kmap_atomic(pd->p, KM_USER0); + v = kmap_atomic(pd->p); tmp = v[psb_mmu_pd_index(virtual)]; - kunmap_atomic(v, KM_USER0); + kunmap_atomic(v); spin_unlock(lock); if (tmp != pd->invalid_pde || !(tmp & PSB_PTE_VALID) || -- 1.7.7.6
[PATCH 14/60] drm: remove the second argument of k[un]map_atomic()
Signed-off-by: Cong Wang --- drivers/gpu/drm/drm_cache.c |8 drivers/gpu/drm/ttm/ttm_tt.c| 16 drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c |6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c index 5928653..4b8653b 100644 --- a/drivers/gpu/drm/drm_cache.c +++ b/drivers/gpu/drm/drm_cache.c @@ -41,10 +41,10 @@ drm_clflush_page(struct page *page) if (unlikely(page == NULL)) return; - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) clflush(page_virtual + i); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } static void drm_cache_flush_clflush(struct page *pages[], @@ -87,10 +87,10 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages) if (unlikely(page == NULL)) continue; - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); flush_dcache_range((unsigned long)page_virtual, (unsigned long)page_virtual + PAGE_SIZE); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } #else printk(KERN_ERR "Architecture has no drm_cache.c support\n"); diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 2f75d20..c10cf5e 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -309,11 +309,11 @@ int ttm_tt_swapin(struct ttm_tt *ttm) goto out_err; preempt_disable(); - from_virtual = kmap_atomic(from_page, KM_USER0); - to_virtual = kmap_atomic(to_page, KM_USER1); + from_virtual = kmap_atomic(from_page); + to_virtual = kmap_atomic(to_page); memcpy(to_virtual, from_virtual, PAGE_SIZE); - kunmap_atomic(to_virtual, KM_USER1); - kunmap_atomic(from_virtual, KM_USER0); + kunmap_atomic(to_virtual); + kunmap_atomic(from_virtual); preempt_enable(); page_cache_release(from_page); } @@ -365,11 +365,11 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage) goto out_err; } preempt_disable(); - from_virtual = kmap_atomic(from_page, KM_USER0); - to_virtual = kmap_atomic(to_page, KM_USER1); + from_virtual = kmap_atomic(from_page); + to_virtual = kmap_atomic(to_page); memcpy(to_virtual, from_virtual, PAGE_SIZE); - kunmap_atomic(to_virtual, KM_USER1); - kunmap_atomic(from_virtual, KM_USER0); + kunmap_atomic(to_virtual); + kunmap_atomic(from_virtual); preempt_enable(); set_page_dirty(to_page); mark_page_accessed(to_page); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c index f4e7763..51c9ba5 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c @@ -136,10 +136,10 @@ static int vmw_gmr_build_descriptors(struct list_head *desc_pages, if (likely(page_virtual != NULL)) { desc_virtual->ppn = page_to_pfn(page); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); desc_virtual = page_virtual - 1; prev_pfn = ~(0UL); @@ -169,7 +169,7 @@ static int vmw_gmr_build_descriptors(struct list_head *desc_pages, } if (likely(page_virtual != NULL)) - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); return 0; out_err: -- 1.7.7.6
[PATCH 14/60] drm: remove the second argument of k[un]map_atomic()
Signed-off-by: Cong Wang amw...@redhat.com --- drivers/gpu/drm/drm_cache.c |8 drivers/gpu/drm/ttm/ttm_tt.c| 16 drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c |6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c index 5928653..4b8653b 100644 --- a/drivers/gpu/drm/drm_cache.c +++ b/drivers/gpu/drm/drm_cache.c @@ -41,10 +41,10 @@ drm_clflush_page(struct page *page) if (unlikely(page == NULL)) return; - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); for (i = 0; i PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) clflush(page_virtual + i); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } static void drm_cache_flush_clflush(struct page *pages[], @@ -87,10 +87,10 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages) if (unlikely(page == NULL)) continue; - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); flush_dcache_range((unsigned long)page_virtual, (unsigned long)page_virtual + PAGE_SIZE); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } #else printk(KERN_ERR Architecture has no drm_cache.c support\n); diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 2f75d20..c10cf5e 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -309,11 +309,11 @@ int ttm_tt_swapin(struct ttm_tt *ttm) goto out_err; preempt_disable(); - from_virtual = kmap_atomic(from_page, KM_USER0); - to_virtual = kmap_atomic(to_page, KM_USER1); + from_virtual = kmap_atomic(from_page); + to_virtual = kmap_atomic(to_page); memcpy(to_virtual, from_virtual, PAGE_SIZE); - kunmap_atomic(to_virtual, KM_USER1); - kunmap_atomic(from_virtual, KM_USER0); + kunmap_atomic(to_virtual); + kunmap_atomic(from_virtual); preempt_enable(); page_cache_release(from_page); } @@ -365,11 +365,11 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage) goto out_err; } preempt_disable(); - from_virtual = kmap_atomic(from_page, KM_USER0); - to_virtual = kmap_atomic(to_page, KM_USER1); + from_virtual = kmap_atomic(from_page); + to_virtual = kmap_atomic(to_page); memcpy(to_virtual, from_virtual, PAGE_SIZE); - kunmap_atomic(to_virtual, KM_USER1); - kunmap_atomic(from_virtual, KM_USER0); + kunmap_atomic(to_virtual); + kunmap_atomic(from_virtual); preempt_enable(); set_page_dirty(to_page); mark_page_accessed(to_page); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c index f4e7763..51c9ba5 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c @@ -136,10 +136,10 @@ static int vmw_gmr_build_descriptors(struct list_head *desc_pages, if (likely(page_virtual != NULL)) { desc_virtual-ppn = page_to_pfn(page); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); desc_virtual = page_virtual - 1; prev_pfn = ~(0UL); @@ -169,7 +169,7 @@ static int vmw_gmr_build_descriptors(struct list_head *desc_pages, } if (likely(page_virtual != NULL)) - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); return 0; out_err: -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 56/60] gma500: remove the second argument of k[un]map_atomic()
Signed-off-by: Cong Wang amw...@redhat.com --- drivers/gpu/drm/gma500/mmu.c | 30 +++--- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/gma500/mmu.c b/drivers/gpu/drm/gma500/mmu.c index c904d73..e80ee82 100644 --- a/drivers/gpu/drm/gma500/mmu.c +++ b/drivers/gpu/drm/gma500/mmu.c @@ -125,14 +125,14 @@ static void psb_page_clflush(struct psb_mmu_driver *driver, struct page* page) int i; uint8_t *clf; - clf = kmap_atomic(page, KM_USER0); + clf = kmap_atomic(page); mb(); for (i = 0; i clflush_count; ++i) { psb_clflush(clf); clf += clflush_add; } mb(); - kunmap_atomic(clf, KM_USER0); + kunmap_atomic(clf); } static void psb_pages_clflush(struct psb_mmu_driver *driver, @@ -325,7 +325,7 @@ static struct psb_mmu_pt *psb_mmu_alloc_pt(struct psb_mmu_pd *pd) spin_lock(lock); - v = kmap_atomic(pt-p, KM_USER0); + v = kmap_atomic(pt-p); clf = (uint8_t *) v; ptes = (uint32_t *) v; for (i = 0; i (PAGE_SIZE / sizeof(uint32_t)); ++i) @@ -341,7 +341,7 @@ static struct psb_mmu_pt *psb_mmu_alloc_pt(struct psb_mmu_pd *pd) mb(); } - kunmap_atomic(v, KM_USER0); + kunmap_atomic(v); spin_unlock(lock); pt-count = 0; @@ -376,18 +376,18 @@ struct psb_mmu_pt *psb_mmu_pt_alloc_map_lock(struct psb_mmu_pd *pd, continue; } - v = kmap_atomic(pd-p, KM_USER0); + v = kmap_atomic(pd-p); pd-tables[index] = pt; v[index] = (page_to_pfn(pt-p) 12) | pd-pd_mask; pt-index = index; - kunmap_atomic((void *) v, KM_USER0); + kunmap_atomic((void *) v); if (pd-hw_context != -1) { psb_mmu_clflush(pd-driver, (void *) v[index]); atomic_set(pd-driver-needs_tlbflush, 1); } } - pt-v = kmap_atomic(pt-p, KM_USER0); + pt-v = kmap_atomic(pt-p); return pt; } @@ -404,7 +404,7 @@ static struct psb_mmu_pt *psb_mmu_pt_map_lock(struct psb_mmu_pd *pd, spin_unlock(lock); return NULL; } - pt-v = kmap_atomic(pt-p, KM_USER0); + pt-v = kmap_atomic(pt-p); return pt; } @@ -413,9 +413,9 @@ static void psb_mmu_pt_unmap_unlock(struct psb_mmu_pt *pt) struct psb_mmu_pd *pd = pt-pd; uint32_t *v; - kunmap_atomic(pt-v, KM_USER0); + kunmap_atomic(pt-v); if (pt-count == 0) { - v = kmap_atomic(pd-p, KM_USER0); + v = kmap_atomic(pd-p); v[pt-index] = pd-invalid_pde; pd-tables[pt-index] = NULL; @@ -424,7 +424,7 @@ static void psb_mmu_pt_unmap_unlock(struct psb_mmu_pt *pt) (void *) v[pt-index]); atomic_set(pd-driver-needs_tlbflush, 1); } - kunmap_atomic(pt-v, KM_USER0); + kunmap_atomic(pt-v); spin_unlock(pd-driver-lock); psb_mmu_free_pt(pt); return; @@ -457,7 +457,7 @@ void psb_mmu_mirror_gtt(struct psb_mmu_pd *pd, down_read(driver-sem); spin_lock(driver-lock); - v = kmap_atomic(pd-p, KM_USER0); + v = kmap_atomic(pd-p); v += start; while (gtt_pages--) { @@ -467,7 +467,7 @@ void psb_mmu_mirror_gtt(struct psb_mmu_pd *pd, /*ttm_tt_cache_flush(pd-p, num_pages);*/ psb_pages_clflush(pd-driver, pd-p, num_pages); - kunmap_atomic(v, KM_USER0); + kunmap_atomic(v); spin_unlock(driver-lock); if (pd-hw_context != -1) @@ -830,9 +830,9 @@ int psb_mmu_virtual_to_pfn(struct psb_mmu_pd *pd, uint32_t virtual, uint32_t *v; spin_lock(lock); - v = kmap_atomic(pd-p, KM_USER0); + v = kmap_atomic(pd-p); tmp = v[psb_mmu_pd_index(virtual)]; - kunmap_atomic(v, KM_USER0); + kunmap_atomic(v); spin_unlock(lock); if (tmp != pd-invalid_pde || !(tmp PSB_PTE_VALID) || -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 14/62] drm: remove the second argument of k[un]map_atomic()
Signed-off-by: Cong Wang amw...@redhat.com --- drivers/gpu/drm/drm_cache.c |8 drivers/gpu/drm/ttm/ttm_tt.c| 16 drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c |6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c index 5928653..4b8653b 100644 --- a/drivers/gpu/drm/drm_cache.c +++ b/drivers/gpu/drm/drm_cache.c @@ -41,10 +41,10 @@ drm_clflush_page(struct page *page) if (unlikely(page == NULL)) return; - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); for (i = 0; i PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) clflush(page_virtual + i); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } static void drm_cache_flush_clflush(struct page *pages[], @@ -87,10 +87,10 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages) if (unlikely(page == NULL)) continue; - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); flush_dcache_range((unsigned long)page_virtual, (unsigned long)page_virtual + PAGE_SIZE); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } #else printk(KERN_ERR Architecture has no drm_cache.c support\n); diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index f9cc548..ec27fb9 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -496,11 +496,11 @@ static int ttm_tt_swapin(struct ttm_tt *ttm) goto out_err; preempt_disable(); - from_virtual = kmap_atomic(from_page, KM_USER0); - to_virtual = kmap_atomic(to_page, KM_USER1); + from_virtual = kmap_atomic(from_page); + to_virtual = kmap_atomic(to_page); memcpy(to_virtual, from_virtual, PAGE_SIZE); - kunmap_atomic(to_virtual, KM_USER1); - kunmap_atomic(from_virtual, KM_USER0); + kunmap_atomic(to_virtual); + kunmap_atomic(from_virtual); preempt_enable(); page_cache_release(from_page); } @@ -565,11 +565,11 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage) goto out_err; } preempt_disable(); - from_virtual = kmap_atomic(from_page, KM_USER0); - to_virtual = kmap_atomic(to_page, KM_USER1); + from_virtual = kmap_atomic(from_page); + to_virtual = kmap_atomic(to_page); memcpy(to_virtual, from_virtual, PAGE_SIZE); - kunmap_atomic(to_virtual, KM_USER1); - kunmap_atomic(from_virtual, KM_USER0); + kunmap_atomic(to_virtual); + kunmap_atomic(from_virtual); preempt_enable(); set_page_dirty(to_page); mark_page_accessed(to_page); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c index f4e7763..51c9ba5 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c @@ -136,10 +136,10 @@ static int vmw_gmr_build_descriptors(struct list_head *desc_pages, if (likely(page_virtual != NULL)) { desc_virtual-ppn = page_to_pfn(page); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); desc_virtual = page_virtual - 1; prev_pfn = ~(0UL); @@ -169,7 +169,7 @@ static int vmw_gmr_build_descriptors(struct list_head *desc_pages, } if (likely(page_virtual != NULL)) - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); return 0; out_err: -- 1.7.4.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 14/62] drm: remove the second argument of k[un]map_atomic()
Signed-off-by: Cong Wang --- drivers/gpu/drm/drm_cache.c |8 drivers/gpu/drm/ttm/ttm_tt.c| 16 drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c |6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c index 5928653..4b8653b 100644 --- a/drivers/gpu/drm/drm_cache.c +++ b/drivers/gpu/drm/drm_cache.c @@ -41,10 +41,10 @@ drm_clflush_page(struct page *page) if (unlikely(page == NULL)) return; - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) clflush(page_virtual + i); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } static void drm_cache_flush_clflush(struct page *pages[], @@ -87,10 +87,10 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages) if (unlikely(page == NULL)) continue; - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); flush_dcache_range((unsigned long)page_virtual, (unsigned long)page_virtual + PAGE_SIZE); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } #else printk(KERN_ERR "Architecture has no drm_cache.c support\n"); diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index f9cc548..ec27fb9 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -496,11 +496,11 @@ static int ttm_tt_swapin(struct ttm_tt *ttm) goto out_err; preempt_disable(); - from_virtual = kmap_atomic(from_page, KM_USER0); - to_virtual = kmap_atomic(to_page, KM_USER1); + from_virtual = kmap_atomic(from_page); + to_virtual = kmap_atomic(to_page); memcpy(to_virtual, from_virtual, PAGE_SIZE); - kunmap_atomic(to_virtual, KM_USER1); - kunmap_atomic(from_virtual, KM_USER0); + kunmap_atomic(to_virtual); + kunmap_atomic(from_virtual); preempt_enable(); page_cache_release(from_page); } @@ -565,11 +565,11 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage) goto out_err; } preempt_disable(); - from_virtual = kmap_atomic(from_page, KM_USER0); - to_virtual = kmap_atomic(to_page, KM_USER1); + from_virtual = kmap_atomic(from_page); + to_virtual = kmap_atomic(to_page); memcpy(to_virtual, from_virtual, PAGE_SIZE); - kunmap_atomic(to_virtual, KM_USER1); - kunmap_atomic(from_virtual, KM_USER0); + kunmap_atomic(to_virtual); + kunmap_atomic(from_virtual); preempt_enable(); set_page_dirty(to_page); mark_page_accessed(to_page); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c index f4e7763..51c9ba5 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c @@ -136,10 +136,10 @@ static int vmw_gmr_build_descriptors(struct list_head *desc_pages, if (likely(page_virtual != NULL)) { desc_virtual->ppn = page_to_pfn(page); - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); } - page_virtual = kmap_atomic(page, KM_USER0); + page_virtual = kmap_atomic(page); desc_virtual = page_virtual - 1; prev_pfn = ~(0UL); @@ -169,7 +169,7 @@ static int vmw_gmr_build_descriptors(struct list_head *desc_pages, } if (likely(page_virtual != NULL)) - kunmap_atomic(page_virtual, KM_USER0); + kunmap_atomic(page_virtual); return 0; out_err: -- 1.7.4.4
[PATCH] drm: add missing header file
? 2011?08?09? 21:32, Alex Deucher ??: > On Mon, Aug 8, 2011 at 3:22 AM, Amerigo Wang wrote: >> This patch fixes the following 'make headers_check' errors: >> >> linux-2.6/usr/include/drm/drm_mode.h:85: found __[us]{8,16,32,64} type >> without #include >> linux-2.6/usr/include/drm/i915_drm.h:120: found __[us]{8,16,32,64} type >> without #include >> linux-2.6/usr/include/drm/mga_drm.h:260: found __[us]{8,16,32,64} type >> without #include >> linux-2.6/usr/include/drm/radeon_drm.h:758: found __[us]{8,16,32,64} type >> without #include >> linux-2.6/usr/include/drm/via_drm.h:117: found __[us]{8,16,32,64} type >> without #include >> > > These files are shared with BSD, and they get the linux/types.h from drm.h. > Thanks, then these warnings should be bogus.
Re: [PATCH] drm: add missing header file linuc/types.h
于 2011年08月09日 21:32, Alex Deucher 写道: On Mon, Aug 8, 2011 at 3:22 AM, Amerigo Wangamw...@redhat.com wrote: This patch fixes the following 'make headers_check' errors: linux-2.6/usr/include/drm/drm_mode.h:85: found __[us]{8,16,32,64} type without #includelinux/types.h linux-2.6/usr/include/drm/i915_drm.h:120: found __[us]{8,16,32,64} type without #includelinux/types.h linux-2.6/usr/include/drm/mga_drm.h:260: found __[us]{8,16,32,64} type without #includelinux/types.h linux-2.6/usr/include/drm/radeon_drm.h:758: found __[us]{8,16,32,64} type without #includelinux/types.h linux-2.6/usr/include/drm/via_drm.h:117: found __[us]{8,16,32,64} type without #includelinux/types.h These files are shared with BSD, and they get the linux/types.h from drm.h. Thanks, then these warnings should be bogus. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel