Skip to content

Commit bf02f5d

Browse files
author
Al Viro
committed
Merge commit '2c563880ea' into work.xattr
pick xattr_handler conversion from lustre tree
2 parents 4b899da + 2c56388 commit bf02f5d

33 files changed

Lines changed: 296 additions & 530 deletions

‎drivers/android/binder.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ static struct dentry *binder_debugfs_dir_entry_proc;
5959
static struct binder_node *binder_context_mgr_node;
6060
static kuid_t binder_context_mgr_uid = INVALID_UID;
6161
static int binder_last_id;
62-
static struct workqueue_struct *binder_deferred_workqueue;
6362

6463
#define BINDER_DEBUG_ENTRY(name) \
6564
static int binder_##name##_open(struct inode *inode, struct file *file) \
@@ -3227,7 +3226,7 @@ binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer)
32273226
if (hlist_unhashed(&proc->deferred_work_node)) {
32283227
hlist_add_head(&proc->deferred_work_node,
32293228
&binder_deferred_list);
3230-
queue_work(binder_deferred_workqueue, &binder_deferred_work);
3229+
schedule_work(&binder_deferred_work);
32313230
}
32323231
mutex_unlock(&binder_deferred_lock);
32333232
}
@@ -3679,10 +3678,6 @@ static int __init binder_init(void)
36793678
{
36803679
int ret;
36813680

3682-
binder_deferred_workqueue = create_singlethread_workqueue("binder");
3683-
if (!binder_deferred_workqueue)
3684-
return -ENOMEM;
3685-
36863681
binder_debugfs_dir_entry_root = debugfs_create_dir("binder", NULL);
36873682
if (binder_debugfs_dir_entry_root)
36883683
binder_debugfs_dir_entry_proc = debugfs_create_dir("proc",

‎drivers/dma-buf/Kconfig‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,17 @@ config SYNC_FILE
1717
Files fds, to the DRM driver for example. More details at
1818
Documentation/sync_file.txt.
1919

20+
config SW_SYNC
21+
bool "Sync File Validation Framework"
22+
default n
23+
depends on SYNC_FILE
24+
depends on DEBUG_FS
25+
---help---
26+
A sync object driver that uses a 32bit counter to coordinate
27+
synchronization. Useful when there is no hardware primitive backing
28+
the synchronization.
29+
30+
WARNING: improper use of this can result in deadlocking kernel
31+
drivers from userspace. Intended for test and debug only.
32+
2033
endmenu

‎drivers/dma-buf/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
obj-y := dma-buf.o fence.o reservation.o seqno-fence.o fence-array.o
22
obj-$(CONFIG_SYNC_FILE) += sync_file.o
3+
obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o
Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* drivers/dma-buf/sw_sync.c
2+
* Sync File validation framework
33
*
44
* Copyright (C) 2012 Google, Inc.
55
*
@@ -23,8 +23,38 @@
2323
#include "sync_debug.h"
2424

2525
#define CREATE_TRACE_POINTS
26-
#include "trace/sync.h"
26+
#include "sync_trace.h"
2727

28+
/*
29+
* SW SYNC validation framework
30+
*
31+
* A sync object driver that uses a 32bit counter to coordinate
32+
* synchronization. Useful when there is no hardware primitive backing
33+
* the synchronization.
34+
*
35+
* To start the framework just open:
36+
*
37+
* <debugfs>/sync/sw_sync
38+
*
39+
* That will create a sync timeline, all fences created under this timeline
40+
* file descriptor will belong to the this timeline.
41+
*
42+
* The 'sw_sync' file can be opened many times as to create different
43+
* timelines.
44+
*
45+
* Fences can be created with SW_SYNC_IOC_CREATE_FENCE ioctl with struct
46+
* sw_sync_ioctl_create_fence as parameter.
47+
*
48+
* To increment the timeline counter, SW_SYNC_IOC_INC ioctl should be used
49+
* with the increment as u32. This will update the last signaled value
50+
* from the timeline and signal any fence that has a seqno smaller or equal
51+
* to it.
52+
*
53+
* struct sw_sync_ioctl_create_fence
54+
* @value: the seqno to initialise the fence with
55+
* @name: the name of the new sync point
56+
* @fence: return the fd of the new sync_file with the created fence
57+
*/
2858
struct sw_sync_create_fence_data {
2959
__u32 value;
3060
char name[32];
@@ -35,6 +65,7 @@ struct sw_sync_create_fence_data {
3565

3666
#define SW_SYNC_IOC_CREATE_FENCE _IOWR(SW_SYNC_IOC_MAGIC, 0,\
3767
struct sw_sync_create_fence_data)
68+
3869
#define SW_SYNC_IOC_INC _IOW(SW_SYNC_IOC_MAGIC, 1, __u32)
3970

4071
static const struct fence_ops timeline_fence_ops;
@@ -176,7 +207,7 @@ static void timeline_fence_release(struct fence *fence)
176207

177208
spin_lock_irqsave(fence->lock, flags);
178209
list_del(&pt->child_list);
179-
if (WARN_ON_ONCE(!list_empty(&pt->active_list)))
210+
if (!list_empty(&pt->active_list))
180211
list_del(&pt->active_list);
181212
spin_unlock_irqrestore(fence->lock, flags);
182213

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* drivers/base/sync.c
2+
* Sync File validation framework and debug information
33
*
44
* Copyright (C) 2012 Google, Inc.
55
*
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* include/linux/sync.h
2+
* Sync File validation framework and debug infomation
33
*
44
* Copyright (C) 2012 Google, Inc.
55
*
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#undef TRACE_SYSTEM
2-
#define TRACE_INCLUDE_PATH ../../drivers/staging/android/trace
3-
#define TRACE_SYSTEM sync
2+
#define TRACE_INCLUDE_PATH ../../drivers/dma-buf
3+
#define TRACE_SYSTEM sync_trace
44

55
#if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ)
66
#define _TRACE_SYNC_H
77

8-
#include "../sync_debug.h"
8+
#include "sync_debug.h"
99
#include <linux/tracepoint.h>
1010

1111
TRACE_EVENT(sync_timeline,

‎drivers/staging/android/Kconfig‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@ config ANDROID_LOW_MEMORY_KILLER
2424
scripts (/init.rc), and it defines priority values with minimum free memory size
2525
for each priority.
2626

27-
config SW_SYNC
28-
bool "Software synchronization framework"
29-
default n
30-
depends on SYNC_FILE
31-
depends on DEBUG_FS
32-
---help---
33-
A sync object driver that uses a 32bit counter to coordinate
34-
synchronization. Useful when there is no hardware primitive backing
35-
the synchronization.
36-
37-
WARNING: improper use of this can result in deadlocking kernel
38-
drivers from userspace. Intended for test and debug only.
39-
4027
source "drivers/staging/android/ion/Kconfig"
4128

4229
endif # if ANDROID

‎drivers/staging/android/Makefile‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ obj-y += ion/
44

55
obj-$(CONFIG_ASHMEM) += ashmem.o
66
obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o
7-
obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o

‎drivers/staging/android/ion/ion.c‎

Lines changed: 12 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -205,19 +205,16 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
205205
goto err2;
206206
}
207207

208-
buffer->dev = dev;
209-
buffer->size = len;
210-
211-
table = heap->ops->map_dma(heap, buffer);
212-
if (WARN_ONCE(table == NULL,
213-
"heap->ops->map_dma should return ERR_PTR on error"))
214-
table = ERR_PTR(-EINVAL);
215-
if (IS_ERR(table)) {
208+
if (buffer->sg_table == NULL) {
209+
WARN_ONCE(1, "This heap needs to set the sgtable");
216210
ret = -EINVAL;
217211
goto err1;
218212
}
219213

220-
buffer->sg_table = table;
214+
table = buffer->sg_table;
215+
buffer->dev = dev;
216+
buffer->size = len;
217+
221218
if (ion_buffer_fault_user_mappings(buffer)) {
222219
int num_pages = PAGE_ALIGN(buffer->size) / PAGE_SIZE;
223220
struct scatterlist *sg;
@@ -226,7 +223,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
226223
buffer->pages = vmalloc(sizeof(struct page *) * num_pages);
227224
if (!buffer->pages) {
228225
ret = -ENOMEM;
229-
goto err;
226+
goto err1;
230227
}
231228

232229
for_each_sg(table->sgl, sg, table->nents, i) {
@@ -260,8 +257,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
260257
mutex_unlock(&dev->buffer_lock);
261258
return buffer;
262259

263-
err:
264-
heap->ops->unmap_dma(heap, buffer);
265260
err1:
266261
heap->ops->free(buffer);
267262
err2:
@@ -273,7 +268,6 @@ void ion_buffer_destroy(struct ion_buffer *buffer)
273268
{
274269
if (WARN_ON(buffer->kmap_cnt > 0))
275270
buffer->heap->ops->unmap_kernel(buffer->heap, buffer);
276-
buffer->heap->ops->unmap_dma(buffer->heap, buffer);
277271
buffer->heap->ops->free(buffer);
278272
vfree(buffer->pages);
279273
kfree(buffer);
@@ -551,7 +545,8 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
551545
}
552546
EXPORT_SYMBOL(ion_alloc);
553547

554-
static void ion_free_nolock(struct ion_client *client, struct ion_handle *handle)
548+
static void ion_free_nolock(struct ion_client *client,
549+
struct ion_handle *handle)
555550
{
556551
bool valid_handle;
557552

@@ -576,32 +571,6 @@ void ion_free(struct ion_client *client, struct ion_handle *handle)
576571
}
577572
EXPORT_SYMBOL(ion_free);
578573

579-
int ion_phys(struct ion_client *client, struct ion_handle *handle,
580-
ion_phys_addr_t *addr, size_t *len)
581-
{
582-
struct ion_buffer *buffer;
583-
int ret;
584-
585-
mutex_lock(&client->lock);
586-
if (!ion_handle_validate(client, handle)) {
587-
mutex_unlock(&client->lock);
588-
return -EINVAL;
589-
}
590-
591-
buffer = handle->buffer;
592-
593-
if (!buffer->heap->ops->phys) {
594-
pr_err("%s: ion_phys is not implemented by this heap (name=%s, type=%d).\n",
595-
__func__, buffer->heap->name, buffer->heap->type);
596-
mutex_unlock(&client->lock);
597-
return -ENODEV;
598-
}
599-
mutex_unlock(&client->lock);
600-
ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
601-
return ret;
602-
}
603-
EXPORT_SYMBOL(ion_phys);
604-
605574
static void *ion_buffer_kmap_get(struct ion_buffer *buffer)
606575
{
607576
void *vaddr;
@@ -917,26 +886,6 @@ void ion_client_destroy(struct ion_client *client)
917886
}
918887
EXPORT_SYMBOL(ion_client_destroy);
919888

920-
struct sg_table *ion_sg_table(struct ion_client *client,
921-
struct ion_handle *handle)
922-
{
923-
struct ion_buffer *buffer;
924-
struct sg_table *table;
925-
926-
mutex_lock(&client->lock);
927-
if (!ion_handle_validate(client, handle)) {
928-
pr_err("%s: invalid handle passed to map_dma.\n",
929-
__func__);
930-
mutex_unlock(&client->lock);
931-
return ERR_PTR(-EINVAL);
932-
}
933-
buffer = handle->buffer;
934-
table = buffer->sg_table;
935-
mutex_unlock(&client->lock);
936-
return table;
937-
}
938-
EXPORT_SYMBOL(ion_sg_table);
939-
940889
static void ion_buffer_sync_for_device(struct ion_buffer *buffer,
941890
struct device *dev,
942891
enum dma_data_direction direction);
@@ -1358,7 +1307,8 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
13581307
struct ion_handle *handle;
13591308

13601309
mutex_lock(&client->lock);
1361-
handle = ion_handle_get_by_id_nolock(client, data.handle.handle);
1310+
handle = ion_handle_get_by_id_nolock(client,
1311+
data.handle.handle);
13621312
if (IS_ERR(handle)) {
13631313
mutex_unlock(&client->lock);
13641314
return PTR_ERR(handle);
@@ -1588,8 +1538,7 @@ void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
15881538
{
15891539
struct dentry *debug_file;
15901540

1591-
if (!heap->ops->allocate || !heap->ops->free || !heap->ops->map_dma ||
1592-
!heap->ops->unmap_dma)
1541+
if (!heap->ops->allocate || !heap->ops->free)
15931542
pr_err("%s: can not add heap with invalid ops struct.\n",
15941543
__func__);
15951544

@@ -1703,37 +1652,3 @@ void ion_device_destroy(struct ion_device *dev)
17031652
}
17041653
EXPORT_SYMBOL(ion_device_destroy);
17051654

1706-
void __init ion_reserve(struct ion_platform_data *data)
1707-
{
1708-
int i;
1709-
1710-
for (i = 0; i < data->nr; i++) {
1711-
if (data->heaps[i].size == 0)
1712-
continue;
1713-
1714-
if (data->heaps[i].base == 0) {
1715-
phys_addr_t paddr;
1716-
1717-
paddr = memblock_alloc_base(data->heaps[i].size,
1718-
data->heaps[i].align,
1719-
MEMBLOCK_ALLOC_ANYWHERE);
1720-
if (!paddr) {
1721-
pr_err("%s: error allocating memblock for heap %d\n",
1722-
__func__, i);
1723-
continue;
1724-
}
1725-
data->heaps[i].base = paddr;
1726-
} else {
1727-
int ret = memblock_reserve(data->heaps[i].base,
1728-
data->heaps[i].size);
1729-
if (ret)
1730-
pr_err("memblock reserve of %zx@%lx failed\n",
1731-
data->heaps[i].size,
1732-
data->heaps[i].base);
1733-
}
1734-
pr_info("%s: %s reserved base %lx size %zu\n", __func__,
1735-
data->heaps[i].name,
1736-
data->heaps[i].base,
1737-
data->heaps[i].size);
1738-
}
1739-
}

0 commit comments

Comments
 (0)