From patchwork Thu Dec 13 14:09:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 153649 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp846267ljp; Thu, 13 Dec 2018 06:10:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/WDOApFujqK2ffkg2If3pl7fbAUxuH1lon3NnYK5iDvIpAakXi2wCzQJbJvHbxKgLr//HQA X-Received: by 2002:a17:902:6b83:: with SMTP id p3mr23599496plk.118.1544710207504; Thu, 13 Dec 2018 06:10:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544710207; cv=none; d=google.com; s=arc-20160816; b=QRR66QqEiCeVsF23V367aYB+PV76K0PmJosqnHxlRRe5AG8XcgQkWUbWb/SbRuoyaZ M50ZVouknAA+VXG5HXLqLc70726BTgcOY1bJvkx68tGBnGsEVvLhAAl4Sgv0KFECUCfY oNLyblOuZXWf2r2qzi1JMZFfdJ9YuUFdpKe+rFnulcex7SjhBu280/kDvGH0KbmlIlJ4 ysK4f0HmcyevxUrbNrqNyIESh7lb9pbVZe1wAc4I8IFWJdw7+yeeAzg+kLQQXmQQomz0 70YANIMH2UcSVj4+blwceB8/pPfZ8I8muofdKWeKY33fvecQI4O9HJjyzyXXTwVq6mgG 80eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :illegal-object:reply-to:references:in-reply-to:message-id:date :subject:cc:to:from; bh=L9t8W1ECP18lz3Fks93eqLxztSdSNs4ONKnrzfc25H4=; b=bhu2Eq4ZJ4MPn6fyc2xRNnJczaIfGxjofLy/Nr6WpZ9jvESHWkPfrGUAbITUxxL2+y diEXpKNhiNQJWm490Ev/FaCbZ9ky0DKeu5yyUiXGKoruaDTl+3bVwkanDJhmjEURoBib fijVEM+yksqiZ2/62RCngU1bVi3KOrtTxA+ca+mW8ljXMtyh9sDAtyDXDERokslrGUua jS4hxXfNPva8blYUzYj6qYYmeeCdkT998AJ2wuJBN9G0K0LkEnllXaCiF0marCnhSs7w URHPcHFtqOcZpjRj7iwYB48jvVbBYVjtMO6Xwu64Hu6lKmtYYyoj/NkO3+Kup8H43luJ MO7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 t16si1817482pfk.139.2018.12.13.06.10.07; Thu, 13 Dec 2018 06:10:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728611AbeLMOJy (ORCPT + 15 others); Thu, 13 Dec 2018 09:09:54 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:46572 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728596AbeLMOJy (ORCPT ); Thu, 13 Dec 2018 09:09:54 -0500 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1gXRgL-0001G3-6j; Thu, 13 Dec 2018 15:09:41 +0100 From: Sebastian Andrzej Siewior To: stable@vger.kernel.org Cc: Peter Zijlstra , Will Deacon , Thomas Gleixner , Daniel Wagner , Waiman Long , Linus Torvalds , boqun.feng@gmail.com, linux-arm-kernel@lists.infradead.org, paulmck@linux.vnet.ibm.com, Ingo Molnar , Sebastian Andrzej Siewior Subject: [PATCH STABLE v4.9 09/10] locking/qspinlock/x86: Increase _Q_PENDING_LOOPS upper bound Date: Thu, 13 Dec 2018 15:09:24 +0100 Message-Id: <20181213140925.6179-10-bigeasy@linutronix.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181213140925.6179-1-bigeasy@linutronix.de> References: <20181213140925.6179-1-bigeasy@linutronix.de> Reply-To: [PATCH STABLE v4.9 00/10], Backport, for, cache line starvation on x86 Illegal-Object: Syntax error in Reply-To: address found on vger.kernel.org: Reply-To: cache line starvation on x86 ^-extraneous tokens in address MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Will Deacon commit b247be3fe89b6aba928bf80f4453d1c4ba8d2063 upstream. On x86, atomic_cond_read_relaxed will busy-wait with a cpu_relax() loop, so it is desirable to increase the number of times we spin on the qspinlock lockword when it is found to be transitioning from pending to locked. According to Waiman Long: | Ideally, the spinning times should be at least a few times the typical | cacheline load time from memory which I think can be down to 100ns or | so for each cacheline load with the newest systems or up to several | hundreds ns for older systems. which in his benchmarking corresponded to 512 iterations. Suggested-by: Waiman Long Signed-off-by: Will Deacon Acked-by: Peter Zijlstra (Intel) Acked-by: Waiman Long Cc: Linus Torvalds Cc: Thomas Gleixner Cc: boqun.feng@gmail.com Cc: linux-arm-kernel@lists.infradead.org Cc: paulmck@linux.vnet.ibm.com Link: http://lkml.kernel.org/r/1524738868-31318-5-git-send-email-will.deacon@arm.com Signed-off-by: Ingo Molnar Signed-off-by: Sebastian Andrzej Siewior --- arch/x86/include/asm/qspinlock.h | 2 ++ 1 file changed, 2 insertions(+) -- 2.20.0 diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h index e07cc206919d4..8b1ba1607091c 100644 --- a/arch/x86/include/asm/qspinlock.h +++ b/arch/x86/include/asm/qspinlock.h @@ -5,6 +5,8 @@ #include #include +#define _Q_PENDING_LOOPS (1 << 9) + #define queued_spin_unlock queued_spin_unlock /** * queued_spin_unlock - release a queued spinlock