Re: [PATCH 2/7] staging/android: display sync_pt name on debugfs
Op 20-06-16 om 17:53 schreef Gustavo Padovan: > From: Gustavo Padovan > > When creating a sync_pt the name received wasn't used anywhere. > Now we add it to the sync info debug output to make it easier to indetify > the userspace name of that sync pt. > > Signed-off-by: Gustavo Padovan > --- > drivers/staging/android/sw_sync.c| 16 > drivers/staging/android/sync_debug.c | 5 +++-- > drivers/staging/android/sync_debug.h | 9 + > 3 files changed, 16 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/android/sw_sync.c > b/drivers/staging/android/sw_sync.c > index b4ae092..ea27512 100644 > --- a/drivers/staging/android/sw_sync.c > +++ b/drivers/staging/android/sw_sync.c > @@ -37,15 +37,6 @@ struct sw_sync_create_fence_data { > struct sw_sync_create_fence_data) > #define SW_SYNC_IOC_INC _IOW(SW_SYNC_IOC_MAGIC, 1, > __u32) > > -static const struct fence_ops timeline_fence_ops; > - > -static inline struct sync_pt *fence_to_sync_pt(struct fence *fence) > -{ > - if (fence->ops != &timeline_fence_ops) > - return NULL; > - return container_of(fence, struct sync_pt, base); > -} > - > struct sync_timeline *sync_timeline_create(const char *name) > { > struct sync_timeline *obj; > @@ -108,7 +99,7 @@ static void sync_timeline_signal(struct sync_timeline > *obj, unsigned int inc) > } > > static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size, > - unsigned int value) > + unsigned int value, char *name) > { > unsigned long flags; > struct sync_pt *pt; > @@ -120,6 +111,7 @@ static struct sync_pt *sync_pt_create(struct > sync_timeline *obj, int size, > if (!pt) > return NULL; > > + strlcpy(pt->name, name, sizeof(pt->name)); > spin_lock_irqsave(&obj->child_list_lock, flags); > sync_timeline_get(obj); > fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock, > @@ -191,7 +183,7 @@ static void timeline_fence_timeline_value_str(struct > fence *fence, > snprintf(str, size, "%d", parent->value); > } > > -static const struct fence_ops timeline_fence_ops = { > +const struct fence_ops timeline_fence_ops = { > .get_driver_name = timeline_fence_get_driver_name, > .get_timeline_name = timeline_fence_get_timeline_name, > .enable_signaling = timeline_fence_enable_signaling, > @@ -252,7 +244,7 @@ static long sw_sync_ioctl_create_fence(struct > sync_timeline *obj, > goto err; > } > > - pt = sync_pt_create(obj, sizeof(*pt), data.value); > + pt = sync_pt_create(obj, sizeof(*pt), data.value, data.name); > if (!pt) { > err = -ENOMEM; > goto err; > diff --git a/drivers/staging/android/sync_debug.c > b/drivers/staging/android/sync_debug.c > index 4c5a855..b732ea3 100644 > --- a/drivers/staging/android/sync_debug.c > +++ b/drivers/staging/android/sync_debug.c > @@ -75,13 +75,14 @@ static void sync_print_fence(struct seq_file *s, struct > fence *fence, bool show) > { > int status = 1; > struct sync_timeline *parent = fence_parent(fence); > + struct sync_pt *pt = fence_to_sync_pt(fence); > > if (fence_is_signaled_locked(fence)) > status = fence->status; > > - seq_printf(s, " %s%sfence %s", > + seq_printf(s, " %s%sfence %s %s", > show ? parent->name : "", > -show ? "_" : "", > +show ? "_" : "", pt->name, > sync_status_str(status)); > NAK, A fence in sync_print_fence can be of any type. If you want to print the name, use the fence_value_str callback. ~Maarten ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/4] Drivers: hv: balloon: account for gaps in hot add regions
"Alex Ng (LIS)" writes: >> -Original Message- >> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] >> Sent: Friday, August 5, 2016 3:49 AM >> To: de...@linuxdriverproject.org >> Cc: linux-ker...@vger.kernel.org; Haiyang Zhang ; >> KY Srinivasan ; Alex Ng (LIS) >> Subject: [PATCH 2/4] Drivers: hv: balloon: account for gaps in hot add >> regions >> >> I'm observing the following hot add requests from the WS2012 host: >> >> hot_add_req: start_pfn = 0x108200 count = 330752 >> hot_add_req: start_pfn = 0x158e00 count = 193536 >> hot_add_req: start_pfn = 0x188400 count = 239616 >> >> As the host doesn't specify hot add regions we're trying to create 128Mb- >> aligned region covering the first request, we create the 0x108000 - >> 0x16 region and we add 0x108000 - 0x158e00 memory. The second >> request passes the pfn_covered() check, we enlarge the region to 0x108000 - >> 0x19 and add 0x158e00 - 0x188200 memory. The problem emerges with >> the third request as it starts at 0x188400 so there is a 0x200 gap which is >> not >> covered. As the end of our region is 0x19 now it again passes the >> pfn_covered() check were we just adjust the covered_end_pfn and make it >> 0x188400 instead of 0x188200 which means that we'll try to online >> 0x188200-0x188400 pages but these pages were never assigned to us and we >> crash. > > The fact that the host sent a request that's non-contiguous with the previous > request is unexpected. Could we check to see the number of pages we returned > in our response, after each request? > > I'm wondering if we may have given a wrong response to cause the host to > follow-up with a gapped request. It seems it is not the case, here is the recorded session (address format is hex, count is decimal): [ 66.851401] DM: hot_add_req: 108200 303104 0 0 -> we were asked to add 303104 pages ... [ 66.854420] DM: handle_pg_range: 108200 303104 [ 84.489291] DM: handle_pg_range: return 303104 [ 84.492498] DM: hot_add_req: ret 303104 -> and we returned '303104' [ 131.934542] DM: hot_add_req: 152200 221184 0 0 -> we were asked to add 221184 pages ... [ 131.937495] DM: handle_pg_range: 152200 221184 [ 132.720390] DM: handle_pg_range: return 221184 [ 132.722953] DM: hot_add_req: ret 221184 -> and we returned '221184' [ 132.958045] DM: hot_add_req: 188400 409088 0 0 -> and here we were asked to add pages with a gap (0x108200 + 303104 + 221184 = 0x188200 but as you can see the new range starts at 0x188400) [ 132.961409] DM: handle_pg_range: 188400 409088 [ 134.012555] DM: handle_pg_range: return 409088 [ 134.013862] DM: hot_add_req: ret 409088 so I don't see a flaw on Linux side ... -- Vitaly ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RESEND][PATCH 0/5] Ion cleanup
I never saw any feedback or action on these patches so this is a resend. Probably hit the window when everyone was busy/traveling. --- Hi, This is some clean up of old Ion interfaces and APIs. These are interfaces that mostly existed before dma_buf was well integrated into the kernel along with reservations for board files. If there are objections to deletion I expect it to turn into a discussion about what other APIs need to be extended. Thanks, Laura Laura Abbott (5): staging: android: ion: Get rid of ion_sg_table staging: android: ion: Drop ion_phys interface staging: android: ion: Get rid of map_dma/unmap_dma staging: android: ion: Drop ion_carveout_allocate definitions staging: android: ion: Get rid of ion_reserve drivers/staging/android/ion/ion.c | 103 ++-- drivers/staging/android/ion/ion.h | 41 -- drivers/staging/android/ion/ion_carveout_heap.c | 33 +--- drivers/staging/android/ion/ion_chunk_heap.c| 17 +--- drivers/staging/android/ion/ion_cma_heap.c | 34 +--- drivers/staging/android/ion/ion_priv.h | 30 +-- drivers/staging/android/ion/ion_system_heap.c | 44 +- 7 files changed, 19 insertions(+), 283 deletions(-) -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RESEND][PATCH 2/5] staging: android: ion: Drop ion_phys interface
ion_phys was an interface used for older legacy behavior. sg_tables are the standard now. Get rid of it. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 26 - drivers/staging/android/ion/ion.h | 19 -- drivers/staging/android/ion/ion_carveout_heap.c | 14 - drivers/staging/android/ion/ion_cma_heap.c | 18 - drivers/staging/android/ion/ion_priv.h | 11 +-- drivers/staging/android/ion/ion_system_heap.c | 12 6 files changed, 1 insertion(+), 99 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 95b18ac..bcf113f 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -576,32 +576,6 @@ void ion_free(struct ion_client *client, struct ion_handle *handle) } EXPORT_SYMBOL(ion_free); -int ion_phys(struct ion_client *client, struct ion_handle *handle, -ion_phys_addr_t *addr, size_t *len) -{ - struct ion_buffer *buffer; - int ret; - - mutex_lock(&client->lock); - if (!ion_handle_validate(client, handle)) { - mutex_unlock(&client->lock); - return -EINVAL; - } - - buffer = handle->buffer; - - if (!buffer->heap->ops->phys) { - pr_err("%s: ion_phys is not implemented by this heap (name=%s, type=%d).\n", - __func__, buffer->heap->name, buffer->heap->type); - mutex_unlock(&client->lock); - return -ENODEV; - } - mutex_unlock(&client->lock); - ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len); - return ret; -} -EXPORT_SYMBOL(ion_phys); - static void *ion_buffer_kmap_get(struct ion_buffer *buffer) { void *vaddr; diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h index 225c34a..97eb7a7 100644 --- a/drivers/staging/android/ion/ion.h +++ b/drivers/staging/android/ion/ion.h @@ -130,25 +130,6 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len, void ion_free(struct ion_client *client, struct ion_handle *handle); /** - * ion_phys - returns the physical address and len of a handle - * @client:the client - * @handle:the handle - * @addr: a pointer to put the address in - * @len: a pointer to put the length in - * - * This function queries the heap for a particular handle to get the - * handle's physical address. It't output is only correct if - * a heap returns physically contiguous memory -- in other cases - * this api should not be implemented -- ion_sg_table should be used - * instead. Returns -EINVAL if the handle is invalid. This has - * no implications on the reference counting of the handle -- - * the returned value may not be valid if the caller is not - * holding a reference. - */ -int ion_phys(struct ion_client *client, struct ion_handle *handle, -ion_phys_addr_t *addr, size_t *len); - -/** * ion_map_kernel - create mapping for the given handle * @client:the client * @handle:handle to map diff --git a/drivers/staging/android/ion/ion_carveout_heap.c b/drivers/staging/android/ion/ion_carveout_heap.c index 1fb0d81..25b969b 100644 --- a/drivers/staging/android/ion/ion_carveout_heap.c +++ b/drivers/staging/android/ion/ion_carveout_heap.c @@ -56,19 +56,6 @@ void ion_carveout_free(struct ion_heap *heap, ion_phys_addr_t addr, gen_pool_free(carveout_heap->pool, addr, size); } -static int ion_carveout_heap_phys(struct ion_heap *heap, - struct ion_buffer *buffer, - ion_phys_addr_t *addr, size_t *len) -{ - struct sg_table *table = buffer->priv_virt; - struct page *page = sg_page(table->sgl); - ion_phys_addr_t paddr = PFN_PHYS(page_to_pfn(page)); - - *addr = paddr; - *len = buffer->size; - return 0; -} - static int ion_carveout_heap_allocate(struct ion_heap *heap, struct ion_buffer *buffer, unsigned long size, unsigned long align, @@ -138,7 +125,6 @@ static void ion_carveout_heap_unmap_dma(struct ion_heap *heap, static struct ion_heap_ops carveout_heap_ops = { .allocate = ion_carveout_heap_allocate, .free = ion_carveout_heap_free, - .phys = ion_carveout_heap_phys, .map_dma = ion_carveout_heap_map_dma, .unmap_dma = ion_carveout_heap_unmap_dma, .map_user = ion_heap_map_user, diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c index a3446da..0828e33 100644 --- a/drivers/staging/android/ion/ion_cma_heap.c +++ b/drivers/staging/android/ion/ion_cma_heap.c @@ -105,23 +105,6 @@ static void ion_cma_free(struct ion_buffer *buffer) kfree(info); } -/* return physical address in addr */ -static int ion_cma_phys(struct io
[RESEND][PATCH 3/5] staging: android: ion: Get rid of map_dma/unmap_dma
The map_dma API interface was designed to generate an sg_table. Currently, every client just creates the table at allocation time and then returns the one table. Nothing happens on unmap_dma either. Just get rid of the API and assign the sg_table directly. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 23 +++--- drivers/staging/android/ion/ion_carveout_heap.c | 17 ++--- drivers/staging/android/ion/ion_chunk_heap.c| 17 ++--- drivers/staging/android/ion/ion_cma_heap.c | 16 + drivers/staging/android/ion/ion_priv.h | 5 drivers/staging/android/ion/ion_system_heap.c | 32 +++-- 6 files changed, 16 insertions(+), 94 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index bcf113f..cd73082 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -205,19 +205,16 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, goto err2; } - buffer->dev = dev; - buffer->size = len; - - table = heap->ops->map_dma(heap, buffer); - if (WARN_ONCE(table == NULL, - "heap->ops->map_dma should return ERR_PTR on error")) - table = ERR_PTR(-EINVAL); - if (IS_ERR(table)) { + if (buffer->sg_table == NULL) { + WARN_ONCE(1, "This heap needs to set the sgtable"); ret = -EINVAL; goto err1; } - buffer->sg_table = table; + table = buffer->sg_table; + buffer->dev = dev; + buffer->size = len; + if (ion_buffer_fault_user_mappings(buffer)) { int num_pages = PAGE_ALIGN(buffer->size) / PAGE_SIZE; struct scatterlist *sg; @@ -226,7 +223,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, buffer->pages = vmalloc(sizeof(struct page *) * num_pages); if (!buffer->pages) { ret = -ENOMEM; - goto err; + goto err1; } for_each_sg(table->sgl, sg, table->nents, i) { @@ -260,8 +257,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, mutex_unlock(&dev->buffer_lock); return buffer; -err: - heap->ops->unmap_dma(heap, buffer); err1: heap->ops->free(buffer); err2: @@ -273,7 +268,6 @@ void ion_buffer_destroy(struct ion_buffer *buffer) { if (WARN_ON(buffer->kmap_cnt > 0)) buffer->heap->ops->unmap_kernel(buffer->heap, buffer); - buffer->heap->ops->unmap_dma(buffer->heap, buffer); buffer->heap->ops->free(buffer); vfree(buffer->pages); kfree(buffer); @@ -1542,8 +1536,7 @@ void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap) { struct dentry *debug_file; - if (!heap->ops->allocate || !heap->ops->free || !heap->ops->map_dma || - !heap->ops->unmap_dma) + if (!heap->ops->allocate || !heap->ops->free) pr_err("%s: can not add heap with invalid ops struct.\n", __func__); diff --git a/drivers/staging/android/ion/ion_carveout_heap.c b/drivers/staging/android/ion/ion_carveout_heap.c index 25b969b..cc2a3b8 100644 --- a/drivers/staging/android/ion/ion_carveout_heap.c +++ b/drivers/staging/android/ion/ion_carveout_heap.c @@ -82,7 +82,7 @@ static int ion_carveout_heap_allocate(struct ion_heap *heap, } sg_set_page(table->sgl, pfn_to_page(PFN_DOWN(paddr)), size, 0); - buffer->priv_virt = table; + buffer->sg_table = table; return 0; @@ -96,7 +96,7 @@ err_free: static void ion_carveout_heap_free(struct ion_buffer *buffer) { struct ion_heap *heap = buffer->heap; - struct sg_table *table = buffer->priv_virt; + struct sg_table *table = buffer->sg_table; struct page *page = sg_page(table->sgl); ion_phys_addr_t paddr = PFN_PHYS(page_to_pfn(page)); @@ -111,22 +111,9 @@ static void ion_carveout_heap_free(struct ion_buffer *buffer) kfree(table); } -static struct sg_table *ion_carveout_heap_map_dma(struct ion_heap *heap, - struct ion_buffer *buffer) -{ - return buffer->priv_virt; -} - -static void ion_carveout_heap_unmap_dma(struct ion_heap *heap, - struct ion_buffer *buffer) -{ -} - static struct ion_heap_ops carveout_heap_ops = { .allocate = ion_carveout_heap_allocate, .free = ion_carveout_heap_free, - .map_dma = ion_carveout_heap_map_dma, - .unmap_dma = ion_carveout_heap_unmap_dma, .map_user = ion_heap_map_user, .map_kernel = ion_heap_map_kernel, .unmap_kernel = ion_heap_unmap_kernel, diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/androi
[RESEND][PATCH 1/5] staging: android: ion: Get rid of ion_sg_table
The ion_sg_table interface is mostly a reimplementation of what dma_buf is doing. Clients should be using dma_buf APIs instead. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 20 drivers/staging/android/ion/ion.h | 11 --- 2 files changed, 31 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index a2cf93b..95b18ac 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -917,26 +917,6 @@ void ion_client_destroy(struct ion_client *client) } EXPORT_SYMBOL(ion_client_destroy); -struct sg_table *ion_sg_table(struct ion_client *client, - struct ion_handle *handle) -{ - struct ion_buffer *buffer; - struct sg_table *table; - - mutex_lock(&client->lock); - if (!ion_handle_validate(client, handle)) { - pr_err("%s: invalid handle passed to map_dma.\n", - __func__); - mutex_unlock(&client->lock); - return ERR_PTR(-EINVAL); - } - buffer = handle->buffer; - table = buffer->sg_table; - mutex_unlock(&client->lock); - return table; -} -EXPORT_SYMBOL(ion_sg_table); - static void ion_buffer_sync_for_device(struct ion_buffer *buffer, struct device *dev, enum dma_data_direction direction); diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h index a1331fc..225c34a 100644 --- a/drivers/staging/android/ion/ion.h +++ b/drivers/staging/android/ion/ion.h @@ -149,17 +149,6 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle, ion_phys_addr_t *addr, size_t *len); /** - * ion_map_dma - return an sg_table describing a handle - * @client:the client - * @handle:the handle - * - * This function returns the sg_table describing - * a particular ion handle. - */ -struct sg_table *ion_sg_table(struct ion_client *client, - struct ion_handle *handle); - -/** * ion_map_kernel - create mapping for the given handle * @client:the client * @handle:handle to map -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RESEND][PATCH 4/5] staging: android: ion: Drop ion_carveout_allocate definitions
ion_carveout_allocate and ion_carveout_free aren't used outside of the carveout heap. Get rid of the definitions. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion_carveout_heap.c | 2 ++ drivers/staging/android/ion/ion_priv.h | 14 -- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/staging/android/ion/ion_carveout_heap.c b/drivers/staging/android/ion/ion_carveout_heap.c index cc2a3b8..c4f0795 100644 --- a/drivers/staging/android/ion/ion_carveout_heap.c +++ b/drivers/staging/android/ion/ion_carveout_heap.c @@ -25,6 +25,8 @@ #include "ion.h" #include "ion_priv.h" +#define ION_CARVEOUT_ALLOCATE_FAIL -1 + struct ion_carveout_heap { struct ion_heap heap; struct gen_pool *pool; diff --git a/drivers/staging/android/ion/ion_priv.h b/drivers/staging/android/ion/ion_priv.h index 3dd9117..25e4bb2 100644 --- a/drivers/staging/android/ion/ion_priv.h +++ b/drivers/staging/android/ion/ion_priv.h @@ -314,20 +314,6 @@ struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *); void ion_cma_heap_destroy(struct ion_heap *); /** - * kernel api to allocate/free from carveout -- used when carveout is - * used to back an architecture specific custom heap - */ -ion_phys_addr_t ion_carveout_allocate(struct ion_heap *heap, unsigned long size, - unsigned long align); -void ion_carveout_free(struct ion_heap *heap, ion_phys_addr_t addr, - unsigned long size); -/** - * The carveout heap returns physical addresses, since 0 may be a valid - * physical address, this is used to indicate allocation failed - */ -#define ION_CARVEOUT_ALLOCATE_FAIL -1 - -/** * functions for creating and destroying a heap pool -- allows you * to keep a pool of pre allocated memory to use from your heap. Keeping * a pool of memory that is ready for dma, ie any cached mapping have been -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RESEND][PATCH 5/5] staging: android: ion: Get rid of ion_reserve
ion_reserve was supposed to be used to reserve memory in board files. These days, board files are no more and there are other more controlled mechanisms for reserving memory. Get rid of this function. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 34 -- drivers/staging/android/ion/ion.h | 11 --- 2 files changed, 45 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index cd73082..7138a5b 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1650,37 +1650,3 @@ void ion_device_destroy(struct ion_device *dev) } EXPORT_SYMBOL(ion_device_destroy); -void __init ion_reserve(struct ion_platform_data *data) -{ - int i; - - for (i = 0; i < data->nr; i++) { - if (data->heaps[i].size == 0) - continue; - - if (data->heaps[i].base == 0) { - phys_addr_t paddr; - - paddr = memblock_alloc_base(data->heaps[i].size, - data->heaps[i].align, - MEMBLOCK_ALLOC_ANYWHERE); - if (!paddr) { - pr_err("%s: error allocating memblock for heap %d\n", - __func__, i); - continue; - } - data->heaps[i].base = paddr; - } else { - int ret = memblock_reserve(data->heaps[i].base, - data->heaps[i].size); - if (ret) - pr_err("memblock reserve of %zx@%lx failed\n", - data->heaps[i].size, - data->heaps[i].base); - } - pr_info("%s: %s reserved base %lx size %zu\n", __func__, - data->heaps[i].name, - data->heaps[i].base, - data->heaps[i].size); - } -} diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h index 97eb7a7..93dafb4 100644 --- a/drivers/staging/android/ion/ion.h +++ b/drivers/staging/android/ion/ion.h @@ -73,17 +73,6 @@ struct ion_platform_data { }; /** - * ion_reserve() - reserve memory for ion heaps if applicable - * @data: platform data specifying starting physical address and - * size - * - * Calls memblock reserve to set aside memory for heaps that are - * located at specific memory addresses or of specific sizes not - * managed by the kernel - */ -void ion_reserve(struct ion_platform_data *data); - -/** * ion_client_create() - allocate a client and returns it * @dev: the global ion device * @name: used for debugging -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: wlan-ng: removed unused code
This patch removes unused code from wlan-ng driver. Signed-off-by: Claudiu Beznea --- drivers/staging/wlan-ng/p80211types.h | 43 --- 1 file changed, 43 deletions(-) diff --git a/drivers/staging/wlan-ng/p80211types.h b/drivers/staging/wlan-ng/p80211types.h index 8cb4fc6..256c742 100644 --- a/drivers/staging/wlan-ng/p80211types.h +++ b/drivers/staging/wlan-ng/p80211types.h @@ -205,20 +205,11 @@ typedef struct p80211enumpair { char *name; } p80211enumpair_t; -typedef struct p80211enum { - int nitems; - p80211enumpair_t *list; -} p80211enum_t; - /**/ /* The following structure types are used to store data items in */ /* messages. */ /* Template pascal string */ -typedef struct p80211pstr { - u8 len; -} __packed p80211pstr_t; - typedef struct p80211pstrd { u8 len; u8 data[0]; @@ -301,14 +292,6 @@ typedef struct p80211item_pstr32 { p80211pstr32_t data; } __packed p80211item_pstr32_t; -/* message data item for OCTETSTR, DISPLAYSTR */ -typedef struct p80211item_pstr255 { - u32 did; - u16 status; - u16 len; - p80211pstr255_t data; -} __packed p80211item_pstr255_t; - /* message data item for UNK 392, namely mib items */ typedef struct p80211item_unk392 { u32 did; @@ -346,30 +329,4 @@ typedef void (*p80211_fromtext_t) (struct catlistitem *, u32 did, u8 *itembuf, char *textbuf); typedef u32(*p80211_valid_t) (struct catlistitem *, u32 did, u8 *itembuf); -/**/ -/* Enumeration Lists */ -/* The following are the external declarations */ -/* for all enumerations */ - -extern p80211enum_t MKENUMNAME(truth); -extern p80211enum_t MKENUMNAME(ifstate); -extern p80211enum_t MKENUMNAME(powermgmt); -extern p80211enum_t MKENUMNAME(bsstype); -extern p80211enum_t MKENUMNAME(authalg); -extern p80211enum_t MKENUMNAME(phytype); -extern p80211enum_t MKENUMNAME(temptype); -extern p80211enum_t MKENUMNAME(regdomain); -extern p80211enum_t MKENUMNAME(ccamode); -extern p80211enum_t MKENUMNAME(diversity); -extern p80211enum_t MKENUMNAME(scantype); -extern p80211enum_t MKENUMNAME(resultcode); -extern p80211enum_t MKENUMNAME(reason); -extern p80211enum_t MKENUMNAME(status); -extern p80211enum_t MKENUMNAME(msgcode); -extern p80211enum_t MKENUMNAME(msgitem_status); - -extern p80211enum_t MKENUMNAME(lnxroam_reason); - -extern p80211enum_t MKENUMNAME(p2preamble); - #endif /* _P80211TYPES_H */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFCv2][PATCH 0/5] Cleanup Ion mapping/caching
Hi, This is v2 on the attempt to remove misuse of the cache APIs from Ion. The previous version[1] attempted to pull the cache APIs into Ion. This was indicated as the wrong approach and real APIs should be created instead. The APIs created are kernel_force_cache_clean and kernel_force_cache_invalidate. They force a clean and invalidate of the cache, respectively. The aim was to take the semantics of dma_sync and turn them into something that isn't dma_sync. This series includes a nominal implementation for arm/arm64, mostly for demonstration purposes. I did review before writing this of whether Ion could just use the DMA mapping APIs to acheive the necessary coherency. The conclusion I came to was that trying to force the Ion code into the DMA model would create more problem than it solved since there wasn't anything like DMA going on. Similarly, none of the existing cache APIs did exactly what was needed either. The closest matches were designed for file cache pages and not drivers. The series includes conversion of Ion to the new APIs. There are a few other drivers which are calling either arch specific APIs or flush_dcache_page that could be converted as well. The i915 driver could potentially be converted with the addition of an x86 implementation. Feedback appreciated as always. Thanks, Laura [1] https://lkml.kernel.org/g/<1464205684-5587-1-git-send-email-labb...@redhat.com> Laura Abbott (5): Documentation: Introduce kernel_force_cache_* APIs arm: Implement ARCH_HAS_FORCE_CACHE arm64: Implement ARCH_HAS_FORCE_CACHE staging: android: ion: Convert to the kernel_force_cache APIs staging: ion: Add support for syncing with DMA_BUF_IOCTL_SYNC Documentation/cachetlb.txt | 18 +++- arch/arm/include/asm/cacheflush.h | 4 + arch/arm/mm/dma-mapping.c | 119 arch/arm/mm/flush.c | 115 +++ arch/arm/mm/mm.h| 8 ++ arch/arm64/include/asm/cacheflush.h | 5 + arch/arm64/mm/flush.c | 11 +++ drivers/staging/android/ion/ion.c | 53 +++ drivers/staging/android/ion/ion_carveout_heap.c | 8 +- drivers/staging/android/ion/ion_chunk_heap.c| 12 ++- drivers/staging/android/ion/ion_page_pool.c | 6 +- drivers/staging/android/ion/ion_priv.h | 11 --- drivers/staging/android/ion/ion_system_heap.c | 6 +- include/linux/cacheflush.h | 11 +++ 14 files changed, 225 insertions(+), 162 deletions(-) create mode 100644 include/linux/cacheflush.h -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFCv2][PATCH 2/5] arm: Implement ARCH_HAS_FORCE_CACHE
arm may need the kernel_force_cache APIs to guarantee data consistency. Implement versions of these APIs based on the DMA APIs. Signed-off-by: Laura Abbott --- arch/arm/include/asm/cacheflush.h | 4 ++ arch/arm/mm/dma-mapping.c | 119 -- arch/arm/mm/flush.c | 115 arch/arm/mm/mm.h | 8 +++ 4 files changed, 127 insertions(+), 119 deletions(-) diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index 9156fc3..78eb011 100644 --- a/arch/arm/include/asm/cacheflush.h +++ b/arch/arm/include/asm/cacheflush.h @@ -518,4 +518,8 @@ static inline void secure_flush_area(const void *addr, size_t size) outer_flush_range(phys, phys + size); } +#define ARCH_HAS_FORCE_CACHE 1 +void kernel_force_cache_clean(struct page *page, size_t size); +void kernel_force_cache_invalidate(struct page *page, size_t size); + #endif diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index c6834c0..8c9296d 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -95,23 +95,6 @@ static struct arm_dma_buffer *arm_dma_buffer_find(void *virt) return found; } -/* - * The DMA API is built upon the notion of "buffer ownership". A buffer - * is either exclusively owned by the CPU (and therefore may be accessed - * by it) or exclusively owned by the DMA device. These helper functions - * represent the transitions between these two ownership states. - * - * Note, however, that on later ARMs, this notion does not work due to - * speculative prefetches. We model our approach on the assumption that - * the CPU does do speculative prefetches, which means we clean caches - * before transfers and delay cache invalidation until transfer completion. - * - */ -static void __dma_page_cpu_to_dev(struct page *, unsigned long, - size_t, enum dma_data_direction); -static void __dma_page_dev_to_cpu(struct page *, unsigned long, - size_t, enum dma_data_direction); - /** * arm_dma_map_page - map a portion of a page for streaming DMA * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices @@ -945,108 +928,6 @@ int arm_dma_get_sgtable(struct device *dev, struct sg_table *sgt, return 0; } -static void dma_cache_maint_page(struct page *page, unsigned long offset, - size_t size, enum dma_data_direction dir, - void (*op)(const void *, size_t, int)) -{ - unsigned long pfn; - size_t left = size; - - pfn = page_to_pfn(page) + offset / PAGE_SIZE; - offset %= PAGE_SIZE; - - /* -* A single sg entry may refer to multiple physically contiguous -* pages. But we still need to process highmem pages individually. -* If highmem is not configured then the bulk of this loop gets -* optimized out. -*/ - do { - size_t len = left; - void *vaddr; - - page = pfn_to_page(pfn); - - if (PageHighMem(page)) { - if (len + offset > PAGE_SIZE) - len = PAGE_SIZE - offset; - - if (cache_is_vipt_nonaliasing()) { - vaddr = kmap_atomic(page); - op(vaddr + offset, len, dir); - kunmap_atomic(vaddr); - } else { - vaddr = kmap_high_get(page); - if (vaddr) { - op(vaddr + offset, len, dir); - kunmap_high(page); - } - } - } else { - vaddr = page_address(page) + offset; - op(vaddr, len, dir); - } - offset = 0; - pfn++; - left -= len; - } while (left); -} - -/* - * Make an area consistent for devices. - * Note: Drivers should NOT use this function directly, as it will break - * platforms with CONFIG_DMABOUNCE. - * Use the driver DMA support - see dma-mapping.h (dma_sync_*) - */ -static void __dma_page_cpu_to_dev(struct page *page, unsigned long off, - size_t size, enum dma_data_direction dir) -{ - phys_addr_t paddr; - - dma_cache_maint_page(page, off, size, dir, dmac_map_area); - - paddr = page_to_phys(page) + off; - if (dir == DMA_FROM_DEVICE) { - outer_inv_range(paddr, paddr + size); - } else { - outer_clean_range(paddr, paddr + size); - } - /* FIXME: non-speculating: flush on bidirectional mappings? */ -} - -static void __dma_page_dev_to_cpu(struct page *page, unsigned long off, - size_t size, enum dma_data_direction dir) -{ - phys_addr_t paddr = page_to_phys(page) + off; - - /* FIXME: non-speculating: not required */ -
[RFCv2][PATCH 1/5] Documentation: Introduce kernel_force_cache_* APIs
Some frameworks (e.g. Ion) may need to do explicit cache management to meet performance/correctness requirements. Rather than piggy-back on another API and hope the semantics don't change, introduce a set of APIs to force a page to be cleaned/invalidated in the cache. Signed-off-by: Laura Abbott --- Documentation/cachetlb.txt | 18 +- include/linux/cacheflush.h | 11 +++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 include/linux/cacheflush.h diff --git a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt index 3f9f808..18eec7c 100644 --- a/Documentation/cachetlb.txt +++ b/Documentation/cachetlb.txt @@ -378,7 +378,7 @@ maps this page at its virtual address. flush_dcache_page and update_mmu_cache. In the future, the hope is to remove this interface completely. -The final category of APIs is for I/O to deliberately aliased address +Another set of APIs is for I/O to deliberately aliased address ranges inside the kernel. Such aliases are set up by use of the vmap/vmalloc API. Since kernel I/O goes via physical pages, the I/O subsystem assumes that the user mapping and kernel offset mapping are @@ -401,3 +401,19 @@ I/O and invalidating it after the I/O returns. speculatively reading data while the I/O was occurring to the physical pages. This is only necessary for data reads into the vmap area. + +Nearly all drivers can handle cache management using the existing DMA model. +There may be limited circumstances when a driver or framework needs to +explicitly manage the cache; trying to force cache management into the DMA +framework may lead to performance loss or unnecessary work. These APIs may +be used to provide explicit coherency for memory that does not fall into +any of the above categories. Implementers of this API must assume the +address can be aliased. Any cache operations shall not be delayed and must +be completed by the time the call returns. + + void kernel_force_cache_clean(struct page *page, size_t size); + Ensures that any data in the cache by the page is written back +and visible across all aliases. + + void kernel_force_cache_invalidate(struct page *page, size_t size); + Invalidates the cache for the given page. diff --git a/include/linux/cacheflush.h b/include/linux/cacheflush.h new file mode 100644 index 000..4388846 --- /dev/null +++ b/include/linux/cacheflush.h @@ -0,0 +1,11 @@ +#ifndef CACHEFLUSH_H +#define CACHEFLUSH_H + +#include + +#ifndef ARCH_HAS_FORCE_CACHE +static inline void kernel_force_cache_clean(struct page *page, size_t size) { } +static inline void kernel_force_cache_invalidate(struct page *page, size_t size) { } +#endif + +#endif -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFCv2][PATCH 5/5] staging: ion: Add support for syncing with DMA_BUF_IOCTL_SYNC
From: Laura Abbott dma_buf added support for a userspace syncing ioctl. It is implemented by calling dma_buf_begin_cpu_access and dma_buf_end_cpu_access. Ion currently lacks cache operations on this code path. Add them for compatibility with the dma_buf ioctl. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 5cbe22e..8153af3 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1109,6 +1109,24 @@ static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset, { } +static void ion_clean_buffer(struct ion_buffer *buffer) +{ + struct scatterlist *sg; + int i; + + for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->orig_nents, i) + kernel_force_cache_clean(sg_page(sg), sg->length); +} + +static void ion_invalidate_buffer(struct ion_buffer *buffer) +{ + struct scatterlist *sg; + int i; + + for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->orig_nents, i) + kernel_force_cache_invalidate(sg_page(sg), sg->length); +} + static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, enum dma_data_direction direction) { @@ -1124,6 +1142,11 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, mutex_lock(&buffer->lock); vaddr = ion_buffer_kmap_get(buffer); mutex_unlock(&buffer->lock); + + if (direction != DMA_TO_DEVICE) { + ion_invalidate_buffer(buffer); + } + return PTR_ERR_OR_ZERO(vaddr); } @@ -1136,6 +1159,12 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf, ion_buffer_kmap_put(buffer); mutex_unlock(&buffer->lock); + if (direction == DMA_FROM_DEVICE) { + ion_invalidate_buffer(buffer); + } else { + ion_clean_buffer(buffer); + } + return 0; } @@ -1266,6 +1295,8 @@ static int ion_sync_for_device(struct ion_client *client, int fd) struct dma_buf *dmabuf; struct ion_buffer *buffer; + WARN_ONCE(1, "This API is deprecated in favor of the dma_buf ioctl\n"); + dmabuf = dma_buf_get(fd); if (IS_ERR(dmabuf)) return PTR_ERR(dmabuf); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFCv2][PATCH 4/5] staging: android: ion: Convert to the kernel_force_cache APIs
Now that there exists a proper set of cache sync APIs, move away from the dma_sync and do less bad things. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 22 -- drivers/staging/android/ion/ion_carveout_heap.c | 8 +--- drivers/staging/android/ion/ion_chunk_heap.c| 12 +++- drivers/staging/android/ion/ion_page_pool.c | 6 -- drivers/staging/android/ion/ion_priv.h | 11 --- drivers/staging/android/ion/ion_system_heap.c | 6 +++--- 6 files changed, 23 insertions(+), 42 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index a2cf93b..5cbe22e 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -37,6 +37,8 @@ #include #include +#include + #include "ion.h" #include "ion_priv.h" #include "compat_ion.h" @@ -957,22 +959,6 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment, { } -void ion_pages_sync_for_device(struct device *dev, struct page *page, - size_t size, enum dma_data_direction dir) -{ - struct scatterlist sg; - - sg_init_table(&sg, 1); - sg_set_page(&sg, page, size, 0); - /* -* This is not correct - sg_dma_address needs a dma_addr_t that is valid -* for the targeted device, but this works on the currently targeted -* hardware. -*/ - sg_dma_address(&sg) = page_to_phys(page); - dma_sync_sg_for_device(dev, &sg, 1, dir); -} - struct ion_vma_list { struct list_head list; struct vm_area_struct *vma; @@ -997,8 +983,8 @@ static void ion_buffer_sync_for_device(struct ion_buffer *buffer, struct page *page = buffer->pages[i]; if (ion_buffer_page_is_dirty(page)) - ion_pages_sync_for_device(dev, ion_buffer_page(page), - PAGE_SIZE, dir); + kernel_force_cache_clean(ion_buffer_page(page), + PAGE_SIZE); ion_buffer_page_clean(buffer->pages + i); } diff --git a/drivers/staging/android/ion/ion_carveout_heap.c b/drivers/staging/android/ion/ion_carveout_heap.c index 1fb0d81..34c38b0 100644 --- a/drivers/staging/android/ion/ion_carveout_heap.c +++ b/drivers/staging/android/ion/ion_carveout_heap.c @@ -22,6 +22,9 @@ #include #include #include + +#include + #include "ion.h" #include "ion_priv.h" @@ -116,8 +119,7 @@ static void ion_carveout_heap_free(struct ion_buffer *buffer) ion_heap_buffer_zero(buffer); if (ion_buffer_cached(buffer)) - dma_sync_sg_for_device(NULL, table->sgl, table->nents, - DMA_BIDIRECTIONAL); + kernel_force_cache_clean(page, buffer->size); ion_carveout_free(heap, paddr, buffer->size); sg_free_table(table); @@ -157,7 +159,7 @@ struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data) page = pfn_to_page(PFN_DOWN(heap_data->base)); size = heap_data->size; - ion_pages_sync_for_device(NULL, page, size, DMA_BIDIRECTIONAL); + kernel_force_cache_clean(page, size); ret = ion_heap_pages_zero(page, size, pgprot_writecombine(PAGE_KERNEL)); if (ret) diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c index e0553fe..dde14f3 100644 --- a/drivers/staging/android/ion/ion_chunk_heap.c +++ b/drivers/staging/android/ion/ion_chunk_heap.c @@ -21,6 +21,9 @@ #include #include #include + +#include + #include "ion.h" #include "ion_priv.h" @@ -104,11 +107,10 @@ static void ion_chunk_heap_free(struct ion_buffer *buffer) ion_heap_buffer_zero(buffer); - if (ion_buffer_cached(buffer)) - dma_sync_sg_for_device(NULL, table->sgl, table->nents, - DMA_BIDIRECTIONAL); - for_each_sg(table->sgl, sg, table->nents, i) { + if (ion_buffer_cached(buffer)) + kernel_force_cache_clean(sg_page(table->sgl), +sg->length); gen_pool_free(chunk_heap->pool, page_to_phys(sg_page(sg)), sg->length); } @@ -148,7 +150,7 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data) page = pfn_to_page(PFN_DOWN(heap_data->base)); size = heap_data->size; - ion_pages_sync_for_device(NULL, page, size, DMA_BIDIRECTIONAL); + kernel_force_cache_clean(page, size); ret = ion_heap_pages_zero(page, size, pgprot_writecombine(PAGE_KERNEL)); if (ret) diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c index 1fe8016..51805d2 100644 --- a/drivers/staging/android/ion/ion_pag
[RFCv2][PATCH 3/5] arm64: Implement ARCH_HAS_FORCE_CACHE
arm64 may need to guarantee the caches are synced. Implement versions of the kernel_force_cache API based on the DMA APIs. Signed-off-by: Laura Abbott --- arch/arm64/include/asm/cacheflush.h | 5 + arch/arm64/mm/flush.c | 11 +++ 2 files changed, 16 insertions(+) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index c64268d..9980dd8 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -149,4 +149,9 @@ int set_memory_rw(unsigned long addr, int numpages); int set_memory_x(unsigned long addr, int numpages); int set_memory_nx(unsigned long addr, int numpages); +#define ARCH_HAS_FORCE_CACHE 1 + +void kernel_force_cache_clean(struct page *page, size_t size); +void kernel_force_cache_invalidate(struct page *page, size_t size); + #endif diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index 43a76b0..0af78ab 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -94,3 +95,13 @@ EXPORT_SYMBOL(flush_dcache_page); * Additional functions defined in assembly. */ EXPORT_SYMBOL(flush_icache_range); + +void kernel_force_cache_clean(struct page *page, size_t size) +{ + __dma_map_area(page_address(page), size, DMA_BIDIRECTIONAL); +} + +void kernel_force_cache_invalidate(struct page *page, size_t size) +{ + __dma_unmap_area(page_address(page), size, DMA_BIDIRECTIONAL); +} -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ion: remove __GFP_NOWARN when use low order gfp flags
On 07/29/2016 07:09 PM, Chen Feng wrote: It's useful to show the current memory in detail when alloc failed. And, there may be a lot of high order alloc failed, just show memory when an order 0 alloc failed. Signed-off-by: Chen Feng --- drivers/staging/android/ion/ion_system_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index b69dfc7..c3b7975 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -28,7 +28,7 @@ static gfp_t high_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN | __GFP_NORETRY) & ~__GFP_RECLAIM; -static gfp_t low_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN); +static gfp_t low_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO); static const unsigned int orders[] = {8, 4, 0}; static const int num_orders = ARRAY_SIZE(orders); static int order_to_index(unsigned int order) Acked-by: Laura Abbott ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/7] de-stage SW_SYNC validation frawework
2016-08-07 Pavel Machek : > On Sun 2016-07-24 15:21:11, Greg Kroah-Hartman wrote: > > On Mon, Jul 18, 2016 at 04:12:45PM -0300, Gustavo Padovan wrote: > > > Hi, > > > > > > Do you think there is time to get this in for 4.8? > > > > No, it was too late on my end, due to travel and vacation, sorry. I'll > > queue it up for 4.9-rc1. > > Could we get some documentation what this does? Is it visilble to > userspace? This interface is only intended for testing and validation, there are ioctls on the debugfs file that can be accessed by userspace but there isn't any exported kernel header with this info. The tester should know and add a internal header to be able to access it. We want to prevent people from misusing this feature by not advertising it nor providing documentation. There will be, though, kselftest for this interface, that I send out once SW_SYNC is de-staged. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/7] de-stage SW_SYNC validation frawework
On Mon 2016-08-08 16:08:12, Gustavo Padovan wrote: > 2016-08-07 Pavel Machek : > > > On Sun 2016-07-24 15:21:11, Greg Kroah-Hartman wrote: > > > On Mon, Jul 18, 2016 at 04:12:45PM -0300, Gustavo Padovan wrote: > > > > Hi, > > > > > > > > Do you think there is time to get this in for 4.8? > > > > > > No, it was too late on my end, due to travel and vacation, sorry. I'll > > > queue it up for 4.9-rc1. > > > > Could we get some documentation what this does? Is it visilble to > > userspace? > > This interface is only intended for testing and validation, there are > ioctls on the debugfs file that can be accessed by userspace but there > isn't any exported kernel header with this info. The tester should know > and add a internal header to be able to access it. We want to prevent > people from misusing this feature by not advertising it nor providing > documentation. You are playing dangerous game here. debugfs is not normally considered stable, but otoh... ioctls on debugfs? Anyway, please provide some documentation. Kernel hackers need to know what this does. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/7] de-stage SW_SYNC validation frawework
2016-07-24 Pavel Machek : > On Mon 2016-08-08 16:08:12, Gustavo Padovan wrote: > > 2016-08-07 Pavel Machek : > > > > > On Sun 2016-07-24 15:21:11, Greg Kroah-Hartman wrote: > > > > On Mon, Jul 18, 2016 at 04:12:45PM -0300, Gustavo Padovan wrote: > > > > > Hi, > > > > > > > > > > Do you think there is time to get this in for 4.8? > > > > > > > > No, it was too late on my end, due to travel and vacation, sorry. I'll > > > > queue it up for 4.9-rc1. > > > > > > Could we get some documentation what this does? Is it visilble to > > > userspace? > > > > This interface is only intended for testing and validation, there are > > ioctls on the debugfs file that can be accessed by userspace but there > > isn't any exported kernel header with this info. The tester should know > > and add a internal header to be able to access it. We want to prevent > > people from misusing this feature by not advertising it nor providing > > documentation. > > You are playing dangerous game here. debugfs is not normally considered > stable, > but otoh... ioctls on debugfs? > > Anyway, please provide some documentation. Kernel hackers need to know what > this does. Okay, where do you think is the best place? Would documentation inside the .c file suffice for you? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/7] staging/android: display sync_pt name on debugfs
2016-08-08 Maarten Lankhorst : > Op 20-06-16 om 17:53 schreef Gustavo Padovan: > > From: Gustavo Padovan > > > > When creating a sync_pt the name received wasn't used anywhere. > > Now we add it to the sync info debug output to make it easier to indetify > > the userspace name of that sync pt. > > > > Signed-off-by: Gustavo Padovan > > --- > > drivers/staging/android/sw_sync.c| 16 > > drivers/staging/android/sync_debug.c | 5 +++-- > > drivers/staging/android/sync_debug.h | 9 + > > 3 files changed, 16 insertions(+), 14 deletions(-) > > > > diff --git a/drivers/staging/android/sw_sync.c > > b/drivers/staging/android/sw_sync.c > > index b4ae092..ea27512 100644 > > --- a/drivers/staging/android/sw_sync.c > > +++ b/drivers/staging/android/sw_sync.c > > @@ -37,15 +37,6 @@ struct sw_sync_create_fence_data { > > struct sw_sync_create_fence_data) > > #define SW_SYNC_IOC_INC_IOW(SW_SYNC_IOC_MAGIC, 1, > > __u32) > > > > -static const struct fence_ops timeline_fence_ops; > > - > > -static inline struct sync_pt *fence_to_sync_pt(struct fence *fence) > > -{ > > - if (fence->ops != &timeline_fence_ops) > > - return NULL; > > - return container_of(fence, struct sync_pt, base); > > -} > > - > > struct sync_timeline *sync_timeline_create(const char *name) > > { > > struct sync_timeline *obj; > > @@ -108,7 +99,7 @@ static void sync_timeline_signal(struct sync_timeline > > *obj, unsigned int inc) > > } > > > > static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size, > > -unsigned int value) > > +unsigned int value, char *name) > > { > > unsigned long flags; > > struct sync_pt *pt; > > @@ -120,6 +111,7 @@ static struct sync_pt *sync_pt_create(struct > > sync_timeline *obj, int size, > > if (!pt) > > return NULL; > > > > + strlcpy(pt->name, name, sizeof(pt->name)); > > spin_lock_irqsave(&obj->child_list_lock, flags); > > sync_timeline_get(obj); > > fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock, > > @@ -191,7 +183,7 @@ static void timeline_fence_timeline_value_str(struct > > fence *fence, > > snprintf(str, size, "%d", parent->value); > > } > > > > -static const struct fence_ops timeline_fence_ops = { > > +const struct fence_ops timeline_fence_ops = { > > .get_driver_name = timeline_fence_get_driver_name, > > .get_timeline_name = timeline_fence_get_timeline_name, > > .enable_signaling = timeline_fence_enable_signaling, > > @@ -252,7 +244,7 @@ static long sw_sync_ioctl_create_fence(struct > > sync_timeline *obj, > > goto err; > > } > > > > - pt = sync_pt_create(obj, sizeof(*pt), data.value); > > + pt = sync_pt_create(obj, sizeof(*pt), data.value, data.name); > > if (!pt) { > > err = -ENOMEM; > > goto err; > > diff --git a/drivers/staging/android/sync_debug.c > > b/drivers/staging/android/sync_debug.c > > index 4c5a855..b732ea3 100644 > > --- a/drivers/staging/android/sync_debug.c > > +++ b/drivers/staging/android/sync_debug.c > > @@ -75,13 +75,14 @@ static void sync_print_fence(struct seq_file *s, struct > > fence *fence, bool show) > > { > > int status = 1; > > struct sync_timeline *parent = fence_parent(fence); > > + struct sync_pt *pt = fence_to_sync_pt(fence); > > > > if (fence_is_signaled_locked(fence)) > > status = fence->status; > > > > - seq_printf(s, " %s%sfence %s", > > + seq_printf(s, " %s%sfence %s %s", > >show ? parent->name : "", > > - show ? "_" : "", > > + show ? "_" : "", pt->name, > >sync_status_str(status)); > > > NAK, > A fence in sync_print_fence can be of any type. If you want to print the > name, use the fence_value_str callback. Indeed. But fence_value_str doesn't return the sync_pt name, but the seqno of that fence. I'll keep this change out for the de-staging and then try to come with something that works better. Gustavo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: vt6655: channel.c: Fix block comments usage warning by checkpatch.pl
This patch fixes the following checkpatch.pl warnings: WARNING: Block comments use * on subsequent lines + /* TX_PE will reserve 3 us for MAX2829 A mode only, + it is for better TX throughput */ WARNING: Block comments use a trailing */ on a separate line + it is for better TX throughput */ Signed-off-by: Anson Jacob --- drivers/staging/vt6655/channel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c index b7d43a5..029a8df 100644 --- a/drivers/staging/vt6655/channel.c +++ b/drivers/staging/vt6655/channel.c @@ -193,7 +193,8 @@ bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch) MACvRegBitsOn(priv->PortOffset, MAC_REG_MACCR, MACCR_CLRNAV); /* TX_PE will reserve 3 us for MAX2829 A mode only, - it is for better TX throughput */ +* it is for better TX throughput +*/ if (priv->byRFType == RF_AIROHA7230) RFbAL7230SelectChannelPostProcess(priv, priv->byCurrentCh, -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 0/6] de-stage SW_SYNC validation frawework
From: Gustavo Padovan Hi Greg, This is the last step in the Sync Framwork de-stage task. It de-stage the SW_SYNC validation framework and the sync_debug info debugfs file. The first 2 patches are clean up and improvements and the rest is preparation to de-stage and then finally the actual de-stage. v2: - add documentation about the SW_SYNC ioctl API (comments from Pavel Machek) - remove for now patch to add sync_pt name to debugfs Please review, Gustavo --- Gustavo Padovan (6): staging/android: remove doc from sw_sync staging/android: do not let userspace trigger WARN_ON staging/android: move trace/sync.h to sync_trace.h staging/android: prepare sw_sync files for de-staging staging/android: add Doc for SW_SYNC ioctl interface dma-buf/sw_sync: de-stage SW_SYNC drivers/dma-buf/Kconfig | 13 ++ drivers/dma-buf/Makefile | 1 + drivers/dma-buf/sw_sync.c| 349 +++ drivers/dma-buf/sync_debug.c | 230 +++ drivers/dma-buf/sync_debug.h | 69 +++ drivers/dma-buf/sync_trace.h | 32 drivers/staging/android/Kconfig | 13 -- drivers/staging/android/Makefile | 1 - drivers/staging/android/sw_sync.c| 344 -- drivers/staging/android/sync_debug.c | 230 --- drivers/staging/android/sync_debug.h | 84 - drivers/staging/android/trace/sync.h | 32 12 files changed, 694 insertions(+), 704 deletions(-) create mode 100644 drivers/dma-buf/sw_sync.c create mode 100644 drivers/dma-buf/sync_debug.c create mode 100644 drivers/dma-buf/sync_debug.h create mode 100644 drivers/dma-buf/sync_trace.h delete mode 100644 drivers/staging/android/sw_sync.c delete mode 100644 drivers/staging/android/sync_debug.c delete mode 100644 drivers/staging/android/sync_debug.h delete mode 100644 drivers/staging/android/trace/sync.h -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/6] staging/android: do not let userspace trigger WARN_ON
From: Gustavo Padovan Closing the timeline without waiting all fences to signal is not a critical failure, it is just bad usage from userspace so avoid calling WARN_ON in this case. Signed-off-by: Gustavo Padovan --- drivers/staging/android/sw_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index b4ae092..ad0bb1a 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -150,7 +150,7 @@ static void timeline_fence_release(struct fence *fence) spin_lock_irqsave(fence->lock, flags); list_del(&pt->child_list); - if (WARN_ON_ONCE(!list_empty(&pt->active_list))) + if (!list_empty(&pt->active_list)) list_del(&pt->active_list); spin_unlock_irqrestore(fence->lock, flags); -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/6] staging/android: remove doc from sw_sync
From: Gustavo Padovan SW_SYNC should never be used by other pieces of the kernel apart from sync_debug as it is only a Sync File Validation Framework, so hide any info to avoid confuse this with a standard kernel internal API. Signed-off-by: Gustavo Padovan --- drivers/staging/android/sw_sync.c| 26 -- drivers/staging/android/sync_debug.h | 15 --- 2 files changed, 41 deletions(-) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index 115c917..b4ae092 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -46,13 +46,6 @@ static inline struct sync_pt *fence_to_sync_pt(struct fence *fence) return container_of(fence, struct sync_pt, base); } -/** - * sync_timeline_create() - creates a sync object - * @name: sync_timeline name - * - * Creates a new sync_timeline. Returns the sync_timeline object or NULL in - * case of error. - */ struct sync_timeline *sync_timeline_create(const char *name) { struct sync_timeline *obj; @@ -94,14 +87,6 @@ static void sync_timeline_put(struct sync_timeline *obj) kref_put(&obj->kref, sync_timeline_free); } -/** - * sync_timeline_signal() - signal a status change on a sync_timeline - * @obj: sync_timeline to signal - * @inc: num to increment on timeline->value - * - * A sync implementation should call this any time one of it's fences - * has signaled or has an error condition. - */ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc) { unsigned long flags; @@ -122,17 +107,6 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc) spin_unlock_irqrestore(&obj->child_list_lock, flags); } -/** - * sync_pt_create() - creates a sync pt - * @parent:fence's parent sync_timeline - * @size: size to allocate for this pt - * @inc: value of the fence - * - * Creates a new sync_pt as a child of @parent. @size bytes will be - * allocated allowing for implementation specific data to be kept after - * the generic sync_timeline struct. Returns the sync_pt object or - * NULL in case of error. - */ static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size, unsigned int value) { diff --git a/drivers/staging/android/sync_debug.h b/drivers/staging/android/sync_debug.h index fab6639..5b82cf8 100644 --- a/drivers/staging/android/sync_debug.h +++ b/drivers/staging/android/sync_debug.h @@ -20,15 +20,6 @@ #include #include -/** - * struct sync_timeline - sync object - * @kref: reference count on fence. - * @name: name of the sync_timeline. Useful for debugging - * @child_list_head: list of children sync_pts for this sync_timeline - * @child_list_lock: lock protecting @child_list_head and fence.status - * @active_list_head: list of active (unsignaled/errored) sync_pts - * @sync_timeline_list:membership in global sync_timeline_list - */ struct sync_timeline { struct kref kref; charname[32]; @@ -51,12 +42,6 @@ static inline struct sync_timeline *fence_parent(struct fence *fence) child_list_lock); } -/** - * struct sync_pt - sync_pt object - * @base: base fence object - * @child_list: sync timeline child's list - * @active_list: sync timeline active child's list - */ struct sync_pt { struct fence base; struct list_head child_list; -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/6] staging/android: move trace/sync.h to sync_trace.h
From: Gustavo Padovan The common behaviour for trace headers is to have them in the same folder they are used, instead of creating a special trace/ directory. Signed-off-by: Gustavo Padovan --- drivers/staging/android/sw_sync.c| 2 +- drivers/staging/android/sync_trace.h | 32 drivers/staging/android/trace/sync.h | 32 3 files changed, 33 insertions(+), 33 deletions(-) create mode 100644 drivers/staging/android/sync_trace.h delete mode 100644 drivers/staging/android/trace/sync.h diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index ad0bb1a..745597b 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -23,7 +23,7 @@ #include "sync_debug.h" #define CREATE_TRACE_POINTS -#include "trace/sync.h" +#include "sync_trace.h" struct sw_sync_create_fence_data { __u32 value; diff --git a/drivers/staging/android/sync_trace.h b/drivers/staging/android/sync_trace.h new file mode 100644 index 000..ea485f7 --- /dev/null +++ b/drivers/staging/android/sync_trace.h @@ -0,0 +1,32 @@ +#undef TRACE_SYSTEM +#define TRACE_INCLUDE_PATH ../../drivers/staging/android +#define TRACE_SYSTEM sync_trace + +#if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_SYNC_H + +#include "sync_debug.h" +#include + +TRACE_EVENT(sync_timeline, + TP_PROTO(struct sync_timeline *timeline), + + TP_ARGS(timeline), + + TP_STRUCT__entry( + __string(name, timeline->name) + __field(u32, value) + ), + + TP_fast_assign( + __assign_str(name, timeline->name); + __entry->value = timeline->value; + ), + + TP_printk("name=%s value=%d", __get_str(name), __entry->value) +); + +#endif /* if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ) */ + +/* This part must be outside protection */ +#include diff --git a/drivers/staging/android/trace/sync.h b/drivers/staging/android/trace/sync.h deleted file mode 100644 index 6b5ce96..000 --- a/drivers/staging/android/trace/sync.h +++ /dev/null @@ -1,32 +0,0 @@ -#undef TRACE_SYSTEM -#define TRACE_INCLUDE_PATH ../../drivers/staging/android/trace -#define TRACE_SYSTEM sync - -#if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_SYNC_H - -#include "../sync_debug.h" -#include - -TRACE_EVENT(sync_timeline, - TP_PROTO(struct sync_timeline *timeline), - - TP_ARGS(timeline), - - TP_STRUCT__entry( - __string(name, timeline->name) - __field(u32, value) - ), - - TP_fast_assign( - __assign_str(name, timeline->name); - __entry->value = timeline->value; - ), - - TP_printk("name=%s value=%d", __get_str(name), __entry->value) -); - -#endif /* if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ) */ - -/* This part must be outside protection */ -#include -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 4/6] staging/android: prepare sw_sync files for de-staging
From: Gustavo Padovan remove file paths in the comments and add short description about each file. v2: remove file paths instead of just change them. Signed-off-by: Gustavo Padovan --- drivers/staging/android/sw_sync.c| 2 +- drivers/staging/android/sync_debug.c | 2 +- drivers/staging/android/sync_debug.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index 745597b..43491b6 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -1,5 +1,5 @@ /* - * drivers/dma-buf/sw_sync.c + * Sync File validation framework * * Copyright (C) 2012 Google, Inc. * diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c index 4c5a855..fab9520 100644 --- a/drivers/staging/android/sync_debug.c +++ b/drivers/staging/android/sync_debug.c @@ -1,5 +1,5 @@ /* - * drivers/base/sync.c + * Sync File validation framework and debug information * * Copyright (C) 2012 Google, Inc. * diff --git a/drivers/staging/android/sync_debug.h b/drivers/staging/android/sync_debug.h index 5b82cf8..ee3c27b 100644 --- a/drivers/staging/android/sync_debug.h +++ b/drivers/staging/android/sync_debug.h @@ -1,5 +1,5 @@ /* - * include/linux/sync.h + * Sync File validation framework * * Copyright (C) 2012 Google, Inc. * -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 5/6] staging/android: add Doc for SW_SYNC ioctl interface
From: Gustavo Padovan This interface is hidden from kernel headers and it is intended for use only for testing. So testers would have to add the ioctl information internally. This is to prevent misuse of this feature. Signed-off-by: Gustavo Padovan --- drivers/staging/android/sw_sync.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index 43491b6..2ac5608 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -25,6 +25,36 @@ #define CREATE_TRACE_POINTS #include "sync_trace.h" +/* + * SW SYNC validation framework + * + * A sync object driver that uses a 32bit counter to coordinate + * synchronization. Useful when there is no hardware primitive backing + * the synchronization. + * + * To start the framework just open: + * + * /sync/sw_sync + * + * That will create a sync timeline, all fences created under this timeline + * file descriptor will belong to the this timeline. + * + * The 'sw_sync' file can be opened many times as to create different + * timelines. + * + * Fences can be created with SW_SYNC_IOC_CREATE_FENCE ioctl with struct + * sw_sync_ioctl_create_fence as parameter. + * + * To increment the timeline counter SW_SYNC_IOC_INC ioctl should be used + * with the increment as u32. This will update the last signaled value + * from the timeline and signal any fence that has seqno, smaller of equal + * it. + * + * struct sw_sync_ioctl_create_fence + * @value: the seqno to initiate the fence with + * @name: the name of the new sync point + * @fence: return the fd of the new sync_file with the created fence + */ struct sw_sync_create_fence_data { __u32 value; charname[32]; @@ -35,6 +65,7 @@ struct sw_sync_create_fence_data { #define SW_SYNC_IOC_CREATE_FENCE _IOWR(SW_SYNC_IOC_MAGIC, 0,\ struct sw_sync_create_fence_data) + #define SW_SYNC_IOC_INC_IOW(SW_SYNC_IOC_MAGIC, 1, __u32) static const struct fence_ops timeline_fence_ops; -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 6/6] dma-buf/sw_sync: de-stage SW_SYNC
From: Gustavo Padovan SW_SYNC allows to run tests on the sync_file framework via debugfs on /sync/sw_sync Opening and closing the file triggers creation and release of a sync timeline. To create fences on this timeline the SW_SYNC_IOC_CREATE_FENCE ioctl should be used. To increment the timeline value use SW_SYNC_IOC_INC. Also it exports Sync information on /sync/info Signed-off-by: Gustavo Padovan --- drivers/dma-buf/Kconfig | 13 ++ drivers/dma-buf/Makefile | 1 + drivers/dma-buf/sw_sync.c| 349 +++ drivers/dma-buf/sync_debug.c | 230 +++ drivers/dma-buf/sync_debug.h | 69 +++ drivers/dma-buf/sync_trace.h | 32 drivers/staging/android/Kconfig | 13 -- drivers/staging/android/Makefile | 1 - drivers/staging/android/sw_sync.c| 349 --- drivers/staging/android/sync_debug.c | 230 --- drivers/staging/android/sync_debug.h | 69 --- drivers/staging/android/sync_trace.h | 32 12 files changed, 694 insertions(+), 694 deletions(-) create mode 100644 drivers/dma-buf/sw_sync.c create mode 100644 drivers/dma-buf/sync_debug.c create mode 100644 drivers/dma-buf/sync_debug.h create mode 100644 drivers/dma-buf/sync_trace.h delete mode 100644 drivers/staging/android/sw_sync.c delete mode 100644 drivers/staging/android/sync_debug.c delete mode 100644 drivers/staging/android/sync_debug.h delete mode 100644 drivers/staging/android/sync_trace.h diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig index 25bcfa0..2585821 100644 --- a/drivers/dma-buf/Kconfig +++ b/drivers/dma-buf/Kconfig @@ -17,4 +17,17 @@ config SYNC_FILE Files fds, to the DRM driver for example. More details at Documentation/sync_file.txt. +config SW_SYNC + bool "Sync File Validation Framework" + default n + depends on SYNC_FILE + depends on DEBUG_FS + ---help--- + A sync object driver that uses a 32bit counter to coordinate + synchronization. Useful when there is no hardware primitive backing + the synchronization. + + WARNING: improper use of this can result in deadlocking kernel + drivers from userspace. Intended for test and debug only. + endmenu diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile index f353db2..210a10b 100644 --- a/drivers/dma-buf/Makefile +++ b/drivers/dma-buf/Makefile @@ -1,2 +1,3 @@ obj-y := dma-buf.o fence.o reservation.o seqno-fence.o fence-array.o obj-$(CONFIG_SYNC_FILE)+= sync_file.o +obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c new file mode 100644 index 000..2ac5608 --- /dev/null +++ b/drivers/dma-buf/sw_sync.c @@ -0,0 +1,349 @@ +/* + * Sync File validation framework + * + * Copyright (C) 2012 Google, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include + +#include "sync_debug.h" + +#define CREATE_TRACE_POINTS +#include "sync_trace.h" + +/* + * SW SYNC validation framework + * + * A sync object driver that uses a 32bit counter to coordinate + * synchronization. Useful when there is no hardware primitive backing + * the synchronization. + * + * To start the framework just open: + * + * /sync/sw_sync + * + * That will create a sync timeline, all fences created under this timeline + * file descriptor will belong to the this timeline. + * + * The 'sw_sync' file can be opened many times as to create different + * timelines. + * + * Fences can be created with SW_SYNC_IOC_CREATE_FENCE ioctl with struct + * sw_sync_ioctl_create_fence as parameter. + * + * To increment the timeline counter SW_SYNC_IOC_INC ioctl should be used + * with the increment as u32. This will update the last signaled value + * from the timeline and signal any fence that has seqno, smaller of equal + * it. + * + * struct sw_sync_ioctl_create_fence + * @value: the seqno to initiate the fence with + * @name: the name of the new sync point + * @fence: return the fd of the new sync_file with the created fence + */ +struct sw_sync_create_fence_data { + __u32 value; + charname[32]; + __s32 fence; /* fd of new fence */ +}; + +#define SW_SYNC_IOC_MAGIC 'W' + +#define SW_SYNC_IOC_CREATE_FENCE _IOWR(SW_SYNC_IOC_MAGIC, 0,\ + struct sw_sync_create_fence_data) + +#define SW_SYNC_IOC_INC
[PATCH] staging: vt6655: device_main.c: Fix checkpatch warning
Fix warning by checkpatch.pl Add * for block comments on subsequent lines Signed-off-by: Anson Jacob --- drivers/staging/vt6655/device_main.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 4941640..ed12b5c 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -113,10 +113,10 @@ DEVICE_PARAM(ShortRetryLimit, "Short frame retry limits"); DEVICE_PARAM(LongRetryLimit, "long frame retry limits"); /* BasebandType[] baseband type selected - 0: indicate 802.11a type - 1: indicate 802.11b type - 2: indicate 802.11g type -*/ + * 0: indicate 802.11a type + * 1: indicate 802.11b type + * 2: indicate 802.11g type + */ #define BBP_TYPE_MIN 0 #define BBP_TYPE_MAX 2 #define BBP_TYPE_DEF 2 -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: vt6655: power.c: Fix checkpatch warning
Fix checkpatch.pl warning for trailing */ on a separate line Remove '+' postfix and '-' prefix from the start and end of block comments Signed-off-by: Anson Jacob --- drivers/staging/vt6655/power.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c index bc8ca98..7d6e746 100644 --- a/drivers/staging/vt6655/power.c +++ b/drivers/staging/vt6655/power.c @@ -52,7 +52,7 @@ /*- Export Functions --*/ -/*+ +/* * * Routine Description: * Enable hw power saving functions @@ -60,7 +60,7 @@ * Return Value: *None. * - -*/ + */ void PSvEnablePowerSaving( @@ -104,7 +104,7 @@ PSvEnablePowerSaving( pr_debug("PS:Power Saving Mode Enable...\n"); } -/*+ +/* * * Routine Description: * Disable hw power saving functions @@ -112,7 +112,7 @@ PSvEnablePowerSaving( * Return Value: *None. * - -*/ + */ void PSvDisablePowerSaving( @@ -134,7 +134,7 @@ PSvDisablePowerSaving( } -/*+ +/* * * Routine Description: * Check if Next TBTT must wake up @@ -142,7 +142,7 @@ PSvDisablePowerSaving( * Return Value: *None. * - -*/ + */ bool PSbIsNextTBTTWakeUp( -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: vt6655: power.c: Fix checkpatch warning
On Mon, 2016-08-08 at 17:35 -0400, Anson Jacob wrote: > Fix checkpatch.pl warning for trailing */ on a separate line > Remove '+' postfix and '-' prefix from the start and end of block comments Those /*+ uses should probably be converted to /** for kernel-doc > Signed-off-by: Anson Jacob > --- > drivers/staging/vt6655/power.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c > index bc8ca98..7d6e746 100644 > --- a/drivers/staging/vt6655/power.c > +++ b/drivers/staging/vt6655/power.c > @@ -52,7 +52,7 @@ > > /*- Export Functions --*/ > > -/*+ > +/* > * > * Routine Description: > * Enable hw power saving functions > @@ -60,7 +60,7 @@ > * Return Value: > *None. > * > - -*/ > + */ > > void > PSvEnablePowerSaving( > @@ -104,7 +104,7 @@ PSvEnablePowerSaving( > pr_debug("PS:Power Saving Mode Enable...\n"); > } > > -/*+ > +/* > * > * Routine Description: > * Disable hw power saving functions > @@ -112,7 +112,7 @@ PSvEnablePowerSaving( > * Return Value: > *None. > * > - -*/ > + */ > > void > PSvDisablePowerSaving( > @@ -134,7 +134,7 @@ PSvDisablePowerSaving( > } > > > -/*+ > +/* > * > * Routine Description: > * Check if Next TBTT must wake up > @@ -142,7 +142,7 @@ PSvDisablePowerSaving( > * Return Value: > *None. > * > - -*/ > + */ > > bool > PSbIsNextTBTTWakeUp( ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/7] de-stage SW_SYNC validation frawework
On Sun, Jul 24, 2016 at 05:00:31PM +0200, Pavel Machek wrote: > On Mon 2016-08-08 16:08:12, Gustavo Padovan wrote: > > 2016-08-07 Pavel Machek : > > > > > On Sun 2016-07-24 15:21:11, Greg Kroah-Hartman wrote: > > > > On Mon, Jul 18, 2016 at 04:12:45PM -0300, Gustavo Padovan wrote: > > > > > Hi, > > > > > > > > > > Do you think there is time to get this in for 4.8? > > > > > > > > No, it was too late on my end, due to travel and vacation, sorry. I'll > > > > queue it up for 4.9-rc1. > > > > > > Could we get some documentation what this does? Is it visilble to > > > userspace? > > > > This interface is only intended for testing and validation, there are > > ioctls on the debugfs file that can be accessed by userspace but there > > isn't any exported kernel header with this info. The tester should know > > and add a internal header to be able to access it. We want to prevent > > people from misusing this feature by not advertising it nor providing > > documentation. > > You are playing dangerous game here. debugfs is not normally considered > stable, > but otoh... ioctls on debugfs? It's not considered stable. The idea is that we also add the existing testcases to kselftest. It's purely a bit of interface to be able to drive run the test logic for real fences. What it really tests is the fence interface (which is public in the uapi headers and all that), but to be able to do that we need some (hw-independent way) to expose fences, which this provides. Long term we might even do this as a proper interface (with some restrictions to make it safe and avoid userspace pulling the kernel over the table). And then rip out sw_sync entirely. Imo there's no need at all for docs for this. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel