Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752492AbaBJI6V (ORCPT ); Mon, 10 Feb 2014 03:58:21 -0500 Received: from www.linutronix.de ([62.245.132.108]:56092 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751678AbaBJI6U (ORCPT ); Mon, 10 Feb 2014 03:58:20 -0500 Date: Mon, 10 Feb 2014 09:58:25 +0100 (CET) From: Thomas Gleixner To: Chuansheng Liu cc: linux-kernel@vger.kernel.org, xiaoming wang Subject: Re: [PATCH 1/2] genirq: Fix the possible synchronize_irq() wait-forever In-Reply-To: <1392020037-5484-1-git-send-email-chuansheng.liu@intel.com> Message-ID: References: <1392020037-5484-1-git-send-email-chuansheng.liu@intel.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Feb 2014, Chuansheng Liu wrote: > There is below race between irq handler and irq thread: > irq handler irq thread > > irq_wake_thread() irq_thread() > set bit RUNTHREAD > ... clear bit RUNTHREAD > thread_fn() > [A]test_and_decrease > thread_active > [B]increase thread_active > > If action A is before action B, after that the thread_active > will be always > 0, and for synchronize_irq() calling, which > will be waiting there forever. No. thread_active is 0, simply because after the atomic_dec_and_test() it is -1 and the atomic_inc on the other side will bring it back to 0. Thanks, tglx -- 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/