Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2710692imm; Sun, 24 Jun 2018 02:48:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIMHVEH7o4KOjFsKl37WkPFi05QKbD+76EnCwtdXs10ewHEqP+s9XgWVfQg1t9TvAiWnKhP X-Received: by 2002:a62:984b:: with SMTP id q72-v6mr421144pfd.206.1529833716783; Sun, 24 Jun 2018 02:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529833716; cv=none; d=google.com; s=arc-20160816; b=fOfQnilhbyPDW9IHLhS5EYGWGKdc7rRfHFOub2V3XQnR/Pi2uvEafga4R/bf2F6eEm qTazKDnJDiDVLvUknmQeCkLy1FXjPMgEIesSo6tVYYcyhuNvWSbPWbnetWJ7ENYRmDkL h8yd3ZQ/pW+4oBYG4eJsIUzYnPbMVtDhSUpsHA1PtNL12Fy+s+U+lIOSnNLErtucD3KC IKSTZY83B1KoGGozKZFTNEvsbcubhsoHVtj+uEJ9EyaicOh567s3LBQMb7EGaJnbZppA Jrua/FKfj08KecDwB5G44pv0nbdJ5aGETswcUcmnQ6rfh22SPuMPLb0iE3AX8Dsuv0ev oe0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=Wd/04qHkkIWlb0gsybl3Tc3Pvz8HOZ4f5fA1yz+2fMA=; b=RxXgkgX2nb/QTgB0sJ5VIzISFC91Zy19w8+MPjpQDb5ktplgW8QTEo9JgjkkfOcbJx gnVROkgRV8d26C/I9/at2TMZ5HnErSMZ6fIb35mDwInK63I/H7XyMbSRSGMSTSil5zNL 0R2TwvfAQuhY2QlfZw2uh6RDIv6hX7aNYneAhG2GpZgLqh9mBDX45lR8lEVVTYP99i5M jWkb+ecWoUzcJp7YjRddDor/WJbTNdQnd7GSkvf18EtKdCZRVaceA2+1d7whDK+O/LVu n1wy6jkNGj3dtwsJNCPgU6kqXJOeCu5VKiMeb/I2Syse1bTVfZqoLiKLVjpRcNX5SgL9 PSiA== 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 b125-v6si9795296pgc.514.2018.06.24.02.48.22; Sun, 24 Jun 2018 02:48:36 -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 S1752106AbeFXJrh (ORCPT + 99 others); Sun, 24 Jun 2018 05:47:37 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:44789 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751900AbeFXJrg (ORCPT ); Sun, 24 Jun 2018 05:47:36 -0400 Received: from p4fea482e.dip0.t-ipconnect.de ([79.234.72.46] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fX1cK-0003JY-Bg; Sun, 24 Jun 2018 11:47:32 +0200 Date: Sun, 24 Jun 2018 11:47:31 +0200 (CEST) From: Thomas Gleixner To: Lukas Wunner cc: Bjorn Helgaas , Mika Westerberg , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v2 1/2] genirq: Update code comments wrt recycled thread_mask In-Reply-To: <32fc25aa35ecef4b2692f57687bb7fc2a57230e2.1529828292.git.lukas@wunner.de> Message-ID: References: <32fc25aa35ecef4b2692f57687bb7fc2a57230e2.1529828292.git.lukas@wunner.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lukas, On Sun, 24 Jun 2018, Lukas Wunner wrote: > Previously a race existed between __free_irq() and __setup_irq() wherein > the thread_mask of a just removed action could be handed out to a newly > added action and the freed irq thread would then tread on the oneshot > mask bit of the newly added irq thread in irq_finalize_oneshot(): > > time > | __free_irq() > | raw_spin_lock_irqsave(&desc->lock, flags); > | > | raw_spin_unlock_irqrestore(&desc->lock, flags); > | > | __setup_irq() > | raw_spin_lock_irqsave(&desc->lock, flags); > | > | raw_spin_unlock_irqrestore(&desc->lock, flags); > | > | irq_thread() of freed irq (__free_irq() waits in synchronize_irq()) > | irq_thread_fn() > | irq_finalize_oneshot() > | raw_spin_lock_irq(&desc->lock); > | desc->threads_oneshot &= ~action->thread_mask; > | raw_spin_unlock_irq(&desc->lock); > v > > The race was known at least since 2012 when it was documented in a code > comment by commit e04268b0effc ("genirq: Remove paranoid warnons and > bogus fixups"). The race was known, but it was also harmless as nothing would touch stuff after synchronize_irq(). > But it wasn't until 2017 that it was fixed by commit 9114014cf4e6 > ("genirq: Add mutex to irq desc to serialize request/free_irq()"), > apparently inadvertantly so because the race is neither mentioned in the > commit message nor was the code comment updated. Make up for that. Thanks for following up. This update is very well done. tglx