Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2268910imm; Wed, 3 Oct 2018 00:52:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV609fwHBvOlV+5q1mdQ4aC7H1QM+p/tl6k6rlHvlbgG15s7/Sbl30rVHnf6nu9GK2uRcoTsE X-Received: by 2002:a62:c80d:: with SMTP id z13-v6mr302604pff.176.1538553145833; Wed, 03 Oct 2018 00:52:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538553145; cv=none; d=google.com; s=arc-20160816; b=aikI/GZ/awQzFkkVTjLrrsPTluT0ysd0UTYdhmFPvVA+ynOS0UiXJo4hIqHnKIoNqn RxOvqmEVelusbpd3rYdDA1AkGG5rF7EiPP38PwdGogLrgni/aLCIG3q9lgR3X0Gva3Wh vjsxCRfbEivVwjYFl/c0y/9W/w7/4U3WE7FBxrAHiTXDHpe20FVEiPaZhhWpH0StI0xy g9fcBZ13VP9+WrHjiufx0tA2mHClahvPCrmLTToWwhTwRf+cPzxvqbbGHXnX1/dvvGSA Xamufx11XtVSTa6Z3QfHqik1kOi5CSBvewhmL2p0x8BI6pxc2eJUj/FzVnxLbTHnfGqN LYrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=CbicJzD58fdOtKx7t5bCoEkBGyi3qCYx7bl52AeIWYM=; b=jm4TWcZaDWEdAE5eeAwNrsDzDSkPEZHB92lxsD7dJ/cbg5I9ogfqFyRpBtXu0wChYr O4/gz+q8IQWrtkTImyDFDj/8VGeORNmPxNi27788jCHrz3bdeEJ74hD28TiBK0JkkB6J 2MAvsVWC43FmIZeS1DqEeK9ANh7tMrXQ5pZYwIPdxH20t6QiZU4Pxf/oVj35Cwon6HcN gYaYVrFmZ27olrrR0ANe+R+BaoDq+9o0vOXfXIumFPT6NhgUqzTOG2+AogdzHQjUySNR lwKjp3ACqvh81KoqauFCiq/CjJDGZuhHQvPRoJc93tXuJ5aoiKam94NYCC4mg3kfe0NX KpDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arm-com.20150623.gappssmtp.com header.s=20150623 header.b=k2VyUpe8; 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 q61-v6si716787plb.231.2018.10.03.00.52.10; Wed, 03 Oct 2018 00:52:25 -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; dkim=pass header.i=@arm-com.20150623.gappssmtp.com header.s=20150623 header.b=k2VyUpe8; 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 S1727001AbeJCOjR (ORCPT + 99 others); Wed, 3 Oct 2018 10:39:17 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:32986 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726872AbeJCOjR (ORCPT ); Wed, 3 Oct 2018 10:39:17 -0400 Received: by mail-pf1-f195.google.com with SMTP id d4-v6so1293645pfn.0 for ; Wed, 03 Oct 2018 00:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CbicJzD58fdOtKx7t5bCoEkBGyi3qCYx7bl52AeIWYM=; b=k2VyUpe8WNtfvYhALRKu84OULuG5BaURt+O78pv+oqhaRLU+go151Xi+K/LBg8OSmJ ta7hdLtVrV948ZzPszJmtla4rNBgSPKsd5h9hlH+QxFVZjY7mtPc75AA0TzeaSYktHUD SwCkrgEGjg8TviyYZoDb2XqkjkLcsg2h4VXSxYAo2B+TfvSSlmPqTQu/ZqTmSxhlm3A9 tg1UGl/Qgb0i8MB/Q9rjk6OngZLqUgep1SIF2+hlCf8lRJ7PIFQ0fQ4oBMoQiNHP+xhK hOV0xiOMJ/vHO/sC0Tuls83IPAdps+plrooeeNy9Nt3jP87f8uCBdlOF95azi07Rq1MY Zpyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CbicJzD58fdOtKx7t5bCoEkBGyi3qCYx7bl52AeIWYM=; b=N/xJnDpfN7SpQ+Zdz5v67WXIYjfmVozFQErvLc+TIqkspyJwI47JwyEor4FTzy85RK q4ZGoYFXLuKgjCqEtzSwyvglZM25Ea1vdlsIeQJM7tokgmZ3NxGpCw+1g5x+FhiZs9Fq B54vShqDb7tZ3abt8ONY48Ycfn3EexUXHYn7pTj0utB+FnaAlANhqQymQpV8637qTJfm wu8MVOv0Yu4fIF02lBmFkS/46eGjzphvttxHYBmfLE4c6veYs3kCNuUvD62rfc0cJO57 LrORMpC9JNysVGycjztOaFJbGJAoVT8jlIw5ZpJGEhzBJBF2a9wNZsHxZ/avc6mEhg7h Tq6g== X-Gm-Message-State: ABuFfoiL93E2nQAHCCQu9WxY9kobm8VrXSEftmErnAFrtp7dzEys9j8O kFVCS3vI+17ZB0oIvg3Qu9jZxh7rBhQxfkwPswk= X-Received: by 2002:a62:468e:: with SMTP id o14-v6mr297990pfi.180.1538553121544; Wed, 03 Oct 2018 00:52:01 -0700 (PDT) MIME-Version: 1.0 References: <20180921120226.6xjgr4oiho22ex75@linutronix.de> <20180921122058.GB24124@hirez.programming.kicks-ass.net> In-Reply-To: <20180921122058.GB24124@hirez.programming.kicks-ass.net> From: Catalin Marinas Date: Wed, 3 Oct 2018 08:51:50 +0100 Message-ID: Subject: Re: [Problem] Cache line starvation To: Peter Zijlstra Cc: bigeasy@linutronix.de, Linux Kernel Mailing List , daniel.wagner@siemens.com, Will Deacon , x86@kernel.org, Linus Torvalds , "H. Peter Anvin" , boqun.feng@gmail.com, Paul McKenney Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Sep 2018 at 13:22, Peter Zijlstra wrote: > On Fri, Sep 21, 2018 at 02:02:26PM +0200, Sebastian Andrzej Siewior wrote: > > We reproducibly observe cache line starvation on a Core2Duo E6850 (2 > > cores), a i5-6400 SKL (4 cores) and on a NXP LS2044A ARM Cortex-A72 (4 > > cores). > > > > The problem can be triggered with a v4.9-RT kernel by starting > > > Daniel reported that disabling ticket locks on 4.4 makes the problem go > > away, but he hasn't run a long time test yet and as we saw with 4.14 it can > > take quite a while. > > On 4.4 and 4.9 ARM64 still uses ticket locks. So I'm very interested to > know if the ticket locks on x86 really fix or just make it harder. > > I've been looking at qspinlock in the light of this and there is indeed > room for improvement. The ticket lock certainly is much simpler. FWIW, in the qspinlock TLA+ model [1], if I replace the atomic_fetch_or() model with a try_cmpxchg loop, it violates the liveness properties with only 2 CPUs as one keeps locking/unlocking, hence changing the lock value, while the other repeatedly fails the cmpxchg. Your latest qspinlock patches seem to address this (couldn't get it to fail but the model is only sequentially consistent). Not sure that's what Sebastian is seeing but without your proposed qspinlock changes, ticket spinlocks may be a better bet for RT. [1] https://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/kernel-tla.git/tree/qspinlock.tla -- Catalin