From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED738C433F5 for ; Tue, 29 Mar 2022 18:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240439AbiC2SPp (ORCPT ); Tue, 29 Mar 2022 14:15:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235546AbiC2SPo (ORCPT ); Tue, 29 Mar 2022 14:15:44 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 329B439BB4 for ; Tue, 29 Mar 2022 11:14:01 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1648577638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=K56BsfoBgMn9W+rnuLsv0bm5grEALntNroa6Yc82KdQ=; b=ZunERedBvlyrIkmrxBOXq+SFQ8oPAJgIiSTJSupnoMy84lsSq8+Y2ithnhrH89ev3RuYLd on4YdUn5/atLStXdp46m8hsxV++A3QYBwbS5ZZ1u/pUbMcaUe08ao8nRJKuZruOCClE7/b s3wNIGzjDFF9ojCSNct1rQQ4GYfogIrQPuQ4dD+1WHoiI4MPyxvIwZjPR0cx8CDhUnNIcP +wiD1x8SnNtfwssRGq9F2ST0x1KxfN+vEp9aJfdnG828YtchAykyspeoOMkiZx7eQ9y6gG SbrRF1hqYi8kGkBiMcG39wlAxjJcQvbi0bu0GOFo/KIWqucqNk3/UqFn3zcutQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1648577638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=K56BsfoBgMn9W+rnuLsv0bm5grEALntNroa6Yc82KdQ=; b=aAtoPleLjBNdBeKI37H4sj56tIZfUR4WxK9DqSTju6swEfqZnVAHT4B/GXVkAxEykVGOB3 gVyYaZS/2js+eTBg== To: "Michael S. Tsirkin" Cc: Jason Wang , virtualization , linux-kernel , Marc Zyngier , Peter Zijlstra , Stefano Garzarella , Keir Fraser , "Paul E. McKenney" Subject: Re: In-Reply-To: <20220329100859-mutt-send-email-mst@kernel.org> References: <20220325050947-mutt-send-email-mst@kernel.org> <20220325060659-mutt-send-email-mst@kernel.org> <20220328015757-mutt-send-email-mst@kernel.org> <20220328062452-mutt-send-email-mst@kernel.org> <87fsn1f96e.ffs@tglx> <20220329100859-mutt-send-email-mst@kernel.org> Date: Tue, 29 Mar 2022 20:13:57 +0200 Message-ID: <87v8vweie2.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 29 2022 at 10:37, Michael S. Tsirkin wrote: > On Tue, Mar 29, 2022 at 10:35:21AM +0200, Thomas Gleixner wrote: > We are trying to fix the driver since at the moment it does not > have the dev->ok flag at all. > > And I suspect virtio is not alone in that. > So it would have been nice if there was a standard flag > replacing the driver-specific dev->ok above, and ideally > would also handle the case of an interrupt triggering > too early by deferring the interrupt until the flag is set. > > And in fact, it does kind of exist: IRQF_NO_AUTOEN, and you would call > enable_irq instead of dev->ok = true, except > - it doesn't work with affinity managed IRQs > - it does not work with shared IRQs > > So using dev->ok as you propose above seems better at this point. Unless there is a big enough amount of drivers which could make use of a generic mechanism for that. >> If any driver does this in the wrong order, then the driver is >> broken. > > I agree, however: > $ git grep synchronize_irq `git grep -l request_irq drivers/net/`|wc -l > 113 > $ git grep -l request_irq drivers/net/|wc -l > 397 > > I suspect there are more drivers which in theory need the > synchronize_irq dance but in practice do not execute it. That really depends on when the driver requests the interrupt, when it actually enables the interrupt in the device itself and how the interrupt service routine works. So just doing that grep dance does not tell much. You really have to do a case by case analysis. Thanks, tglx