public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Zick" <lkml@morethan.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Harald Welte <HaraldWelte@viatech.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: LOCK prefix on uni processor has its use
Date: Wed, 27 May 2009 13:55:28 -0500	[thread overview]
Message-ID: <200905271355.31237.lkml@morethan.org> (raw)
In-Reply-To: <200905271333.21304.lkml@morethan.org>

On Wed May 27 2009, Michael S. Zick wrote:
> On Wed May 27 2009, Michael S. Zick wrote:
> > On Wed May 27 2009, Andi Kleen wrote:
> > > Harald Welte <HaraldWelte@viatech.com> writes:
> > > > * All X86 instructions except rep-strings are atomic wrt interrupts.
> > > > * The lock prefix has uses on a UP processor: It keeps DMA devices from
> > > >   interfering with a read-modify-write sequence
> > > 
> > > In theory yes, but not in Linux -- normal drivers simply don't use LOCK in any way
> > > on a UP kernel.
> > > 

Note that there are there spin_{lock,unlock} symbols in the stack trace.
This build has the 'lock' in LOCK_PREFIX.

Mike
> > > We discussed exactly this in the earlier subthread :)
> > > 
> > > > Now the question is: Is this a valid operation of a driver?  Should the driver
> > > > do such things, or is such a driver broken? 
> > > 
> > > The driver is broken because if it relies on this it will not work on a UP kernel.
> > > Also it's not portable and in general a bad idea.
> > > 
> > > > When would that occur?  I'm trying
> > > > to come up with a case, but typically you e.g. allocate some DMA buffer and
> > > > then don't touch it until the hardware has processed it.
> > > 
> > > Is it known which driver has this problem?
> > > 
> > > -Andi (who finds hpa's "timing theory" to be more believable anyways)
> > > 
> > 
> > I still have not come up with a solid, testable, theory to explain the
> > order of magnitude in up-time before the kernel locks with/with-out 'lock'.
> > 
> > But we are definitely pecking around the edges of the problem.  ;)
> > 
> > Today's lockdep build has just passed its previous record by hard-coding
> > the pci cache line size to be the same as the cpu's cache line size. (a WAFG).
> > Until we hear back from the VIA-CPU people, I just guessed that since the
> > chip set was designed for use with the processor...
> > 
> 
> Ah, so - some information - - - 
> (caused by un-plug/re-plug usb mouse while ehci-hcd was caught in its failure
> reporting loop)
> 
> ehci_hcd 0000:00:10.4: port 6 resume error -19
> hub 1-0:1.0: hub_port_status failed (err = -32)
> hub 1-0:1.0: connect-debounce failed, port 6 disabled
> hub 1-0:1.0: over-current change on port 1
> ehci_hcd 0000:00:10.4: HC died; cleaning up
> irq 23: nobody cared (try booting with the "irqpoll" option)
> Pid: 2277, comm: syslogd Not tainted 2.6.30-rc7-ce1200v-09147lk-db #29
> Call Trace:
>  [<c015de14>] ? __report_bad_irq+0x24/0x90
>  [<c015dfc5>] ? note_interrupt+0x145/0x180
>  [<c015e39f>] ? handle_fasteoi_irq+0xaf/0xe0
>  [<c0104eb7>] ? handle_irq+0x17/0x20
>  [<c0104daa>] ? do_IRQ+0x3a/0xa0
>  [<c0145a8b>] ? trace_hardirqs_on_caller+0x6b/0x170
>  [<c01034ae>] ? common_interrupt+0x2e/0x34
>  [<c0126082>] ? __do_softirq+0x42/0x110
>  [<c0141294>] ? tick_program_event+0x14/0x20
>  [<c01384cc>] ? hrtimer_interrupt+0xcc/0x1d0
>  [<c0126195>] ? do_softirq+0x45/0x50
>  [<c01264aa>] ? irq_exit+0x6a/0x80
>  [<c0111109>] ? smp_apic_timer_interrupt+0x49/0x80
>  [<c0103517>] ? apic_timer_interrupt+0x2f/0x34
>  [<c014799e>] ? lock_acquire+0x8e/0xa0
>  [<c01f4b8a>] ? start_this_handle+0x6a/0x3c0
>  [<c05307bd>] ? _spin_lock+0x3d/0x70
>  [<c01f4b8a>] ? start_this_handle+0x6a/0x3c0
>  [<c01f4b8a>] ? start_this_handle+0x6a/0x3c0
>  [<c018b598>] ? kmem_cache_alloc+0x98/0x100
>  [<c0143c06>] ? lockdep_init_map+0x46/0x130
>  [<c01f4f80>] ? journal_start+0xa0/0x100
>  [<c0163780>] ? grab_cache_page_write_begin+0x30/0xc0
>  [<c0138fb4>] ? up_read+0x14/0x30
>  [<c01da348>] ? ext3_write_begin+0x98/0x200
>  [<c0163a48>] ? generic_file_buffered_write+0x108/0x300
>  [<c0125943>] ? current_fs_time+0x13/0x20
>  [<c016526a>] ? __generic_file_aio_write_nolock+0x24a/0x550
>  [<c052f520>] ? __mutex_lock_common+0x2f0/0x3f0
>  [<c01655b9>] ? generic_file_aio_write+0x49/0xd0
>  [<c01655ce>] ? generic_file_aio_write+0x5e/0xd0
>  [<c0146359>] ? validate_chain+0xe9/0x1000
>  [<c01d8680>] ? ext3_file_write+0x30/0xc0
>  [<c01d8650>] ? ext3_file_write+0x0/0xc0
>  [<c018e47f>] ? do_sync_readv_writev+0xbf/0x100
>  [<c0144dae>] ? lock_release_holdtime+0x6e/0xf0
>  [<c0135230>] ? autoremove_wake_function+0x0/0x50
>  [<c017606f>] ? might_fault+0x4f/0xa0
>  [<c0225c3c>] ? security_file_permission+0xc/0x10
>  [<c018e746>] ? rw_verify_area+0x66/0xd0
>  [<c018e30e>] ? rw_copy_check_uvector+0x7e/0x100
>  [<c018f30a>] ? do_readv_writev+0xaa/0x190
>  [<c01d8650>] ? ext3_file_write+0x0/0xc0
>  [<c018f42c>] ? vfs_writev+0x3c/0x50
>  [<c018f527>] ? sys_writev+0x47/0x80
>  [<c0102e08>] ? sysenter_do_call+0x12/0x36
> handlers:
> [<c035d480>] (usb_hcd_irq+0x0/0x90)
> Disabling IRQ #23
> hub 1-0:1.0: hub_port_status failed (err = -19)
> hub 1-0:1.0: connect-debounce failed, port 1 disabled
> hub 1-0:1.0: cannot disable port 1 (err = -19)
> hub 1-0:1.0: hub_port_status failed (err = -19)
> hub 1-0:1.0: hub_port_status failed (err = -19)
> hub 1-0:1.0: hub_port_status failed (err = -19)
> hub 1-0:1.0: hub_port_status failed (err = -19)
> hub 1-0:1.0: hub_port_status failed (err = -19)
> usb 1-5: USB disconnect, address 3
> ehci_hcd 0000:00:10.4: force halt; handhake dc724014 00004000 00004000 -> -19
> 
> =================================
> [ INFO: inconsistent lock state ]
> 2.6.30-rc7-ce1200v-09147lk-db #29
> ---------------------------------
> inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
> hd-audio0/51 [HC0[0]:SC1[1]:HE1:SE0] takes:
>  (&irq_desc_lock_class){?.-...}, at: [<c015dc81>] try_one_irq+0x21/0x130
> {IN-HARDIRQ-W} state was registered at:
>   [<ffffffff>] 0xffffffff
> irq event stamp: 95629480
> hardirqs last  enabled at (95629480): [<c05310a0>] _spin_unlock_irq+0x20/0x40
> hardirqs last disabled at (95629479): [<c053086d>] _spin_lock_irq+0xd/0x70
> softirqs last  enabled at (95626922): [<c0126195>] do_softirq+0x45/0x50
> softirqs last disabled at (95629475): [<c0126195>] do_softirq+0x45/0x50
> 
> other info that might help us debug this:
> 3 locks held by hd-audio0/51:
>  #0:  ((bus->workq_name)){+.+...}, at: [<c0131912>] worker_thread+0x192/0x2d0
>  #1:  (&chip->irq_pending_work){+.+...}, at: [<c0131912>] worker_thread+0x192/0x2d0
>  #2:  (kernel/irq/spurious.c:21){+.-...}, at: [<c012a4d0>] run_timer_softirq+0xe0/0x1f0
> 
> stack backtrace:
> Pid: 51, comm: hd-audio0 Not tainted 2.6.30-rc7-ce1200v-09147lk-db #29
> Call Trace:
>  [<c0145254>] ? print_usage_bug+0x174/0x1c0
>  [<c014583b>] ? mark_lock+0x59b/0x5d0
>  [<c01463b8>] ? validate_chain+0x148/0x1000
>  [<c0144fc0>] ? check_usage_backwards+0x0/0x90
>  [<c01474a7>] ? __lock_acquire+0x237/0x6a0
>  [<c014798b>] ? lock_acquire+0x7b/0xa0
>  [<c015dc81>] ? try_one_irq+0x21/0x130
>  [<c05307bd>] ? _spin_lock+0x3d/0x70
>  [<c015dc81>] ? try_one_irq+0x21/0x130
>  [<c015dc81>] ? try_one_irq+0x21/0x130
>  [<c015ddd3>] ? poll_spurious_irqs+0x43/0x60
>  [<c012a55b>] ? run_timer_softirq+0x16b/0x1f0
>  [<c012a4d0>] ? run_timer_softirq+0xe0/0x1f0
>  [<c015dd90>] ? poll_spurious_irqs+0x0/0x60
>  [<c01260a8>] ? __do_softirq+0x68/0x110
>  [<c0141294>] ? tick_program_event+0x14/0x20
>  [<c01384cc>] ? hrtimer_interrupt+0xcc/0x1d0
>  [<c0126195>] ? do_softirq+0x45/0x50
>  [<c01264aa>] ? irq_exit+0x6a/0x80
>  [<c0111109>] ? smp_apic_timer_interrupt+0x49/0x80
>  [<c0103517>] ? apic_timer_interrupt+0x2f/0x34
>  [<c05310a6>] ? _spin_unlock_irq+0x26/0x40
>  [<c0419422>] ? azx_irq_pending_work+0x92/0x120
>  [<c0131912>] ? worker_thread+0x192/0x2d0
>  [<c0419390>] ? azx_irq_pending_work+0x0/0x120
>  [<c0131975>] ? worker_thread+0x1f5/0x2d0
>  [<c0131912>] ? worker_thread+0x192/0x2d0
>  [<c0135230>] ? autoremove_wake_function+0x0/0x50
>  [<c0131780>] ? worker_thread+0x0/0x2d0
>  [<c0134ee7>] ? kthread+0x47/0x80
>  [<c0134ea0>] ? kthread+0x0/0x80
>  [<c0103627>] ? kernel_thread_helper+0x7/0x10
> 
> Enjoy
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 



  reply	other threads:[~2009-05-27 18:55 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 16:39 [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic Michael S. Zick
2009-05-22 18:23 ` Andi Kleen
2009-05-22 18:36 ` Ingo Molnar
2009-05-22 18:59   ` H. Peter Anvin
2009-05-22 19:20     ` Michael S. Zick
2009-05-22 22:21     ` Michael S. Zick
2009-05-22 23:30       ` H. Peter Anvin
2009-05-23  0:45         ` Michael S. Zick
2009-05-23  0:51           ` H. Peter Anvin
2009-05-23 10:44             ` Michael S. Zick
2009-05-23 11:18               ` Michael S. Zick
2009-05-24  7:04               ` Harald Welte
2009-05-24 12:48                 ` Michael S. Zick
2009-05-24 15:43                 ` Michael S. Zick
2009-05-27 22:13               ` Roland Dreier
2009-05-27 22:33                 ` Michael S. Zick
2009-05-23 15:52             ` Michael S. Zick
2009-05-23 18:04             ` Michael S. Zick
2009-05-23 23:44               ` H. Peter Anvin
2009-05-24  6:49                 ` Harald Welte
2009-05-24 12:38                   ` Michael S. Zick
2009-05-24 17:31                     ` Harald Welte
2009-05-27 12:18                   ` Re:[VIA Support] was: " Michael S. Zick
2009-05-27 12:22                     ` [VIA " Michael S. Zick
2009-05-27 12:47                     ` Harald Welte
2009-05-27 13:00                       ` Michael S. Zick
2009-05-29 12:06                     ` Michael S. Zick
2009-05-30 15:48                   ` Michael S. Zick
2009-05-24 12:27                 ` Michael S. Zick
2009-05-24 17:22                   ` Harald Welte
2009-05-24 18:00                   ` H. Peter Anvin
2009-05-24 18:32                     ` Michael S. Zick
2009-05-24 18:46                       ` H. Peter Anvin
2009-05-24 19:09                         ` Michael S. Zick
2009-05-25 19:03                         ` Michael S. Zick
2009-05-25 19:18                           ` Michael S. Zick
2009-05-25 19:46                             ` Michael S. Zick
2009-05-25 21:10                               ` Michael S. Zick
2009-05-25 21:17                                 ` H. Peter Anvin
2009-05-25 23:03                                   ` Michael S. Zick
2009-05-25 23:35                                     ` Michael S. Zick
2009-05-26  0:05                                     ` H. Peter Anvin
2009-05-26 12:37                                       ` Michael S. Zick
2009-05-26 17:13                                         ` H. Peter Anvin
2009-05-25  1:31                       ` i2c-viapro / via-fb drivers on VIA CX700 Harald Welte
2009-05-25 12:54                         ` Michael S. Zick
2009-05-27 13:36                         ` Michael S. Zick
2009-05-25 16:05                       ` [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic Michael S. Zick
2009-05-28 20:30                     ` Pavel Machek
2009-05-28 20:54                       ` Michael S. Zick
2009-05-28 23:15                         ` [Futex RFC] was " Michael S. Zick
2009-05-29  2:00                           ` Michael S. Zick
2009-05-27 17:01                 ` LOCK prefix on uni processor has its use (was Re: [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic) Harald Welte
2009-05-27 17:10                   ` Michael S. Zick
2009-05-27 17:19                   ` Thomas Gleixner
2009-05-27 17:25                     ` Michael S. Zick
2009-05-27 18:08                   ` LOCK prefix on uni processor has its use Andi Kleen
2009-05-27 18:22                     ` Michael S. Zick
2009-05-27 18:33                       ` Michael S. Zick
2009-05-27 18:55                         ` Michael S. Zick [this message]
2009-05-27 18:38                       ` Andi Kleen
2009-06-02 12:48                     ` Harald Welte
2009-06-02 13:03                       ` Andi Kleen
2009-06-02 13:26                         ` Michael S. Zick
2009-06-02 13:42                           ` Andi Kleen
2009-06-03 11:46                             ` Michael S. Zick
2009-05-28  2:56                   ` LOCK prefix on uni processor has its use (was Re: [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic) H. Peter Anvin
2009-05-23 20:51             ` [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic Michael S. Zick
2009-05-28 12:48       ` Pavel Machek
2009-05-28 13:29         ` Michael S. Zick
2009-05-28 20:50           ` Pavel Machek
2009-05-28 20:58             ` Michael S. Zick
2009-05-28 21:16               ` Pavel Machek
2009-05-28 21:21                 ` Michael S. Zick
2009-05-22 19:17   ` Michael S. Zick
     [not found] ` <200905221343.30638.lkml@morethan.org>
     [not found]   ` <20090522192329.GF846@one.firstfloor.org>
2009-05-22 19:53     ` Michael S. Zick
2009-05-22 20:05       ` Samuel Thibault
2009-05-22 20:32         ` Michael S. Zick
2009-05-22 20:42           ` Andi Kleen
2009-05-22 20:57             ` Michael S. Zick
2009-05-22 20:43           ` Samuel Thibault
2009-05-22 21:59             ` Andi Kleen
2009-05-22 22:00               ` Samuel Thibault
2009-05-22 22:14                 ` Andi Kleen
2009-05-22 22:14                   ` Samuel Thibault
2009-05-22 20:45           ` Roland Dreier
2009-05-24 18:59           ` Robert Hancock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200905271355.31237.lkml@morethan.org \
    --to=lkml@morethan.org \
    --cc=HaraldWelte@viatech.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andi@firstfloor.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox