Skip to contentSkip to conversation

3.0.8-rt22

ANNOUNCE Thomas Gleixner 3 participants 5 messages Nov 7, 2011 – Nov 9, 2011

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

Dear RT Folks,

I'm pleased to announce the 3.0.8-rt21 release.

3.0.8-rt21 is an not announced intermediate release, which only updates to 3.0.8. No rt changes except dropping patches which made it into 3.0.8.

Changes from 3.0.8-rt21 to 3.0.8-rt22

* Revert cpufreq changes

* Fix some hotplug issues (Yong, myself)

* Require constant freq TSC for KVM on RT (replaces the cpufreq tinkering which led to other nasty issues)

Delta patch against 3.0.8-rt21

https://tglx.de/~tglx/rt/incr/patch-3.0.8-rt21-rt22.patch.gz

also appended below.

Patch against 3.0.8 can be found here:

https://tglx.de/~tglx/rt/patch-3.0.8-rt22.patch.gz

The split quilt queue is available at:

https://tglx.de/~tglx/rt/patches-3.0.8-rt22.tar.gz

Some folks were asking about an 3.1 based RT. I'm not going to release one (though it should be trivial). I really want to stabilize 3.0 and not create a side show which diverts testing. Next version I'm targeting is 3.2 starting soon after the merge window closes.

Enjoy,

tglx

--------------->

drivers/cpufreq/cpufreq.c +25 -31
Index: linux-2.6/drivers/cpufreq/cpufreq.c
===================================================================
@@ -43,7 +43,7 @@ static DEFINE_PER_CPU(struct cpufreq_pol
 /* This one keeps track of the previously set governor of a removed CPU */
 static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);
 #endif
-static DEFINE_RAW_SPINLOCK(cpufreq_driver_lock);
+static DEFINE_SPINLOCK(cpufreq_driver_lock);
 
 /*
  * cpu_policy_rwsem is a per CPU reader-writer semaphore designed to cure
@@ -138,7 +138,7 @@ struct cpufreq_policy *cpufreq_cpu_get(u
 		goto err_out;
 
 	/* get the cpufreq driver */
-	raw_spin_lock_irqsave(&cpufreq_driver_lock, flags);
+	spin_lock_irqsave(&cpufreq_driver_lock, flags);
 
 	if (!cpufreq_driver)
 		goto err_out_unlock;
@@ -156,13 +156,13 @@ struct cpufreq_policy *cpufreq_cpu_get(u
 	if (!kobject_get(&data->kobj))
 		goto err_out_put_module;
 
-	raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
+	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 	return data;
 
 err_out_put_module:
 	module_put(cpufreq_driver->owner);
 err_out_unlock:
-	raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
+	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 err_out:
 	return NULL;
 }
@@ -722,10 +722,10 @@ static int cpufreq_add_dev_policy(unsign
 				return -EBUSY;
 			}
 
-			raw_spin_lock_irqsave(&cpufreq_driver_lock, flags);
+			spin_lock_irqsave(&cpufreq_driver_lock, flags);
 			cpumask_copy(managed_policy->cpus, policy->cpus);
 			per_cpu(cpufreq_cpu_data, cpu) = managed_policy;
