Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6498484ybl; Wed, 15 Jan 2020 05:44:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwz/bl7gvof20DVoNBue2GTNL0QIsfkkbugVzs8ZVVuwre/OHInQZJk30eCVPtmhf2VM17B X-Received: by 2002:aca:503:: with SMTP id 3mr21410775oif.106.1579095884692; Wed, 15 Jan 2020 05:44:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579095884; cv=none; d=google.com; s=arc-20160816; b=BV6PjEB5BK0SO9dyBvoXo42AWHM6BdBD2nmWWjQkbiKe1/ta6jFurngwp5dOBSNiud WlmsTjedtgbAWRA9SklIt+2Vp4RAE71vQQ5ralQNGHOVMwRROLHC5r71GJfkkX+mWoWV agPHU7/EpTQTU5srckfpo1GYQ/fBp7BQ8U0AhHy7KZ3XFpXzJ2wR+fHveQ7g81IIOpls LD+cEPPZ3TrJ+v3Q9GcLsBwvncQ0q/FxJwL1cmhi15s/zGGljp6PYSZoENQMBfa7aUBb QWL6zskPjOlabvdF5YVyDoH/Zp9Dv9qSoPB2s9pjHm6B6XOFbU2NidgsatDqPqWTdKzE SnJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=0T4Fc6mk+CmWOxeuRP2K6FKEoT5LAPSy5wz4HFmqZu0=; b=xNSdjvRWzcqqcxl40EwsKxHfyaWHl4SlEB0BYUsOt2kwd5YOvvQu5luvNI7qVkvB6f DHGDfvh+qPN2F32K+/EYzrI31lPmnC8VbmglCEH5rtxc3uyJVa5qX0+1UyWPKQkMetqj QK/JDMCAYC4lcJaF4GOh+hwaLTHtRF2HpYOfWw14PQ2cnLZvPh+0K/P+94//wAOt24aR jekO0xiTwJFenaD95ucqH9QK+9+aNGAnNZXeHc6ddwJ7UatTCzo0QjiIEnE7kkcUX8UO EhHdHIyCRoEK48uCBww3VKYgTJY8LljNmYmRTA+cfjiPJKick1tqfTximjKmvVmpPWn0 /ECA== 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 m82si9217409oig.129.2020.01.15.05.44.31; Wed, 15 Jan 2020 05:44:44 -0800 (PST) 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 S1726554AbgAONn1 (ORCPT + 99 others); Wed, 15 Jan 2020 08:43:27 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:47244 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbgAONn1 (ORCPT ); Wed, 15 Jan 2020 08:43:27 -0500 Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1irixB-0007Po-G9; Wed, 15 Jan 2020 14:43:25 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id C547110122A; Wed, 15 Jan 2020 14:43:14 +0100 (CET) From: Thomas Gleixner To: chengkaitao Cc: linux-kernel@vger.kernel.org, smuchun@gmail.com, Kaitao Cheng Subject: Re: [RESEND v2] irq: Refactor irq_wait_for_interrupt info to simplify the code In-Reply-To: <20200106154430.3413-1-pilgrimtao@gmail.com> References: <20200106154430.3413-1-pilgrimtao@gmail.com> Date: Wed, 15 Jan 2020 14:43:14 +0100 Message-ID: <877e1sg7il.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org chengkaitao writes: > From: Kaitao Cheng > > Cleanup extra if(test_and_clear_bit), and put the other one in front. That simplifies the code but opens a race window: CPU 0 CPU 1 irq_wait_for_interrupt() has not yet reached schedule() free_irq() remove_action(); synchronize_irq(); #ifdef CONFIG_DEBUG_SHIRQ action->handler() if (test_and_clear_bit()) ---> bit is not set yet --> SET thread running #endif kthread_stop() if (kthread_stop()) ---> Leave with bit set and thread active count != 0 That's just the most obvious example... Thanks, tglx