lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48FE5416.9070402@tremplin-utc.net>
Date:	Wed, 22 Oct 2008 00:13:42 +0200
From:	Eric Piel <eric.piel@...mplin-utc.net>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, pavel@...e.cz, burman.yan@...il.com,
	pau@...ack.org
Subject: Re: [PATCH] LIS3LV02Dx Accelerometer driver (take 4)

Andrew Morton schreef:
>> +static void lis3lv02d_poweroff_timeout(unsigned long data)
>> +{
>> +	struct acpi_lis3lv02d *dev = (void *)data;
>> +
>> +	up(&dev->poff_sem);
>> +	lis3lv02d_poweroff(dev->device->handle);
>> +	down(&dev->poff_sem);
> 
> eek, no, we cannot down a semaphore from a timer handler!  It will lead
> to might_sleep() warnings, scheduling-in-atomic warnings and kernel
> deadlocks.
Ooh... What happened is that I wrote the other functions first. They
indirectly use acpi_evaluate_integer(), which can sleep. So I avoided
spin_locks, and decided to use a semaphore. But now there is a semaphore
in a timer (which is not allowed to sleep).

It seems the semaphore usage is compulsory due to acpi, so I'm planning
to change the timer into a scheduled work on a workqueue (with
queue_delayed_work(),  and cancel_delayed_work_sync()). This workqueue
could be the same as the one for the joystick input. Does that look the
right way to do it?

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