Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754720Ab0LOPt5 (ORCPT ); Wed, 15 Dec 2010 10:49:57 -0500 Received: from david.siemens.de ([192.35.17.14]:15148 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753240Ab0LOPt4 (ORCPT ); Wed, 15 Dec 2010 10:49:56 -0500 Message-ID: <4D08E391.2090205@siemens.com> Date: Wed, 15 Dec 2010 16:49:37 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Thomas Gleixner CC: Jan Kiszka , Avi Kivity , Marcelo Tosatti , "linux-kernel@vger.kernel.org" , kvm , Tom Lyon , Alex Williamson , "Michael S. Tsirkin" Subject: Re: [PATCH v3 2/4] genirq: Inform handler about line sharing state References: <4D07F70A.30209@web.de> <4D08CE44.6000407@siemens.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2157 Lines: 63 Am 15.12.2010 16:41, Thomas Gleixner wrote: > On Wed, 15 Dec 2010, Jan Kiszka wrote: > >> Am 15.12.2010 14:04, Thomas Gleixner wrote: >>> On Wed, 15 Dec 2010, Jan Kiszka wrote: >>>> Am 14.12.2010 21:54, Thomas Gleixner wrote: >>>>> On Mon, 13 Dec 2010, Jan Kiszka wrote: >>>>>> @@ -943,6 +950,9 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) >>>>>> /* Make sure it's not being used on another CPU: */ >>>>>> synchronize_irq(irq); >>>>>> >>>>>> + if (single_handler) >>>>>> + desc->irq_data.drv_status &= ~IRQS_SHARED; >>>>>> + >>>>> >>>>> What's the reason to clear this flag outside of the desc->lock held >>>>> region. >>>> >>>> We need to synchronize the irq first before clearing the flag. >>>> >>>> The problematic scenario behind this: An IRQ started in shared mode, >>>> this the line was unmasked after the hardirq. Now we clear IRQS_SHARED >>>> before calling into the threaded handler. And that handler may now think >>>> that the line is still masked as IRQS_SHARED is set. >>> >>> That should read "not set" I guess. >> >> Can't remember who wrote this, but that guy might have been too tired >> for clear sentences: Yes, of course, we could run into troubles, if >> IRQS_SHARED was _not_ set while the IRQ line is unmasked between hard >> and threaded handler. >> >>> Hmm, needs more thoughts :( >> >> Be warned, might be painful. > > Talking about headache. Your solution above does not prevent that > scenario. > > CPU 0 CPU 1 > > synchronize_irq(); > hard irq comes in sees shared and unmasks Nope, IRQ_ONESHOT is already cleared at that point. > clear IRQS_SHARED > thread handler runs and sees !SHARED > > Same scenario, just moved by a few lines :) The same, just the other way around - and mostly harmless, I hope. :) Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux -- 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/