Re: [PATCH 2/2] arch: switch the default on ARCH_HAS_SG_CHAIN

2018-11-19 Thread Palmer Dabbelt
On Mon, 19 Nov 2018 05:58:52 PST (-0800), Christoph Hellwig wrote: On Fri, Nov 16, 2018 at 08:52:14AM -0800, Palmer Dabbelt wrote: As far as I can tell, it looks like m68k, mips, and powerpc mention an IOMMU in their ports, don't set ARCH_HAS_SG_CHAIN, and with this patch set won't set

[PATCH v2 04/17] locking/lockdep: Add DEFINE_TERMINAL_SPINLOCK() and related macros

2018-11-19 Thread Waiman Long
Add new DEFINE_RAW_TERMINAL_SPINLOCK() and DEFINE_TERMINAL_SPINLOCK() macro to define a raw terminal spinlock and a terminal spinlock. Signed-off-by: Waiman Long --- include/linux/spinlock_types.h | 34 +++--- kernel/printk/printk_safe.c| 2 +- 2 files changed,

[PATCH v2 06/17] debugobjects: Mark pool_lock as a terminal lock

2018-11-19 Thread Waiman Long
By marking the internal pool_lock as a terminal lock, lockdep will be able to skip full validation to improve locking performance. Signed-off-by: Waiman Long --- lib/debugobjects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index

[PATCH v2 02/17] locking/lockdep: Rework lockdep_set_novalidate_class()

2018-11-19 Thread Waiman Long
The current lockdep_set_novalidate_class() implementation is like a hack. It assigns a special class key for that lock and calls lockdep_init_map() twice. This patch changes the implementation to make it as a flag bit instead. This will allow other special locking class types to be defined and

[PATCH v2 03/17] locking/lockdep: Add a new terminal lock type

2018-11-19 Thread Waiman Long
A terminal lock is a lock where further locking or unlocking on another lock is not allowed. IOW, no forward dependency is permitted. With such a restriction in place, we don't really need to do a full validation of the lock chain involving a terminal lock. Instead, we just check if there is any

[PATCH v2 07/17] debugobjects: Move printk out of db lock critical sections

2018-11-19 Thread Waiman Long
The db->lock is a raw spinlock and so the lock hold time is supposed to be short. This will not be the case when printk() is being involved in some of the critical sections. In order to avoid the long hold time, in case some messages need to be printed, the debug_object_is_on_stack() and

[PATCH v2 05/17] printk: Mark logbuf_lock & console_owner_lock as terminal locks

2018-11-19 Thread Waiman Long
By marking logbuf_lock and console_owner_lock as terminal locks, it reduces the performance overhead when those locks are used with lockdep enabled. Signed-off-by: Waiman Long --- kernel/printk/printk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH v2 01/17] locking/lockdep: Remove version from lock_class structure

2018-11-19 Thread Waiman Long
It turns out the version field in the lock_class structure isn't used anywhere. Just remove it. Signed-off-by: Waiman Long --- include/linux/lockdep.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 1fd82ff..c5335df 100644 ---

[PATCH v2 00/17] locking/lockdep: Add a new class of terminal locks

2018-11-19 Thread Waiman Long
v1->v2: - Mark more locks as terminal. - Add a patch to remove the unused version field from lock_class. - Steal some bits from pin_count of held_lock for flags. - Add a patch to warn if a task holding a raw spinlock is acquiring an non-raw lock. The purpose of this patchset is to

Re: [RFC PATCH 0/5] iommu: APIs for paravirtual PASID allocation

2018-11-19 Thread Yi Sun
On 18-11-19 11:36:48, Konrad Rzeszutek Wilk wrote: > On Mon, Nov 12, 2018 at 02:44:56PM +0800, Lu Baolu wrote: > > This adds an uniformed API set for global PASIDs used by IOMMU > > and device drivers which depend on IOMMU. It works for drivers > > running on bare metal, full virtualized

Re: [PATCH RFC] dma-direct: do not allocate a single page from CMA area

2018-11-19 Thread Nicolin Chen
Robin? Christ? On Mon, Nov 05, 2018 at 02:40:50PM -0800, Nicolin Chen wrote: > On Fri, Nov 02, 2018 at 07:35:42AM +0100, Christoph Hellwig wrote: > > On Thu, Nov 01, 2018 at 02:07:55PM +, Robin Murphy wrote: > > > On 31/10/2018 20:03, Nicolin Chen wrote: > > >> The addresses within a single

