On 2017-04-26 06:13 AM, Christian König wrote:
> Am 26.04.2017 um 11:59 schrieb Dave Airlie:
>> On 26 April 2017 at 17:20, Christian König <deathsimple(a)vodafone.de>
>> wrote:
>>> NAK, I'm wondering how often I have to reject that change. We should
>>> probably add a comment here.
>>>
>>> Even with a zero timeout we still need to enable signaling, otherwise
>>> some
>>> fence will never signal if userspace just polls on them.
>>>
>>> If a caller is only interested in the fence status without enabling the
>>> signaling it should call dma_fence_is_signaled() instead.
>> Can we not move the return 0 (with spin unlock) down after we enabling
>> signalling, but before
>> we enter the schedule_timeout(1)?
>
> Yes, that would be an option.
>
I was actually arguing with Dave about this on IRC yesterday. Seems like
I owe him a beer now.
-Andres
> Christian.
>
>>
>> Dave.
>
>
On 26 April 2017 at 17:20, Christian König <deathsimple(a)vodafone.de> wrote:
> NAK, I'm wondering how often I have to reject that change. We should
> probably add a comment here.
>
> Even with a zero timeout we still need to enable signaling, otherwise some
> fence will never signal if userspace just polls on them.
>
> If a caller is only interested in the fence status without enabling the
> signaling it should call dma_fence_is_signaled() instead.
Can we not move the return 0 (with spin unlock) down after we enabling
signalling, but before
we enter the schedule_timeout(1)?
Dave.
CC a few extra lists I missed.
Regards,
Andres
On 2017-04-25 09:36 PM, Andres Rodriguez wrote:
> When a timeout of zero is specified, the caller is only interested in
> the fence status.
>
> In the current implementation, dma_fence_default_wait will always call
> schedule_timeout() at least once for an unsignaled fence. This adds a
> significant overhead to a fence status query.
>
> Avoid this overhead by returning early if a zero timeout is specified.
>
> Signed-off-by: Andres Rodriguez <andresx7(a)gmail.com>
> ---
>
> This heavily affects the performance of the Source2 engine running on
> radv.
>
> This patch improves dota2(radv) perf on a i7-6700k+RX480 system from
> 72fps->81fps.
>
> drivers/dma-buf/dma-fence.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> index 0918d3f..348e9e2 100644
> --- a/drivers/dma-buf/dma-fence.c
> +++ b/drivers/dma-buf/dma-fence.c
> @@ -380,6 +380,9 @@ dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
> if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
> return ret;
>
> + if (!timeout)
> + return 0;
> +
> spin_lock_irqsave(fence->lock, flags);
>
> if (intr && signal_pending(current)) {
>
Hi,
This is v4 of the series to cleanup to Ion. Greg took some of the patches
that weren't CMA related already. There was a minor bisectability problem
with the CMA APIs so this is a new version to address that. I also
addressed some minor comments on the patch to collapse header files.
Thanks,
Laura
Laura Abbott (12):
cma: Store a name in the cma structure
cma: Introduce cma_for_each_area
staging: android: ion: Use CMA APIs directly
staging: android: ion: Stop butchering the DMA address
staging: android: ion: Break the ABI in the name of forward progress
staging: android: ion: Get rid of ion_phys_addr_t
staging: android: ion: Collapse internal header files
staging: android: ion: Rework heap registration/enumeration
staging: android: ion: Drop ion_map_kernel interface
staging: android: ion: Remove ion_handle and ion_client
staging: android: ion: Set query return value
staging/android: Update Ion TODO list
arch/powerpc/kvm/book3s_hv_builtin.c | 3 +-
drivers/base/dma-contiguous.c | 5 +-
drivers/staging/android/TODO | 21 +-
drivers/staging/android/ion/Kconfig | 32 +
drivers/staging/android/ion/Makefile | 11 +-
drivers/staging/android/ion/compat_ion.c | 152 -----
drivers/staging/android/ion/compat_ion.h | 29 -
drivers/staging/android/ion/ion-ioctl.c | 55 +-
drivers/staging/android/ion/ion.c | 812 ++----------------------
drivers/staging/android/ion/ion.h | 386 ++++++++---
drivers/staging/android/ion/ion_carveout_heap.c | 21 +-
drivers/staging/android/ion/ion_chunk_heap.c | 16 +-
drivers/staging/android/ion/ion_cma_heap.c | 120 ++--
drivers/staging/android/ion/ion_heap.c | 68 --
drivers/staging/android/ion/ion_page_pool.c | 3 +-
drivers/staging/android/ion/ion_priv.h | 453 -------------
drivers/staging/android/ion/ion_system_heap.c | 39 +-
drivers/staging/android/uapi/ion.h | 36 +-
include/linux/cma.h | 6 +-
mm/cma.c | 31 +-
mm/cma.h | 1 +
mm/cma_debug.c | 2 +-
22 files changed, 524 insertions(+), 1778 deletions(-)
delete mode 100644 drivers/staging/android/ion/compat_ion.c
delete mode 100644 drivers/staging/android/ion/compat_ion.h
delete mode 100644 drivers/staging/android/ion/ion_priv.h
--
2.7.4
Hi,
This is v3 of the series to do some serious Ion cleanup in preparation for
moving out of staging. I didn't hear much on v2 so I'm going to assume
people are okay with the series as is. I know there were still some open
questions about moving away from /dev/ion but in the interest of small
steps I'd like to go ahead and merge this series assuming there are no more
major objections. More work can happen on top of this.
Changes from v2:
- Dropped the RFC tag
- Minor bisectability fixes
- Sumit's comment about CMA naming
- Updated the TODO list
Thanks,
Laura
Laura Abbott (22):
cma: Store a name in the cma structure
cma: Introduce cma_for_each_area
staging: android: ion: Remove dmap_cnt
staging: android: ion: Remove alignment from allocation field
staging: android: ion: Duplicate sg_table
staging: android: ion: Call dma_map_sg for syncing and mapping
staging: android: ion: Remove page faulting support
staging: android: ion: Remove crufty cache support
staging: android: ion: Remove custom ioctl interface
staging: android: ion: Remove import interface
staging: android: ion: Remove duplicate ION_IOC_MAP
staging: android: ion: Remove old platform support
staging: android: ion: Use CMA APIs directly
staging: android: ion: Stop butchering the DMA address
staging: android: ion: Break the ABI in the name of forward progress
staging: android: ion: Get rid of ion_phys_addr_t
staging: android: ion: Collapse internal header files
staging: android: ion: Rework heap registration/enumeration
staging: android: ion: Drop ion_map_kernel interface
staging: android: ion: Remove ion_handle and ion_client
staging: android: ion: Set query return value
staging/android: Update Ion TODO list
arch/powerpc/kvm/book3s_hv_builtin.c | 3 +-
drivers/base/dma-contiguous.c | 5 +-
drivers/staging/android/TODO | 21 +-
drivers/staging/android/ion/Kconfig | 56 +-
drivers/staging/android/ion/Makefile | 18 +-
drivers/staging/android/ion/compat_ion.c | 195 ----
drivers/staging/android/ion/compat_ion.h | 29 -
drivers/staging/android/ion/hisilicon/Kconfig | 5 -
drivers/staging/android/ion/hisilicon/Makefile | 1 -
drivers/staging/android/ion/hisilicon/hi6220_ion.c | 113 --
drivers/staging/android/ion/ion-ioctl.c | 85 +-
drivers/staging/android/ion/ion.c | 1168 +++-----------------
drivers/staging/android/ion/ion.h | 389 +++++--
drivers/staging/android/ion/ion_carveout_heap.c | 37 +-
drivers/staging/android/ion/ion_chunk_heap.c | 27 +-
drivers/staging/android/ion/ion_cma_heap.c | 125 +--
drivers/staging/android/ion/ion_dummy_driver.c | 155 ---
drivers/staging/android/ion/ion_heap.c | 68 --
drivers/staging/android/ion/ion_of.c | 184 ---
drivers/staging/android/ion/ion_of.h | 37 -
drivers/staging/android/ion/ion_page_pool.c | 6 +-
drivers/staging/android/ion/ion_priv.h | 473 --------
drivers/staging/android/ion/ion_system_heap.c | 53 +-
drivers/staging/android/ion/ion_test.c | 305 -----
drivers/staging/android/ion/tegra/Makefile | 1 -
drivers/staging/android/ion/tegra/tegra_ion.c | 80 --
drivers/staging/android/uapi/ion.h | 86 +-
drivers/staging/android/uapi/ion_test.h | 69 --
include/linux/cma.h | 6 +-
mm/cma.c | 31 +-
mm/cma.h | 1 +
mm/cma_debug.c | 2 +-
32 files changed, 620 insertions(+), 3214 deletions(-)
delete mode 100644 drivers/staging/android/ion/compat_ion.c
delete mode 100644 drivers/staging/android/ion/compat_ion.h
delete mode 100644 drivers/staging/android/ion/hisilicon/Kconfig
delete mode 100644 drivers/staging/android/ion/hisilicon/Makefile
delete mode 100644 drivers/staging/android/ion/hisilicon/hi6220_ion.c
delete mode 100644 drivers/staging/android/ion/ion_dummy_driver.c
delete mode 100644 drivers/staging/android/ion/ion_of.c
delete mode 100644 drivers/staging/android/ion/ion_of.h
delete mode 100644 drivers/staging/android/ion/ion_priv.h
delete mode 100644 drivers/staging/android/ion/ion_test.c
delete mode 100644 drivers/staging/android/ion/tegra/Makefile
delete mode 100644 drivers/staging/android/ion/tegra/tegra_ion.c
delete mode 100644 drivers/staging/android/uapi/ion_test.h
--
2.7.4
On 04/08/2017 11:12 AM, Emil Velikov wrote:
> Hi Laura,
>
> Couple of trivial nitpicks below.
>
> On 3 April 2017 at 19:57, Laura Abbott <labbott(a)redhat.com> wrote:
>
>> --- a/drivers/staging/android/ion/ion.h
>> +++ b/drivers/staging/android/ion/ion.h
>> @@ -1,5 +1,5 @@
>> /*
>> - * drivers/staging/android/ion/ion.h
>> + * drivers/staging/android/ion/ion_priv.h
> Does not match the actual filename.
>
>> *
>> * Copyright (C) 2011 Google, Inc.
>> *
>> @@ -14,24 +14,26 @@
>> *
>> */
>>
>> -#ifndef _LINUX_ION_H
>> -#define _LINUX_ION_H
>> +#ifndef _ION_PRIV_H
>> +#define _ION_PRIV_H
>>
> Ditto.
>
>> +#include <linux/device.h>
>> +#include <linux/dma-direction.h>
>> +#include <linux/kref.h>
>> +#include <linux/mm_types.h>
>> +#include <linux/mutex.h>
>> +#include <linux/rbtree.h>
>> +#include <linux/sched.h>
>> +#include <linux/shrinker.h>
>> #include <linux/types.h>
>> +#include <linux/miscdevice.h>
>>
>> #include "../uapi/ion.h"
>>
> You don't want to use "../" in includes. Perhaps address with another
> patch, if you haven't already ?
>
There isn't a better option until this driver moves out of staging.
Once it moves out it can be fixed up.
Thanks,
Laura
> Regards,
> Emil
>
Hi,
This is v2 of the series to do some serious Ion clean up in preparation for
moving out of staging. I got good feedback last time so this series mostly
attempts to address that feedback and do more still more cleanup. Highlights:
- All calls to DMA APIs should now be with a real actual proper device
structure
- Patch to stop setting sg_dma_address manually now included
- Fix for a bug in the query interface
- Removal of custom ioctl interface
- Removal of import interface
- Removal of any notion of using Ion as an in kernel interface.
- Cleanup of ABI so compat interface is no longer needed
- Deletion of a bit more platform code
- Combined heap enumeration and heap registration code up so there are fewer
layers of abstraction
- Some general cleanup and header reduction.
- Removal of both the ion_client and ion_handle structures since these mostly
become redundant. As a result, Ion only returns a dma_buf fd. The overall
result is that the only Ion interfaces are the query ioctl and the alloc
ioctl.
The following are still TODOs/open problems:
- Sumit's comments about the CMA naming.
- Bindings/platform for chunk and carveout heap
- There was some discussion about making the sg_table duplication generic. I
got bogged down in handling some of the edge cases for generic handling
so I put this aside. Making it generic is still something that should happen.
- More fine-grained support for restricting heap access. There are good
arguments to be made for having a way for having good integration with
selinux and other policy mechanisms.
- While not on the original list, there is still no good good test standalone
test framework. I noticed that the existing ion_test was fairly generic so I
proposed moving it to dma_buf. Daniel Vetter suggested just using the VGEM
module instead. Ideally, the tests can live as part of some other existing
test set (drm tests maybe?)
Feedback appreciated as always.
Thanks,
Laura
Laura Abbott (21):
cma: Store a name in the cma structure
cma: Introduce cma_for_each_area
staging: android: ion: Remove dmap_cnt
staging: android: ion: Remove alignment from allocation field
staging: android: ion: Duplicate sg_table
staging: android: ion: Call dma_map_sg for syncing and mapping
staging: android: ion: Remove page faulting support
staging: android: ion: Remove crufty cache support
staging: android: ion: Remove custom ioctl interface
staging: android: ion: Remove import interface
staging: android: ion: Remove duplicate ION_IOC_MAP
staging: android: ion: Remove old platform support
staging: android: ion: Use CMA APIs directly
staging: android: ion: Stop butchering the DMA address
staging: android: ion: Break the ABI in the name of forward progress
staging: android: ion: Get rid of ion_phys_addr_t
staging: android: ion: Collapse internal header files
staging: android: ion: Rework heap registration/enumeration
staging: android: ion: Drop ion_map_kernel interface
staging: android: ion: Remove ion_handle and ion_client
staging: android: ion: Set query return value
drivers/base/dma-contiguous.c | 5 +-
drivers/staging/android/ion/Kconfig | 56 +-
drivers/staging/android/ion/Makefile | 18 +-
drivers/staging/android/ion/compat_ion.c | 195 ----
drivers/staging/android/ion/compat_ion.h | 29 -
drivers/staging/android/ion/hisilicon/Kconfig | 5 -
drivers/staging/android/ion/hisilicon/Makefile | 1 -
drivers/staging/android/ion/hisilicon/hi6220_ion.c | 113 --
drivers/staging/android/ion/ion-ioctl.c | 85 +-
drivers/staging/android/ion/ion.c | 1164 +++-----------------
drivers/staging/android/ion/ion.h | 393 +++++--
drivers/staging/android/ion/ion_carveout_heap.c | 37 +-
drivers/staging/android/ion/ion_chunk_heap.c | 27 +-
drivers/staging/android/ion/ion_cma_heap.c | 125 +--
drivers/staging/android/ion/ion_dummy_driver.c | 156 ---
drivers/staging/android/ion/ion_heap.c | 68 --
drivers/staging/android/ion/ion_of.c | 184 ----
drivers/staging/android/ion/ion_of.h | 37 -
drivers/staging/android/ion/ion_page_pool.c | 6 +-
drivers/staging/android/ion/ion_priv.h | 473 --------
drivers/staging/android/ion/ion_system_heap.c | 53 +-
drivers/staging/android/ion/ion_test.c | 305 -----
drivers/staging/android/ion/tegra/Makefile | 1 -
drivers/staging/android/ion/tegra/tegra_ion.c | 80 --
drivers/staging/android/uapi/ion.h | 86 +-
drivers/staging/android/uapi/ion_test.h | 69 --
include/linux/cma.h | 6 +-
mm/cma.c | 25 +-
mm/cma.h | 1 +
mm/cma_debug.c | 2 +-
30 files changed, 610 insertions(+), 3195 deletions(-)
delete mode 100644 drivers/staging/android/ion/compat_ion.c
delete mode 100644 drivers/staging/android/ion/compat_ion.h
delete mode 100644 drivers/staging/android/ion/hisilicon/Kconfig
delete mode 100644 drivers/staging/android/ion/hisilicon/Makefile
delete mode 100644 drivers/staging/android/ion/hisilicon/hi6220_ion.c
delete mode 100644 drivers/staging/android/ion/ion_dummy_driver.c
delete mode 100644 drivers/staging/android/ion/ion_of.c
delete mode 100644 drivers/staging/android/ion/ion_of.h
delete mode 100644 drivers/staging/android/ion/ion_priv.h
delete mode 100644 drivers/staging/android/ion/ion_test.c
delete mode 100644 drivers/staging/android/ion/tegra/Makefile
delete mode 100644 drivers/staging/android/ion/tegra/tegra_ion.c
delete mode 100644 drivers/staging/android/uapi/ion_test.h
--
2.7.4
Hi,
There's been some recent discussions[1] about Ion-like frameworks. There's
apparently interest in just keeping Ion since it works reasonablly well.
This series does what should be the final clean ups for it to possibly be
moved out of staging.
This includes the following:
- Some general clean up and removal of features that never got a lot of use
as far as I can tell.
- Fixing up the caching. This is the series I proposed back in December[2]
but never heard any feedback on. It will certainly break existing
applications that rely on the implicit caching. I'd rather make an effort
to move to a model that isn't going directly against the establishement
though.
- Fixing up the platform support. The devicetree approach was never well
recieved by DT maintainers. The proposal here is to think of Ion less as
specifying requirements and more of a framework for exposing memory to
userspace.
- CMA allocations now happen without the need of a dummy device structure.
This fixes a bunch of the reasons why I attempted to add devicetree
support before.
I've had problems getting feedback in the past so if I don't hear any major
objections I'm going to send out with the RFC dropped to be picked up.
The only reason there isn't a patch to come out of staging is to discuss any
other changes to the ABI people might want. Once this comes out of staging,
I really don't want to mess with the ABI.
Feedback appreciated.
Thanks,
Laura
[1] https://marc.info/?l=linux-kernel&m=148699712602105&w=2
[2] https://marc.info/?l=linaro-mm-sig&m=148176050802908&w=2
Laura Abbott (12):
staging: android: ion: Remove dmap_cnt
staging: android: ion: Remove alignment from allocation field
staging: android: ion: Duplicate sg_table
staging: android: ion: Call dma_map_sg for syncing and mapping
staging: android: ion: Remove page faulting support
staging: android: ion: Remove crufty cache support
staging: android: ion: Remove old platform support
cma: Store a name in the cma structure
cma: Introduce cma_for_each_area
staging: android: ion: Use CMA APIs directly
staging: android: ion: Make Ion heaps selectable
staging; android: ion: Enumerate all available heaps
drivers/base/dma-contiguous.c | 5 +-
drivers/staging/android/ion/Kconfig | 51 ++--
drivers/staging/android/ion/Makefile | 14 +-
drivers/staging/android/ion/hisilicon/Kconfig | 5 -
drivers/staging/android/ion/hisilicon/Makefile | 1 -
drivers/staging/android/ion/hisilicon/hi6220_ion.c | 113 ---------
drivers/staging/android/ion/ion-ioctl.c | 6 -
drivers/staging/android/ion/ion.c | 282 ++++++---------------
drivers/staging/android/ion/ion.h | 5 +-
drivers/staging/android/ion/ion_carveout_heap.c | 16 +-
drivers/staging/android/ion/ion_chunk_heap.c | 15 +-
drivers/staging/android/ion/ion_cma_heap.c | 102 ++------
drivers/staging/android/ion/ion_dummy_driver.c | 156 ------------
drivers/staging/android/ion/ion_enumerate.c | 89 +++++++
drivers/staging/android/ion/ion_of.c | 184 --------------
drivers/staging/android/ion/ion_of.h | 37 ---
drivers/staging/android/ion/ion_page_pool.c | 3 -
drivers/staging/android/ion/ion_priv.h | 57 ++++-
drivers/staging/android/ion/ion_system_heap.c | 14 +-
drivers/staging/android/ion/tegra/Makefile | 1 -
drivers/staging/android/ion/tegra/tegra_ion.c | 80 ------
include/linux/cma.h | 6 +-
mm/cma.c | 25 +-
mm/cma.h | 1 +
mm/cma_debug.c | 2 +-
25 files changed, 312 insertions(+), 958 deletions(-)
delete mode 100644 drivers/staging/android/ion/hisilicon/Kconfig
delete mode 100644 drivers/staging/android/ion/hisilicon/Makefile
delete mode 100644 drivers/staging/android/ion/hisilicon/hi6220_ion.c
delete mode 100644 drivers/staging/android/ion/ion_dummy_driver.c
create mode 100644 drivers/staging/android/ion/ion_enumerate.c
delete mode 100644 drivers/staging/android/ion/ion_of.c
delete mode 100644 drivers/staging/android/ion/ion_of.h
delete mode 100644 drivers/staging/android/ion/tegra/Makefile
delete mode 100644 drivers/staging/android/ion/tegra/tegra_ion.c
--
2.7.4