Peter Zijlstra [Sat, 13 Oct 2007 23:38:33 +0000 (01:38 +0200)]
lockdep: annotate dir vs file i_mutex
On Mon, 2007-09-24 at 22:13 -0400, Steven Rostedt wrote:
> The circular lock seems to be this:
>
> #1:
>
> sys_mmap2: down_write(&mm->mmap_sem);
> nfs_revalidate_mapping: mutex_lock(&inode->i_mutex);
>
>
> #0:
>
> vfs_readdir: mutex_lock(&inode->i_mutex);
> - during the readdir (filldir64), we take a user fault (missing page?)
> and call do_page_fault -
> do_page_fault: down_read(&mm->mmap_sem);
>
>
> So it does indeed look like a circular locking. Now the question is, "is
> this a bug?". Looking like the inode of #1 must be a file or something
> else that you can mmap and the inode of #0 seems it must be a directory.
> I would say "no".
>
> Now if you can readdir on a file or mmap a directory, then this could be
> an issue.
>
> Otherwise, I'd love to see someone teach lockdep about this issue! ;-)
Make a distinction between file and dir usage of i_mutex.
The inode should be complete and unused at unlock_new_inode(), re-init
i_mutex depending on its type.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Peter Zijlstra [Mon, 15 Oct 2007 12:51:31 +0000 (14:51 +0200)]
lockdep: per filesystem inode lock class
Give each filesystem its own inode lock class. The various filesystems have
different locking order wrt the inode locks; esp. the pseudo filesystems differ
from the rest.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Prasanna S Panchamukhi <prasanna@in.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Gregory Haskins [Thu, 11 Oct 2007 20:11:11 +0000 (22:11 +0200)]
lockdep: fix mismatched lockdep_depth/curr_chain_hash
It is possible for the current->curr_chain_key to become inconsistent with the
current index if the chain fails to validate. The end result is that future
lock_acquire() operations may inadvertently fail to find a hit in the cache
resulting in a new node being added to the graph for every acquire.
Tim Pepper [Thu, 11 Oct 2007 20:11:11 +0000 (22:11 +0200)]
lockdep: Avoid /proc/lockdep & lock_stat infinite output
Both /proc/lockdep and /proc/lock_stat output may loop infinitely.
When a read() requests an amount of data smaller than the amount of data
that the seq_file's foo_show() outputs, the output starts looping and
outputs the "stuck" element's data infinitely. There may be multiple
sequential calls to foo_start(), foo_next()/foo_show(), and foo_stop()
for a single open with sequential read of the file. The _start() does not
have to start with the 0th element and _show() might be called multiple
times in a row for the same element for a given open/read of the seq_file.
Also header output should not be happening in _start(). All output should
be in _show(), which SEQ_START_TOKEN is meant to help. Having output in
_start() may also negatively impact seq_file's seq_read() and traverse()
accounting.
Signed-off-by: Tim Pepper <lnxninja@linux.vnet.ibm.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Ingo Molnar <mingo@elte.hu> Cc: Al Viro <viro@ftp.linux.org.uk>
David Brownell [Sun, 14 Oct 2007 21:50:25 +0000 (14:50 -0700)]
Fix compile while compiling drivers/mmc/host/mmc_spi.o with !BLOCK
Make sure the mmc_spi driver can build without CONFIG_BLOCK.
Issue noted by "Avuton Olrich" <avuton@gmail.com> and randconfig.
While that won't be a common configuration, sometimes embedded
boards use SDIO to interface WLAN or Bluetooth chips (vs some
parallel interface), and don't provide an MMC/SD socket for use
with flash memory cards.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* git://git.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-x86:
x86: force timer broadcast on late AMD C1E detection
x86: move local APIC timer init to the end of start_secondary()
clockevents: introduce force broadcast notifier
x86: fix missing include for vsyscall
The call to napi_disable() in the PCI shutdown handler is problematic,
and is aggravated by the new NAPI.
Also, make sure watchdog timer doesn't go off.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Thomas Gleixner [Sun, 14 Oct 2007 20:57:45 +0000 (22:57 +0200)]
x86: force timer broadcast on late AMD C1E detection
The 64bit SMP bootup is slightly different to the 32bit one. It enables
the boot CPU local APIC timer before all CPUs are brought up. Some AMD C1E
systems have the C1E feature flag only set in the secondary CPU. Due to
the early enable of the boot CPU local APIC timer the APIC timer is
registered as a fully functional device. When we detect the wreckage during
the bringup of the secondary CPU, we need to force the boot CPU into
broadcast mode.
Check the C1E caused APIC timer disable, when the secondary APIC timer is
initialized. If the boot CPU APIC timer was registered as a functional
clock event device, then fix this up and utilize the
CLOCK_EVT_NOTIFY_BROADCAST_FORCE mechanism to force the already
registered boot CPU APIC timer into broadcast mode.
Tested by force injecting the failure mode.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Sun, 14 Oct 2007 20:57:45 +0000 (22:57 +0200)]
clockevents: introduce force broadcast notifier
The 64bit SMP bootup is slightly different to the 32bit one. It enables
the boot CPU local APIC timer before all CPUs are brought up. Some AMD C1E
systems have the C1E feature flag only set in the secondary CPU. Due to
the early enable of the boot CPU local APIC timer the APIC timer is
registered as a fully functional device. When we detect the wreckage during
the bringup of the secondary CPU, we need to force the boot CPU into
broadcast mode.
Add a new notifier reason and implement the force broadcast in the clock
events layer.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Dave Jones [Sun, 14 Oct 2007 20:57:45 +0000 (22:57 +0200)]
x86: fix missing include for vsyscall
> Maybe I just picked a bad time to try, but...
>
> arch/x86/kernel/alternative.c: In function 'apply_alternatives':
> arch/x86/kernel/alternative.c:191: error: 'VSYSCALL_START' undeclared (first use in this function)
> arch/x86/kernel/alternative.c:191: error: (Each undeclared identifier is reported only once
> arch/x86/kernel/alternative.c:191: error: for each function it appears in.)
> arch/x86/kernel/alternative.c:191: error: 'VSYSCALL_END' undeclared (first use in this function)
> make[1]: *** [arch/x86/kernel/alternative.o] Error 1
> make: *** [arch/x86/kernel] Error 2
Try this.
Include missing header for vsyscall.
Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Linus Torvalds [Sun, 14 Oct 2007 19:50:19 +0000 (12:50 -0700)]
Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6: (53 commits)
hwmon: (vt8231) fix sparse warning
hwmon: (sis5595) fix sparse warning
hwmon: (w83627hf) don't assume bank 0
hwmon: (w83627hf) Fix setting fan min right after driver load
hwmon: (w83627hf) De-macro sysfs callback functions
hwmon: Add new combined driver for FSC chips
hwmon: (ibmpex) Release IPMI user if hwmon registration fails
hwmon: (dme1737) Add sch311x support
hwmon: (dme1737) group functions logically
hwmon: (dme1737) cleanups
hwmon: IBM power meter driver
hwmon: (coretemp) Add support for Celeron 4xx
hwmon: (lm87) Disable VID when it should be
hwmon: (w83781d) Add individual alarm and beep files
hwmon: VRM is not read from registers
MAINTAINERS: update hwmon subsystem git trees
hwmon: Fix the code examples in documentation
hwmon: update sysfs interface document - error handling
hwmon: (thmc50) Fix a debug message
hwmon: (thmc50) Don't create temp3 if not enabled
...
Al Viro [Sun, 14 Oct 2007 18:41:29 +0000 (19:41 +0100)]
ipg: endianness fixes
if your mask is host-endian, you should apply it after le64_to_cpu();
if it's little-endian - before. Doing both (for the same mask and
little-endian value) is broken.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Al Viro [Sun, 14 Oct 2007 18:41:09 +0000 (19:41 +0100)]
fix endianness bug in inet_lro
all uses of and almost all assignments to lro_desc->tcp_ack assume that it's
net-endian; one converts net-endian to host-endian and sticks it in
lro_desc->tcp_ack.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Linus Torvalds [Sun, 14 Oct 2007 16:03:42 +0000 (09:03 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (21 commits)
HID: hidraw_connect() memleak fix
HID: add hidraw interface
USB HID: provide hook for hidraw write()
HID: hiddev: Add 32bit ioctl compatibilty
HID: Add GeneralTouch touchscreen to the blacklist
HID: add support for Microsoft Wireless Laser Keyboard 6000
Input: add KEY_LOGOFF
USBHID: report descriptor fix for MacBook JIS keyboard
HID: trivial fixes in hid-debug
HID: fix input mapping for Microsoft Ergonomic Keyboard
HID: use hid-plff driver for GreenAsia 0e8f:0003 devices
USBHID: Add HID_QUIRK_NOGET for ELO Touch Screen 2700 display
HID: enable hiddev for the SantaRosa MacBookPro IR receiver
USBHID: add CM109 device to blacklist
HID: Report usage codes of keys as EV_MSC scancode events
HID: ignore all non-LED usages in output fields in hid-input
HID: fix whitespace damage
HID: add support for Thrustmaster FGT Force Feedback wheel
HID: minimal autosuspend support for USB HID devices
HID: add support for Microsoft Natural Ergonomic Keyboard 4000
...
Linus Torvalds [Sun, 14 Oct 2007 16:02:40 +0000 (09:02 -0700)]
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6:
[MTD] fix mtdconcat for subpage-write NAND
[MTD] [OneNAND] Avoid deadlock in erase callback; release chip lock first.
[MTD] [OneNAND] Return only negative error codes
[MTD] [OneNAND] Synchronize block locking operations
UBI: return correct error code
UBI: remove useless inlines
UBI: fix atomic LEB change problems
UBI: use byte hexdump
UBI: do not use vmalloc on I/O path
UBI: allocate memory with GFP_NOFS
UBI: use linux print_hex_dump(), not home-grown one
UBI: don't use array index before testing if it is negative
UBI: add more prints
UBI: fix sparse warnings
UBI: fix leak in ubi_scan_erase_peb
Grant Likely [Sun, 14 Oct 2007 04:13:27 +0000 (22:13 -0600)]
Lite5200 shouldn't mess with ROOT_DEV
There is no good reason for board platform code to mess with the ROOT_DEV.
Remove it from all in-tree platforms except powermac
This is a follow on to commit 745e1027751acbc1f14f8bbef378b491242b9c83.
The original patch had this change to lite5200.c, but it got dropped in
the psycho madness that is the 2.6.24 merge window.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jiri Kosina [Mon, 14 May 2007 07:57:40 +0000 (09:57 +0200)]
HID: add hidraw interface
hidraw is an interface that is going to obsolete hiddev one
day.
Many userland applications are using libusb instead of using
kernel-provided hiddev interface. This is caused by various
reasons - the HID parser in kernel doesn't handle all the
HID hardware on the planet properly, some devices might require
its own specific quirks/drivers, etc.
hiddev interface tries to do its best to parse all the received
reports properly, and presents only parsed usages into userspace.
This is however often not enough, and that's the reason why
many userland applications just don't use hiddev at all, and
rather use libusb to read raw USB events and process them on
their own.
Another drawback of hiddev is that it is USB-specific.
hidraw interface provides userspace readers with really raw HID
reports, no matter what the low-level transport layer is (USB/BT),
and gives the userland applications all the freedom to process
the HID reports in a way they wish to.
When the erase callback performs some other action on the flash, it's
highly likely to deadlock unless we actually release the chip lock
before calling it.
This patch mirrors that same change already done for NAND.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Adrian Hunter [Fri, 12 Oct 2007 07:19:38 +0000 (10:19 +0300)]
[MTD] [OneNAND] Return only negative error codes
The OneNAND driver was confusing JFFS2 by returning positive error
codes.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Ensure OneNAND's block locking operations are synchronized
like all other operations.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
HUT 1.12 defines Logoff usage 0x19c in Consumer page. There are
keyboards out there emitting this usage code (for example Microsoft
Wireless Laser Keyboard 6000). Add this key so that HID code could
map usages to it.
Tomoya Adachi [Wed, 3 Oct 2007 21:27:49 +0000 (23:27 +0200)]
USBHID: report descriptor fix for MacBook JIS keyboard
This patch fixes the problem, that Japanese MacBook doesn't recognize some keys
like '\'(yen, or backslash), '|'(pipe), and '_'(underscore).
It is due to that MacBook JIS keyboard (jp106) sends wrong report descriptor.
It saids "logical maximum = 0x65", so Keyboard.0089 is mapped to Key.Unknown,
while it should be accepted as Key.Yen.
HID: fix input mapping for Microsoft Ergonomic Keyboard
Special keys 1-5 on Microsoft Ergonomic Keyboard were mistakenly
mapped to buttons, which doesn't make a lot of sense. Fix this
mapping to KEY_F{13,18}.
HID: use hid-plff driver for GreenAsia 0e8f:0003 devices
Add 0e8f:0003 into the list of devices supported by the hid-plff
force feedback driver. These devices identify themselves as
"GreenAsia Inc. USB Joystick " and can be either adapters or
actual game controllers. The testing was done with a Köng Gaming
gamepad.
Stelian Pop [Tue, 11 Sep 2007 21:34:55 +0000 (23:34 +0200)]
HID: enable hiddev for the SantaRosa MacBookPro IR receiver
The infrared remote receiver found in the SantaRosa MacBookPro
laptops (MacBookPro3,1) need to be forced to expose a HIDDEV
interface (instead of HIDINPUT) so that lirc can access it using
the 'macmini' driver.
The patch below adds the required quirk for forcing the HIDDEV
interface to be activated (HID_QUIRK_HIDDEV) and introduces a new
quirk which forces the HIDINPUT interface to be ignored
(HID_QUIRK_IGNORE_HIDINPUT).
Note that Apple calls this receiver 'IRController4' (info taken
from Apple's driver Info.plist). Older Mac{Book,Mini,Pro}s seem
to all use the 'IRController1' device (USB id 05ac:8240) which
doesn't need those quirks.
Signed-off-by: Stelian Pop <stelian@popies.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Jiri Kosina [Mon, 20 Aug 2007 10:13:34 +0000 (12:13 +0200)]
HID: Report usage codes of keys as EV_MSC scancode events
Current HID layer does not report usage codes to the input layer. This feature
was previously removed, because it caused unnecessary storm of events in cases
of positioning devices, etc.
This patch adds reporting of usage codes as EV_MSC events only for key events.
We issue the EV_MSC event only if the state of the key corresponding to the
given code has changed, so that we don't report usages that are sent in every
report even if the state hasn't changed (for example Shift/Caps Lock/...
states as sent by various keyboards).
This functionality is required at least by KeyTouch in order to provide
convenient means for remapping the usage codes.
Jiri Kosina [Sat, 11 Aug 2007 21:39:42 +0000 (23:39 +0200)]
HID: ignore all non-LED usages in output fields in hid-input
We have to ignore all non-LED usages in output fields if the
report descriptor of the device specifies any. If we don't do
so, the devices which contain the same usages both in input and
output reports with different parameters will mess things up. In
hid-input, we currently care only for the input usages, with exception
for LEDs. All other output usages should be properly handled by
appropriate force-feedback driver.
Fixes auto-calibration for Saitek Cyborg Evo Force joystick.
HID: add support for Thrustmaster FGT Force Feedback wheel
Rework thrustmaster force-feedback module to support devices having
different types of force feedback effects. Add signatures of
Thrustmaster FGT Rumble Force and Thrustmaster FGT Force Feedback
wheels to the list of devices dupported by the module.
Parts of the patch were lifted off a simalar patch by
Anssi Hannula <anssi.hannula@gmail.com>
Oliver Neukum [Wed, 11 Jul 2007 12:48:58 +0000 (14:48 +0200)]
HID: minimal autosuspend support for USB HID devices
Autosuspend for USB HID devices remains problematic as far as mice
and keyboards are concerned. While I am working on a grand solution,
here's a minimalist patch that works for those devices not continously
in use.
Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Jiri Kosina [Thu, 9 Aug 2007 11:24:11 +0000 (13:24 +0200)]
HID: add support for Microsoft Natural Ergonomic Keyboard 4000
This keyboard emits a few usages that are not handled properly by
hid-input.
The usages from MSVENDOR page are colliding with Chicony Tactical
Pad device, so we have to distinguish in runtime. Ugly ...
Also, the buttons 1-5 have to be handled in a non-standard way,
as they are emitted by the keyboard in a bitfield-like fashion, but
the field is not presented as bit-field by the keyboard. The keys can't
be pressed simultaneously, so the handling we have is correct.
This patch also extends hid_keyboard[] with KPLeftParenthesis and
KPRightParenthesis as defined by Keyboard page in HUT 1.12. The
corresponding usages are also emitted by this keyboard.
Jiri Kosina [Wed, 8 Aug 2007 15:19:08 +0000 (17:19 +0200)]
Input: add KEY_SPELLCHECK
HUT 1.12 defines Spell Check usage 0x1ab in Consumer page. There are
keyboards out there emitting this usage code (for example Microsoft
Natural Ergonomic Keyboard 4000). Add this key so that HID code could
map usages to it.
When the UBI device is nearly full, i.e. all LEBs are mapped, we have
only one spare LEB left - the one we reserved for WL purposes. Well,
I do not count the LEBs which were reserved for bad PEB handling -
suppose NOR flash for simplicity. If an "atomic LEB change operation"
is run, and the WL unit is moving a LEB, we have no spare LEBs to
finish the operation and fail, which is not good. Moreover, if there
are 2 or more simultanious "atomic LEB change" requests, only one of
them has chances to succeed, the other will fail with -ENOSPC. Not
good either.
This patch does 2 things:
1. Reserves one PEB for the "atomic LEB change" operation.
2. Serealize the operations so that only on of them may run
at a time (by means of a mutex).
Artem Bityutskiy [Wed, 29 Aug 2007 11:51:52 +0000 (14:51 +0300)]
UBI: do not use vmalloc on I/O path
Similar reason as in case of the previous patch: it causes
deadlocks if a filesystem with writeback support works on top
of UBI. So pre-allocate needed buffers when attaching MTD device.
We also need mutexes to protect the buffers, but they do not
cause much contantion because they are used in recovery, torture,
and WL copy routines, which are called seldom.
Artem Bityutskiy [Tue, 28 Aug 2007 18:29:32 +0000 (21:29 +0300)]
UBI: allocate memory with GFP_NOFS
Use GFP_NOFS flag when allocating memory on I/O path, because otherwise
we may deadlock the filesystem which works on top of us. We observed
the deadlocks with UBIFS. Example:
VFS->FS lock a lock->UBI->kmalloc()->VFS writeback->FS locks the same
lock again.
Jesper Juhl [Fri, 3 Aug 2007 23:25:26 +0000 (01:25 +0200)]
UBI: don't use array index before testing if it is negative
I can't find anything guaranteeing that 'ubi_num' cannot be <0 in
drivers/mtd/ubi/kapi.c::ubi_open_volume(), and in fact the code
even tests for that and errors out if so. Unfortunately the test
for "ubi_num < 0" happens after we've already used 'ubi_num' as
an array index - bad thing to do if it is negative.
This patch moves the test earlier in the function and then moves
the indexing using that variable after the check. A bit safer :-)
David S. Miller [Sun, 14 Oct 2007 06:41:28 +0000 (23:41 -0700)]
[SPARC64]: Kill ugly __bucket() macro.
All the users go through virt_irq_to_bucket() and essentially
want to go from a virt_irq to an INO, but we have a way
to do that already via virt_to_real_irq_table[].dev_ino.
This also allows us to kill both virt_to_real_irq() and
virt_irq_to_bucket().
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Sun, 14 Oct 2007 06:27:48 +0000 (23:27 -0700)]
[SPARC64]: Kill ugly __irq_ino() macro.
We have a place to stick INO information in the
virt_to_real_irq_table[], which is currently only used for VIRQs.
And that is readily accessible from the one __irq_ino() call site.
Signed-off-by: David S. Miller <davem@davemloft.net>