Re: [PATCH 06/10] swiotlb: use swiotlb_map_page in swiotlb_map_sg_attrs

2018-11-19 Thread John Stultz
On Wed, Nov 14, 2018 at 8:12 AM Christoph Hellwig wrote: > > On Wed, Nov 14, 2018 at 03:13:11PM +0100, Christoph Hellwig wrote: > > Does the patch below make a difference for you? Assigning an > > address to the S/G list is the only functional difference I could > > spot. Drivers really should

[PATCH v2 16/17] delay_acct: Mark task's delays->lock as terminal spinlock

2018-11-19 Thread Waiman Long
By making task's delays->lock a terminal spinlock, it reduces the lockdep overhead when this lock is used. Signed-off-by: Waiman Long --- kernel/delayacct.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/delayacct.c b/kernel/delayacct.c index 2a12b98..49dd8d3

[PATCH v2 09/17] debugobjects: Make object hash locks nestable terminal locks

2018-11-19 Thread Waiman Long
By making the object hash locks nestable terminal locks, we can avoid a bunch of unnecessary lockdep validations as well as saving space in the lockdep tables. Signed-off-by: Waiman Long --- lib/debugobjects.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

[PATCH v2 08/17] locking/lockdep: Add support for nestable terminal locks

2018-11-19 Thread Waiman Long
There are use cases where we want to allow nesting of one terminal lock underneath another terminal-like lock. That new lock type is called nestable terminal lock which can optionally allow the acquisition of no more than one regular (non-nestable) terminal lock underneath it. Signed-off-by:

[PATCH v2 15/17] kernfs: Mark kernfs_open_node_lock as terminal lock

2018-11-19 Thread Waiman Long
By making kernfs_open_node_lock a terminal spinlock, it reduces the lockdep overhead when this lock is used. Signed-off-by: Waiman Long --- fs/kernfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index dbf5bc2..a86fe22 100644 ---

[PATCH v2 10/17] lib/stackdepot: Make depot_lock a terminal spinlock

2018-11-19 Thread Waiman Long
By defining depot_lock as a terminal spinlock, it reduces the lockdep overhead when this lock is being used. Signed-off-by: Waiman Long --- lib/stackdepot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stackdepot.c b/lib/stackdepot.c index e513459..fb17888 100644 ---

[PATCH v2 12/17] cgroup: Mark the rstat percpu lock as terminal

2018-11-19 Thread Waiman Long
By classifying the cgroup rstat percpu locks as terminal locks, it reduces the lockdep overhead when these locks are being used. Signed-off-by: Waiman Long --- kernel/cgroup/rstat.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/cgroup/rstat.c

[PATCH v2 11/17] locking/rwsem: Mark rwsem.wait_lock as a terminal lock

2018-11-19 Thread Waiman Long
The wait_lock in a rwsem is always acquired with IRQ disabled. For the rwsem-xadd.c implementation, no other lock will be called while holding the wait_lock. So it satisfies the condition of being a terminal lock. By marking it as terminal, the lockdep overhead will be reduced. Signed-off-by:

[PATCH v2 17/17] locking/lockdep: Check raw/non-raw locking conflicts

2018-11-19 Thread Waiman Long
A task holding a raw spinlock should not acquire a non-raw lock as that will break PREEMPT_RT kernel. Checking is now added and a lockdep warning will be printed if that happens. Signed-off-by: Waiman Long --- include/linux/lockdep.h | 6 ++ include/linux/spinlock_types.h | 4

[PATCH v2 14/17] dma-debug: Mark free_entries_lock as terminal

2018-11-19 Thread Waiman Long
By making free_entries_lock a terminal spinlock, it reduces the lockdep overhead when this lock is used. Signed-off-by: Waiman Long --- kernel/dma/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c index 231ca46..f891688 100644

[PATCH v2 13/17] mm/kasan: Make quarantine_lock a terminal lock

2018-11-19 Thread Waiman Long
By making quarantine_lock a terminal spinlock, it reduces the lockdep overhead when this lock is being used. Signed-off-by: Waiman Long --- mm/kasan/quarantine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c index

Re: [PATCH 1/2] dma-mapping: remove ->mapping_error

2018-11-19 Thread Christoph Hellwig
On Fri, Nov 09, 2018 at 02:41:18PM +, Robin Murphy wrote: >> - >> #define CMD_SET_TYPE(cmd, t) ((cmd)->data[1] |= ((t) << 28)) >> #define LOOP_TIMEOUT 10 >> @@ -2339,7 +2337,7 @@ static dma_addr_t __map_single(struct device *dev, >> paddr &= PAGE_MASK; >> address =

