[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: any chance of 2.6.0-test*?



On Sun, 12 Jan 2003, Christoph Hellwig wrote:
> 
> 2.5 does hold the BKL on ->open of charater- (and block-) devices.

Ahh, my bad.

> The real problem is that the big irqlock is gone and mingo just replaced
> it with local_irq_save & friends, which is not enough.

Ok, most of them should be fixable with a simple spinlock approach.

If the recursion is too nasty to handle, we could make some tty-specific 
recursive spinlock as a stop-gap measure, and mark it as being destined 
for the garbage-heap in 2.7.x:

	/*
	 * This isn't even _trying_ to be fast!
	 */
	struct recursive_spinlock {
		spinlock_t lock;
		int lock_count;
		struct task_struct *lock_owner;
	};

	static struct recursive_spinlock tty_lock = {
		.lock = SPIN_LOCK_UNLOCKED,
		.lock_count = 0,
		.lock_owner = NULL
	};

	unsigned long tty_spin_lock(void)
	{
		unsigned long flags;
		struct task_struct *tsk;

		local_irq_save(flags);
		preempt_disable();
		tsk = current;
		if (spin_trylock(&tty_lock.lock))
			goto got_lock;
		if (tsk == tty_lock.lock_owner) {
			WARN_ON(!tty_lock.lock_count);
			tty_lock.lock_count++;
			return flags;
		}
		spin_lock(&tty_lock.lock);
	got_lock:
		WARN_ON(tty_lock.lock_owner);
		WARN_ON(tty_lock.lock_count);
		tty_lock.lock_owner = tsk;
		tty_lock.lock_count = 1;
		return flags;
	}

	void tty_spin_unlock(unsigned long flags)
	{
		WARN_ON(tty_lock.lock_owner != current);
		WARN_ON(!tty_lock.lock_count);
		if (!--tty_lock.lock_count) {
			tty_lock.lock_owner = NULL;
			spin_unlock(&tty_lock.lock);
		}
		preempt_enable();
		local_irq_restore(flags);
	}

and be done with it.

Anybody willing to test it and see if the above works? 

			Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo _at_ vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


この情報があなたの探していたものかどうか選択してください。
yes/まさにこれだ!   no/違うなぁ   part/一部見つかった   try/これで試してみる

あなたが探していた情報はどのようなことか、ご自由に記入下さい。特に「まさにこれだ!」と言う場合は記入をお願いします。
例:「複数のマシンからCATV経由でipmasqueradeを利用してWebを参照したい場合の設定について」
Follow-Ups: References: