Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2782758imm; Sun, 24 Jun 2018 04:35:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIxGGh8lqbRpylZ0a2SiCgSWrM1XFD6yHxCQ87+tE7mbdQWfC0s7BgQhvCtYFzzfJqtluej X-Received: by 2002:a62:12ce:: with SMTP id 75-v6mr1100853pfs.243.1529840101108; Sun, 24 Jun 2018 04:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529840101; cv=none; d=google.com; s=arc-20160816; b=0f3yU03h1LyOKan8biLpL8E7EasV631fht+xQYRP4BTM6s73cXhhNbJXnM/kfXKfCc WwapFWPc4K8JsCmRVXjpp5GYesgW7MdlMHl4glM1e8pM+t9MpBYiesYTHZE4oCZautNy YIf73Xf2bfQTwxDJB69iMDvdbtQNsd5gKmE8N7qRs6bv/9mZ5V+ZGeoR3BTyKocp1dtt NKN9pKw2WVL4r5tKCSqAjOZ2UXWKLSD2xzyBZgZcxHw61w+cfwXAgS7IiKLdZ1ujXnxH Io3NAOWzgyE/uwDaxU7tatdVxtkFWEJs6MQQZjPBjCyEGNt4hsWNG3yMNRW9OtcjPqkB QRHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=tESMduntnOzIJADe7ZDJEBXu8ifZK4BV0j+SMwYISaA=; b=yqNsMlrrGH2QnKb6/JbUZH2NQiJF0GgTVq2R2l99HPvQrYH8I3qqe7BBCG6wkKyIKB uRGQ0I+h9h6I6PaJaZud2C7WM325XLtCDlubhlvwUfsEwOoTaRPhpRI++C1P+w69QWL/ Pdkk8YM2vyNB9QQYvtzOQQLE3k2gA2JDWFa/ChQx8zTLGu8Rx8sCxKiEwMdZ8Tw2DlZx el7fUYJ0UejfrUrSnjxbv8V1SZse4D9MacBRSTRCRTktPYj5O/tIbQFJjdWTRGzEioZx h402roSnJwNuC2FiZ2mClcGPrVplAJQIiyfbdEKKKq3XHLc5PGdzUWUv6VSYC5Bs61iM V3YA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5-v6si9665964pgn.660.2018.06.24.04.34.46; Sun, 24 Jun 2018 04:35:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751352AbeFXLeH (ORCPT + 99 others); Sun, 24 Jun 2018 07:34:07 -0400 Received: from bmailout2.hostsharing.net ([83.223.90.240]:60951 "EHLO bmailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750780AbeFXLeG (ORCPT ); Sun, 24 Jun 2018 07:34:06 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id 491182800B489; Sun, 24 Jun 2018 13:34:04 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id DB885351FE; Sun, 24 Jun 2018 13:34:03 +0200 (CEST) Date: Sun, 24 Jun 2018 13:34:03 +0200 From: Lukas Wunner To: Thomas Gleixner Cc: Bjorn Helgaas , Mika Westerberg , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v2 2/2] genirq: Synchronize only with single thread on free_irq() Message-ID: <20180624113403.GA22016@wunner.de> References: <32fc25aa35ecef4b2692f57687bb7fc2a57230e2.1529828292.git.lukas@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 24, 2018 at 11:49:10AM +0200, Thomas Gleixner wrote: > On Sun, 24 Jun 2018, Lukas Wunner wrote: > > When pciehp is converted to threaded IRQ handling, removal of unplugged > > devices below a PCIe hotplug port happens synchronously in the IRQ > > thread. Removal of devices typically entails a call to free_irq() by > > their drivers. > > Is this an actual mainline problem or did you discover that in course of > upcoming work? It's needed for upcoming work, specifically the pciehp event handling rework which will hopefully appear in 4.19, so nothing urgent. Doesn't hurt at all to let this bake in linux-next for a few weeks. There is something else, you introduced irq_wake_thread() four years ago with a92444c6b222 for sdhci/sdio, but for some reason it was never used. Before you or anyone else deletes it for lack of callers, please be aware that I'm making heavy use of it now in pciehp. I forgot to cc you on the relevant patch [17/32], but I'll bounce it to you in a minute in case you want to take a look at it. Of course this begs the question how irq_wake_thread() is serialized against __free_irq(), but it seems that's safe because irq_wake_thread() searches the action list while holding desc->lock: If it grabs the lock before __free_irq(), it'll just wake the thread normally. If it grabs the lock after __free_irq(), the action will be gone from the list, so irq_wake_thread() essentially becomes a no-op. Thanks, Lukas