Re: [RFC] remove the ->mapping_error method from dma_map_ops

2018-11-19 Thread Christoph Hellwig
On Fri, Nov 09, 2018 at 03:12:34PM -0800, David Miller wrote: > But patch #2 on the other hand, not so much. > > I hate seeing values returned by reference, it adds cost especially > on cpus where all argments and return values fit in registers (we end > up forcing a stack slot and memory

Re: [PATCH 2/2] arch: switch the default on ARCH_HAS_SG_CHAIN

2018-11-19 Thread Christoph Hellwig
On Fri, Nov 16, 2018 at 08:52:14AM -0800, Palmer Dabbelt wrote: > As far as I can tell, it looks like m68k, mips, and powerpc mention an > IOMMU in their ports, don't set ARCH_HAS_SG_CHAIN, and with this patch set > won't set ARCH_NO_SG_CHAIN. m68k has no iommu, and not operations that operate

Re: [PATCH 5/5] dma-direct: always allow dma mask <= physiscal memory size

2018-11-19 Thread Ramon Fried
On Tue, Oct 9, 2018 at 8:02 AM Benjamin Herrenschmidt wrote: > > On Wed, 2018-10-03 at 16:10 -0700, Alexander Duyck wrote: > > > -* Because 32-bit DMA masks are so common we expect every > > > architecture > > > -* to be able to satisfy them - either by not supporting more > > >

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-19 Thread Souptick Joarder
Hi Mike, On Sat, Nov 17, 2018 at 8:07 PM Matthew Wilcox wrote: > > On Sat, Nov 17, 2018 at 12:26:38PM +0530, Souptick Joarder wrote: > > On Fri, Nov 16, 2018 at 11:59 PM Mike Rapoport wrote: > > > > + * vm_insert_range - insert range of kernel pages into user vma > > > > + * @vma: user vma to

Re: [PATCH 5/5] dma-direct: always allow dma mask <= physiscal memory size

2018-11-19 Thread Robin Murphy
On 19/11/2018 14:18, Ramon Fried wrote: On Tue, Oct 9, 2018 at 8:02 AM Benjamin Herrenschmidt wrote: On Wed, 2018-10-03 at 16:10 -0700, Alexander Duyck wrote: -* Because 32-bit DMA masks are so common we expect every architecture -* to be able to satisfy them - either by not

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-19 Thread Mike Rapoport
On Mon, Nov 19, 2018 at 08:43:09PM +0530, Souptick Joarder wrote: > Hi Mike, > > On Sat, Nov 17, 2018 at 8:07 PM Matthew Wilcox wrote: > > > > On Sat, Nov 17, 2018 at 12:26:38PM +0530, Souptick Joarder wrote: > > > On Fri, Nov 16, 2018 at 11:59 PM Mike Rapoport wrote: > > > > > + *

Re: [RFC PATCH 0/5] iommu: APIs for paravirtual PASID allocation

2018-11-19 Thread Konrad Rzeszutek Wilk
On Mon, Nov 12, 2018 at 02:44:56PM +0800, Lu Baolu wrote: > This adds an uniformed API set for global PASIDs used by IOMMU > and device drivers which depend on IOMMU. It works for drivers > running on bare metal, full virtualized environments and para- > virtualized environment. > Are there also

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-19 Thread Souptick Joarder
On Mon, Nov 19, 2018 at 9:56 PM Mike Rapoport wrote: > > On Mon, Nov 19, 2018 at 08:43:09PM +0530, Souptick Joarder wrote: > > Hi Mike, > > > > On Sat, Nov 17, 2018 at 8:07 PM Matthew Wilcox wrote: > > > > > > On Sat, Nov 17, 2018 at 12:26:38PM +0530, Souptick Joarder wrote: > > > > On Fri, Nov

Re: [PATCH 06/10] swiotlb: use swiotlb_map_page in swiotlb_map_sg_attrs

2018-11-19 Thread Robin Murphy
On 09/11/2018 16:37, Robin Murphy wrote: On 09/11/2018 07:49, Christoph Hellwig wrote: On Tue, Nov 06, 2018 at 05:27:14PM -0800, John Stultz wrote: But at that point if I just re-apply "swiotlb: use swiotlb_map_page in swiotlb_map_sg_attrs", I reproduce the hangs. Any suggestions for how to