Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6811938ybx; Mon, 11 Nov 2019 15:19:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzvegpxmcpCx5V8dpwa/Dq2DCESD9fUiZY+587WzBUqWEqJxZnwKato/nzhqMRZUzKfMgME X-Received: by 2002:aa7:c2c7:: with SMTP id m7mr29539561edp.295.1573514390087; Mon, 11 Nov 2019 15:19:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573514390; cv=none; d=google.com; s=arc-20160816; b=Tp7jeSt3Ozwg2LDVmIeao0RxWDDhzr8na5iF0/gi+m4evo/3BIBI6oKZkXgJNNU/F9 k0UEHFTvIoXbBWxGlmqm0VnnjMqndfiIpekcgq+abDoNr9LPAx7UKv/7Wyb36FoTzt1N KSBkdxuWJDvIgv6WhrOTPUPalxB4ASkx7XnSAzbqIzipT6HjWsNkanh/ZN67u6Y6TmPK sb2mDCqhrKADu3hvC8+yR4ynFcaJFaZMa6bK0oF5+bE1ChhoNfYC/XBCaBclqgMKHJgF 8KdGv6s9/cGhSWvYFdr39iOK0hGbZoH4DHT1dLW+RLxraZDkHGC0/bf0wcew/7M6Qd0m vBKQ== 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:dkim-signature; bh=WvXx4qE4d2eguoyvM94B+KesD/Mbp+pLPJTG7OfKfVg=; b=Xfh6GjuDaGeLsJBSUyW3XnVXURHli/DMaAfTVCQ3SALoofo5ovKXYduyWoOok+I4aZ L37dosDRz7r5d7IRuls80Hhw8WmV/ccP4xcR1wgq6Dz15VLLpBzq/xsKqOGSFhwaHRL5 JeJqJHgdk66d4d6OpZSB/h3IcS+6Xx6Nmb9Od6yFZ3mpVEsqQrYLvTu5J8yj0M883D/B V0gu8tt5n6TK/nrLMfGvplblACGSlzDu1MX572/FvAeheqBl1IoVJ2JdLVdQkR0Rbjkx I5sTKqa1W+BPg46vQy0QgHzZnlszA5Gr84j10fV9k82PBkxvhLC3Tn4CGBPTm+9FVNtz h0Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FXgwpHMd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z16si12109176edd.314.2019.11.11.15.19.25; Mon, 11 Nov 2019 15:19:50 -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; dkim=pass header.i=@kernel.org header.s=default header.b=FXgwpHMd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727167AbfKKXRK (ORCPT + 99 others); Mon, 11 Nov 2019 18:17:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:35170 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726845AbfKKXRJ (ORCPT ); Mon, 11 Nov 2019 18:17:09 -0500 Received: from localhost (lfbn-ncy-1-150-155.w83-194.abo.wanadoo.fr [83.194.232.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8849E21872; Mon, 11 Nov 2019 23:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573514229; bh=LX9VeEqrFW1EFKmCoPu2j64UPY5i5NUdQVCJdGdQ7Xk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FXgwpHMdECRCuwrlNJLqaHXWtPYF1eC2pEcBnplWf7S6N9DPySDx4zNPR+AOHqnzY lpqW9E0JgcBlWFIX6aDHx/46lfbXwvbPrN+53+aJNt/H4tomr1Pt1WHc/6KJ1EDi7j 0FqdU8k3KOhHmfomNnl3v4QN1/7nRiO/vKPyzgrQ= Date: Tue, 12 Nov 2019 00:17:06 +0100 From: Frederic Weisbecker To: Ingo Molnar Cc: Peter Zijlstra , LKML , "Paul E . McKenney" , Thomas Gleixner Subject: Re: [PATCH 2/4] irq_work: Fix irq_work_claim() ordering Message-ID: <20191111231705.GC27917@lenoir> References: <20191108160858.31665-1-frederic@kernel.org> <20191108160858.31665-3-frederic@kernel.org> <20191111072005.GA112047@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191111072005.GA112047@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 11, 2019 at 08:20:05AM +0100, Ingo Molnar wrote: > > * Frederic Weisbecker wrote: > > > When irq_work_claim() finds IRQ_WORK_PENDING flag already set, we just > > return and don't raise a new IPI. We expect the destination to see > > and handle our latest updades thanks to the pairing atomic_xchg() > > in irq_work_run_list(). > > > > But cmpxchg() doesn't guarantee a full memory barrier upon failure. So > > it's possible that the destination misses our latest updates. > > > > So use atomic_fetch_or() instead that is unconditionally fully ordered > > and also performs exactly what we want here and simplify the code. > > Just curious, how was this bug found - in the wild, or via code review? Well, I wanted to make sure the nohz kcpustat patches are safe and I had a last minute doubt about that irq work scenario. So I would say code review :)