-			raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
+			spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
 			pr_debug("CPU already managed, adding link\n");
 			ret = sysfs_create_link(&sys_dev->kobj,
@@ -821,16 +821,14 @@ static int cpufreq_add_dev_interface(uns
 			goto err_out_kobj_put;
 	}
 
-	get_online_cpus();
+	spin_lock_irqsave(&cpufreq_driver_lock, flags);
 	for_each_cpu(j, policy->cpus) {
 		if (!cpu_online(j))
 			continue;
-		raw_spin_lock_irqsave(&cpufreq_driver_lock, flags);
 		per_cpu(cpufreq_cpu_data, j) = policy;
 		per_cpu(cpufreq_policy_cpu, j) = policy->cpu;
-		raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 	}
-	put_online_cpus();
+	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
 	ret = cpufreq_add_dev_symlink(cpu, policy);
 	if (ret)
@@ -972,13 +970,10 @@ static int cpufreq_add_dev(struct sys_de
 
 
 err_out_unregister:
-	get_online_cpus();
-	for_each_cpu(j, policy->cpus) {
-		raw_spin_lock_irqsave(&cpufreq_driver_lock, flags);
+	spin_lock_irqsave(&cpufreq_driver_lock, flags);
+	for_each_cpu(j, policy->cpus)
 		per_cpu(cpufreq_cpu_data, j) = NULL;
-		raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
-	}
-	put_online_cpus();
+	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
 	kobject_put(&policy->kobj);
 	wait_for_completion(&policy->kobj_unregister);
@@ -1018,11 +1013,11 @@ static int __cpufreq_remove_dev(struct s
 
 	pr_debug("unregistering CPU %u\n", cpu);
 
-	raw_spin_lock_irqsave(&cpufreq_driver_lock, flags);
+	spin_lock_irqsave(&cpufreq_driver_lock, flags);
 	data = per_cpu(cpufreq_cpu_data, cpu);
 
 	if (!data) {
-		raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
+		spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 		unlock_policy_rwsem_write(cpu);
 		return -EINVAL;
 	}
@@ -1036,7 +1031,7 @@ static int __cpufreq_remove_dev(struct s
 	if (unlikely(cpu != data->cpu)) {
 		pr_debug("removing link\n");
 		cpumask_clear_cpu(cpu, data->cpus);
-		raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
+		spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 		kobj = &sys_dev->kobj;
 		cpufreq_cpu_put(data);
 		unlock_policy_rwsem_write(cpu);
@@ -1045,7 +1040,6 @@ static int __cpufreq_remove_dev(struct s
 	}
 #endif
 
-	raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 #ifdef CONFIG_SMP
 
 #ifdef CONFIG_HOTPLUG_CPU
@@ -1058,17 +1052,15 @@ static int __cpufreq_remove_dev(struct s
 	 * per_cpu(cpufreq_cpu_data) while holding the lock, and remove
 	 * the sysfs links afterwards.
 	 */
-	get_online_cpus();
 	if (unlikely(cpumask_weight(data->cpus) > 1)) {
 		for_each_cpu(j, data->cpus) {
 			if (j == cpu)
 				continue;
-			raw_spin_lock_irqsave(&cpufreq_driver_lock, flags);
 			per_cpu(cpufreq_cpu_data, j) = NULL;
-			raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 		}
 	}
-	put_online_cpus();
+
+	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
 	if (unlikely(cpumask_weight(data->cpus) > 1)) {
 		for_each_cpu(j, data->cpus) {
@@ -1087,6 +1079,8 @@ static int __cpufreq_remove_dev(struct s
 			cpufreq_cpu_put(data);
 		}
 	}
+#else
+	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 #endif
 
 	if (cpufreq_driver->target)
@@ -1808,13 +1802,13 @@ int cpufreq_register_driver(struct cpufr
 	if (driver_data->setpolicy)
 		driver_data->flags |= CPUFREQ_CONST_LOOPS;
 
-	raw_spin_lock_irqsave(&cpufreq_driver_lock, flags);
+	spin_lock_irqsave(&cpufreq_driver_lock, flags);
 	if (cpufreq_driver) {
-		raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
+		spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 		return -EBUSY;
 	}
 	cpufreq_driver = driver_data;
-	raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
+	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
 	ret = sysdev_driver_register(&cpu_sysdev_class,
 					&cpufreq_sysdev_driver);
@@ -1848,9 +1842,9 @@ err_sysdev_unreg:
 	sysdev_driver_unregister(&cpu_sysdev_class,
 			&cpufreq_sysdev_driver);
 err_null_driver:
-	raw_spin_lock_irqsave(&cpufreq_driver_lock, flags);
+	spin_lock_irqsave(&cpufreq_driver_lock, flags);
 	cpufreq_driver = NULL;
-	raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
+	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(cpufreq_register_driver);
@@ -1876,9 +1870,9 @@ int cpufreq_unregister_driver(struct cpu
 	sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver);
 	unregister_hotcpu_notifier(&cpufreq_cpu_notifier);
 
-	raw_spin_lock_irqsave(&cpufreq_driver_lock, flags);
+	spin_lock_irqsave(&cpufreq_driver_lock, flags);
 	cpufreq_driver = NULL;
-	raw_spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
+	spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
 	return 0;
 }
kernel/cpu.c +7 -9
Index: linux-2.6/kernel/cpu.c
===================================================================
@@ -337,22 +337,20 @@ static int __ref _cpu_down(unsigned int 
 		return -EBUSY;
 	}
 
-	err = __cpu_notify(CPU_DOWN_PREPARE | mod, hcpu, -1, &nr_calls);
+	cpu_hotplug_begin();
+	err = cpu_unplug_begin(cpu);
 	if (err) {
-		nr_calls--;
-		__cpu_notify(CPU_DOWN_FAILED | mod, hcpu, nr_calls, NULL);
-		printk("%s: attempt to take down CPU %u failed\n",
-				__func__, cpu);
+		printk("cpu_unplug_begin(%d) failed\n", cpu);
 		goto out_cancel;
 	}
 
-	cpu_hotplug_begin();
-	err = cpu_unplug_begin(cpu);
+	err = __cpu_notify(CPU_DOWN_PREPARE | mod, hcpu, -1, &nr_calls);
 	if (err) {
 		nr_calls--;
 		__cpu_notify(CPU_DOWN_FAILED | mod, hcpu, nr_calls, NULL);
-		printk("cpu_unplug_begin(%d) failed\n", cpu);
-		goto out_cancel;
+		printk("%s: attempt to take down CPU %u failed\n",
+				__func__, cpu);
+		goto out_release;
 	}
 
 	err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu));
kernel/sched.c +6 -1
Index: linux-2.6/kernel/sched.c
===================================================================
@@ -2403,7 +2403,12 @@ static int select_fallback_rq(int cpu, s
 		printk(KERN_INFO "process %d (%s) no longer affine to cpu%d\n",
 				task_pid_nr(p), p->comm, cpu);
 	}
-
+	/*
+	 * Clear PF_THREAD_BOUND, otherwise we wreckage
+	 * migrate_disable/enable. See optimization for
+	 * PF_THREAD_BOUND tasks there.
+	 */
+	p->flags &= ~PF_THREAD_BOUND;
 	return dest_cpu;
 }
 
kernel/workqueue.c +5 -0
Index: linux-2.6/kernel/workqueue.c
===================================================================
@@ -3192,6 +3192,11 @@ static int __devinit workqueue_cpu_up_ca
 		new_worker = create_worker(gcwq, false);
 		if (!new_worker)
 			return NOTIFY_BAD;
+	case CPU_UP_CANCELED:
+	case CPU_ONLINE:
+		break;
+	default:
+		return notifier_from_errno(0);
 	}
 
 	/* some are called w/ irq disabled, don't disturb irq status */
localversion-rt +1 -1
Index: linux-2.6/localversion-rt
===================================================================
@@ -1 +1 @@
--rt21
+-rt22
arch/x86/kvm/x86.c +7 -0
Index: linux-2.6/arch/x86/kvm/x86.c
===================================================================
@@ -4900,6 +4900,13 @@ int kvm_arch_init(void *opaque)
 		goto out;
 	}
 
+#ifdef CONFIG_PREEMPT_RT_FULL
+	if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
+		printk(KERN_ERR "RT requires X86_FEATURE_CONSTANT_TSC\n");
+		return -EOPNOTSUPP;
+	}
+#endif
+
 	r = kvm_mmu_module_init();
 	if (r)
 		goto out;
#1 lore raw
Quoted 5 lines · On Mon, 7 Nov 2011 22:37:57 +0100 (CET) Thomas Gleixner <[email protected]>…

Dear RT Folks,

I'm pleased to announce the 3.0.8-rt21 release.

Thomas et al,

Got the following splat on boot (f15 64-bit laptop, quad-core i7):

[  146.609030] 
[  146.609031] =======================================================
[  146.609033] [ INFO: possible circular locking dependency detected ]
[  146.609035] 3.0.8-rt22+ #27
[  146.609036] -------------------------------------------------------
[  146.609038] dconf-service/9046 is trying to acquire lock:
[  146.609040]  (&sb->s_type->i_mutex_key#13){+.+.+.}, at: [<ffffffff811adcc4>] ext4_evict_inode+0x44/0x26f
[  146.609047] 
[  146.609048] but task is already holding lock:
[  146.609049]  (&mm->mmap_sem){++++++}, at: [<ffffffff81108ee6>] sys_munmap+0x36/0x5b
[  146.609053] 
[  146.609054] which lock already depends on the new lock.
[  146.609055] 
[  146.609056] 
[  146.609056] the existing dependency chain (in reverse order) is:
[  146.609058] 
[  146.609058] -> #1 (&mm->mmap_sem){++++++}:
[  146.609061]        [<ffffffff810844f0>] check_prevs_add+0x8b/0x104
[  146.609065]        [<ffffffff810848ca>] validate_chain+0x361/0x39d
[  146.609067]        [<ffffffff81084fa5>] __lock_acquire+0x37a/0x3f3
[  146.609069]        [<ffffffff81085501>] lock_acquire+0xc4/0x108
[  146.609071]        [<ffffffff811026a7>] might_fault+0x6d/0x90
[  146.609075]        [<ffffffff8113eac7>] filldir+0x6f/0xc7
[  146.609079]        [<ffffffff811a377b>] call_filldir+0x96/0xc0
[  146.609081]        [<ffffffff811a3937>] ext4_dx_readdir+0x17d/0x1e6
[  146.609083]        [<ffffffff811a3b4d>] ext4_readdir+0x70/0x3b3
[  146.609085]        [<ffffffff8113ed1d>] vfs_readdir+0x7c/0xb5
[  146.609087]        [<ffffffff8113ee3c>] sys_getdents+0x7e/0xd1
[  146.609089]        [<ffffffff814cc2c2>] system_call_fastpath+0x16/0x1b
[  146.609094] 
[  146.609094] -> #0 (&sb->s_type->i_mutex_key#13){+.+.+.}:
[  146.609096]        [<ffffffff810842c6>] check_prev_add+0x68/0x207
[  146.609098]        [<ffffffff810844f0>] check_prevs_add+0x8b/0x104
[  146.609101]        [<ffffffff810848ca>] validate_chain+0x361/0x39d
[  146.609103]        [<ffffffff81084fa5>] __lock_acquire+0x37a/0x3f3
[  146.609105]        [<ffffffff81085501>] lock_acquire+0xc4/0x108
[  146.609108]        [<ffffffff814c5854>] _mutex_lock+0x31/0x40
[  146.609113]        [<ffffffff811adcc4>] ext4_evict_inode+0x44/0x26f
[  146.609120]        [<ffffffff811452b7>] evict+0x89/0x141
[  146.609123]        [<ffffffff81145501>] iput_final+0x14d/0x155
[  146.609126]        [<ffffffff81145543>] iput+0x3a/0x3e
[  146.609128]        [<ffffffff81140b61>] dentry_iput+0x97/0xaf
[  146.609130]        [<ffffffff81141e89>] dentry_kill+0xc7/0xde
[  146.609133]        [<ffffffff81142444>] dput+0xe3/0xf4
[  146.609135]        [<ffffffff8113157d>] __fput+0x1a9/0x1c1
[  146.609137]        [<ffffffff811315b2>] fput+0x1d/0x1f
[  146.609139]        [<ffffffff81107bb1>] remove_vma+0x3c/0x71
[  146.609141]        [<ffffffff81108d78>] do_munmap+0x267/0x280
[  146.609143]        [<ffffffff81108ef4>] sys_munmap+0x44/0x5b
[  146.609145]        [<ffffffff814cc2c2>] system_call_fastpath+0x16/0x1b
[  146.609148] 
[  146.609149] other info that might help us debug this:
[  146.609150] 
[  146.609151]  Possible unsafe locking scenario:
[  146.609151] 
[  146.609152]        CPU0                    CPU1
[  146.609153]        ----                    ----
[  146.609154]   lock(&mm->mmap_sem);
[  146.609155]                                lock(&sb->s_type->i_mutex_key);
[  146.609157]                                lock(&mm->mmap_sem);
[  146.609158]   lock(&sb->s_type->i_mutex_key);
[  146.609159] 
[  146.609160]  *** DEADLOCK ***
[  146.609160] 
[  146.609162] 1 lock held by dconf-service/9046:
[  146.609163]  #0:  (&mm->mmap_sem){++++++}, at: [<ffffffff81108ee6>] sys_munmap+0x36/0x5b
[  146.609166] 
[  146.609166] stack backtrace:
[  146.609168] Pid: 9046, comm: dconf-service Not tainted 3.0.8-rt22+ #27
[  146.609169] Call Trace:
[  146.609174]  [<ffffffff814b1fd1>] print_circular_bug+0xc8/0xd9
[  146.609176]  [<ffffffff810842c6>] check_prev_add+0x68/0x207
[  146.609179]  [<ffffffff810844f0>] check_prevs_add+0x8b/0x104
[  146.609182]  [<ffffffff810848ca>] validate_chain+0x361/0x39d
[  146.609184]  [<ffffffff81084fa5>] __lock_acquire+0x37a/0x3f3
[  146.609187]  [<ffffffff811adcc4>] ? ext4_evict_inode+0x44/0x26f
[  146.609189]  [<ffffffff81085501>] lock_acquire+0xc4/0x108
[  146.609192]  [<ffffffff811adcc4>] ? ext4_evict_inode+0x44/0x26f
[  146.609194]  [<ffffffff810852ef>] ? lock_release_nested+0x9f/0xa6
[  146.609197]  [<ffffffff814c5854>] _mutex_lock+0x31/0x40
[  146.609199]  [<ffffffff811adcc4>] ? ext4_evict_inode+0x44/0x26f
[  146.609201]  [<ffffffff814c91cd>] ? sub_preempt_count+0x4d/0x4f
[  146.609204]  [<ffffffff811adcc4>] ext4_evict_inode+0x44/0x26f
[  146.609206]  [<ffffffff811452b7>] evict+0x89/0x141
[  146.609208]  [<ffffffff81145501>] iput_final+0x14d/0x155
[  146.609210]  [<ffffffff81145543>] iput+0x3a/0x3e
[  146.609212]  [<ffffffff81140b61>] dentry_iput+0x97/0xaf
[  146.609214]  [<ffffffff81141e89>] dentry_kill+0xc7/0xde
[  146.609216]  [<ffffffff81142444>] dput+0xe3/0xf4
[  146.609218]  [<ffffffff8113157d>] __fput+0x1a9/0x1c1
[  146.609220]  [<ffffffff811315b2>] fput+0x1d/0x1f
[  146.609222]  [<ffffffff81107bb1>] remove_vma+0x3c/0x71
[  146.609224]  [<ffffffff81108d78>] do_munmap+0x267/0x280
[  146.609227]  [<ffffffff814c4f07>] ? rt_mutex_lock+0x15/0x17
[  146.609229]  [<ffffffff81108ef4>] sys_munmap+0x44/0x5b
[  146.609232]  [<ffffffff814cc2c2>] system_call_fastpath+0x16/0x1b

Config file attached.

Clark

#2 lore raw
Quoted 13 lines · Clark Williams

Got the following splat on boot (f15 64-bit laptop, quad-core i7):

[  146.609030] 
[  146.609031] =======================================================
[  146.609033] [ INFO: possible circular locking dependency detected ]
[  146.609035] 3.0.8-rt22+ #27
[  146.609036] -------------------------------------------------------
[  146.609038] dconf-service/9046 is trying to acquire lock:
[  146.609040]  (&sb->s_type->i_mutex_key#13){+.+.+.}, at: [<ffffffff811adcc4>] ext4_evict_inode+0x44/0x26f
[  146.609047] 
[  146.609048] but task is already holding lock:
[  146.609049]  (&mm->mmap_sem){++++++}, at: [<ffffffff81108ee6>] sys_munmap+0x36/0x5b
[  146.609053] 

That's an upstream problem which got pulled into 3.0 stable via commit 2526f36894 (upstream 2581fdc810) but lacks the followup upstream fix 8c0bec2. The latter unfortunately has no Cc: stable tag ....

Ted?

Thanks,

tglx
---------->
commit 8c0bec2151a47906bf779c6715a10ce04453ab77

Author: Jiaying Zhang <[email protected]>
Date:   Wed Aug 31 11:50:51 2011 -0400

ext4: remove i_mutex lock in ext4_evict_inode to fix lockdep complaining

The i_mutex lock and flush_completed_IO() added by commit 2581fdc810 in ext4_evict_inode() causes lockdep complaining about potential deadlock in several places. In most/all of these LOCKDEP complaints it looks like it's a false positive, since many of the potential circular locking cases can't take place by the time the ext4_evict_inode() is called; but since at the very least it may mask real problems, we need to address this.

This change removes the flush_completed_IO() and i_mutex lock in ext4_evict_inode(). Instead, we take a different approach to resolve the software lockup that commit 2581fdc810 intends to fix. Rather than having ext4-dio-unwritten thread wait for grabing the i_mutex lock of an inode, we use mutex_trylock() instead, and simply requeue the work item if we fail to grab the inode's i_mutex lock.

This should speed up work queue processing in general and also prevents the following deadlock scenario: During page fault, shrink_icache_memory is called that in turn evicts another inode B. Inode B has some pending io_end work so it calls ext4_ioend_wait() that waits for inode B's i_ioend_count to become zero. However, inode B's ioend work was queued behind some of inode A's ioend work on the same cpu's ext4-dio-unwritten workqueue. As the ext4-dio-unwritten thread on that cpu is processing inode A's ioend work, it tries to grab inode A's i_mutex lock. Since the i_mutex lock of inode A is still hold before the page fault happened, we enter a deadlock.

fs/ext4/ext4.h +1 -0
index e717dfd..b7d7bd0 100644
@@ -175,6 +175,7 @@ struct mpage_da_data {
  */
 #define	EXT4_IO_END_UNWRITTEN	0x0001
 #define EXT4_IO_END_ERROR	0x0002
+#define EXT4_IO_END_QUEUED	0x0004
 
 struct ext4_io_page {
 	struct page	*p_page;
fs/ext4/inode.c +0 -3
index c4da98a..18d2558 100644
@@ -121,9 +121,6 @@ void ext4_evict_inode(struct inode *inode)
 
 	trace_ext4_evict_inode(inode);
 
-	mutex_lock(&inode->i_mutex);
-	ext4_flush_completed_IO(inode);
-	mutex_unlock(&inode->i_mutex);
 	ext4_ioend_wait(inode);
 
 	if (inode->i_nlink) {
fs/ext4/page-io.c +17 -1
index 78839af..92f38ee 100644
@@ -142,7 +142,23 @@ static void ext4_end_io_work(struct work_struct *work)
 	unsigned long		flags;
 	int			ret;
 
-	mutex_lock(&inode->i_mutex);
+	if (!mutex_trylock(&inode->i_mutex)) {
+		/*
+		 * Requeue the work instead of waiting so that the work
+		 * items queued after this can be processed.
+		 */
+		queue_work(EXT4_SB(inode->i_sb)->dio_unwritten_wq, &io->work);
+		/*
+		 * To prevent the ext4-dio-unwritten thread from keeping
+		 * requeueing end_io requests and occupying cpu for too long,
+		 * yield the cpu if it sees an end_io request that has already
+		 * been requeued.
+		 */
+		if (io->flag & EXT4_IO_END_QUEUED)
+			yield();
+		io->flag |= EXT4_IO_END_QUEUED;
+		return;
+	}
 	ret = ext4_end_io_nolock(io);
 	if (ret < 0) {
 		mutex_unlock(&inode->i_mutex);
#3 lore raw
Quoted 19 lines · On Tue, 8 Nov 2011 22:02:32 +0100 (CET) Thomas Gleixner <[email protected]>…
Quoted 13 lines · Clark Williams

Got the following splat on boot (f15 64-bit laptop, quad-core i7):

[  146.609030] 
[  146.609031] =======================================================
[  146.609033] [ INFO: possible circular locking dependency detected ]
[  146.609035] 3.0.8-rt22+ #27
[  146.609036] -------------------------------------------------------
[  146.609038] dconf-service/9046 is trying to acquire lock:
[  146.609040]  (&sb->s_type->i_mutex_key#13){+.+.+.}, at: [<ffffffff811adcc4>] ext4_evict_inode+0x44/0x26f
[  146.609047] 
[  146.609048] but task is already holding lock:
[  146.609049]  (&mm->mmap_sem){++++++}, at: [<ffffffff81108ee6>] sys_munmap+0x36/0x5b
[  146.609053] 

That's an upstream problem which got pulled into 3.0 stable via commit 2526f36894 (upstream 2581fdc810) but lacks the followup upstream fix
. The latter unfortunately has no Cc: stable tag ....

Quoted 5 lines

Ted?

Thanks,

tglx

Thanks Thomas. I cherry-picked 8c0bec2, rebuilt with the same config and have booted the resulting kernel with no lockdep splats.

Clark

#4 lore raw
Quoted 24 lines · Clark Williams
Quoted 21 lines · On Tue, 8 Nov 2011 22:02:32 +0100 (CET) Thomas Gleixner <[email protected]>…
Quoted 13 lines · Clark Williams

Got the following splat on boot (f15 64-bit laptop, quad-core i7):

[  146.609030] 
[  146.609031] =======================================================
[  146.609033] [ INFO: possible circular locking dependency detected ]
[  146.609035] 3.0.8-rt22+ #27
[  146.609036] -------------------------------------------------------
[  146.609038] dconf-service/9046 is trying to acquire lock:
[  146.609040]  (&sb->s_type->i_mutex_key#13){+.+.+.}, at: [<ffffffff811adcc4>] ext4_evict_inode+0x44/0x26f
[  146.609047] 
[  146.609048] but task is already holding lock:
[  146.609049]  (&mm->mmap_sem){++++++}, at: [<ffffffff81108ee6>] sys_munmap+0x36/0x5b
[  146.609053] 

That's an upstream problem which got pulled into 3.0 stable via commit 2526f36894 (upstream 2581fdc810) but lacks the followup upstream fix
. The latter unfortunately has no Cc: stable tag ....

Ted?

Quoted 7 lines
Quoted 3 lines

Thanks,

tglx

Thanks Thomas. I cherry-picked 8c0bec2, rebuilt with the same config and have booted the resulting kernel with no lockdep splats.

Great, I've queued it up for the next 3.0-stable release.

greg k-h