Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1599910ybh; Thu, 23 Jul 2020 13:02:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxF6pxlRTH3RwZ7GISq/okYx45yizfkPEXi4jHSdJF+ENDvr7Zt1C4V0DqFytHR+zlzfvg6 X-Received: by 2002:a17:906:c285:: with SMTP id r5mr5886335ejz.153.1595534560457; Thu, 23 Jul 2020 13:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595534560; cv=none; d=google.com; s=arc-20160816; b=VWC5ZyJJ3/WA92lxR0kL7eYwYmvlSuB8uHAFmLkEorkRFumwZCK72eYi6dmgdGmGPv Bc1pEBip6gQhPM6bpph22tIjWePDg+KL/XvSr7mhDwdsJ8FliVOHQCFx1qpIBHHMzHYD wCYHkEIxXF5Xmbn0eZKhKVsbCEpu+rynQ+lXgqGh+FJBrA/NIy5XHCeJHixuERlzxvZl Tpu4uYWlsBKtqCk9Ha1ZeexWHPIpYc12XxadvfAGIpbnU2PjVnjIiC7/PdBJFbBodjMe IB7TdqubaTl7u5KUjEb/mioS034s5tFOqJqhyf9I9a0D5o9gJcrr5NsBz1VNaopBeTRP h3ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=MRwVqr0N2b8WDaLImhLP0DB/IrZrREwuBWJI9q4jFik=; b=kk+mwUCEkr0wu+vTQoP7ipbBUak9jdWsHG1tNlsOWbprqQTJ4aBokpvBGAQmU4oFTM Hu4w/JHT3X9Iwq9er8w8VfbYHgKiqHgn9fpmLKhHi098zjpIvLc7lyntONcs3AFoknI5 dQL7cW8CraKUc3H5TpxBJdrgqqMX1x57VmBF7r1n4yUdMDg4A0wJHQC7qbR7ECIoVJ3P +SJCBkALsZgYZY2ebFO3TMeJ8g/y+8mmp71bxeV8Be/jCrWd3ODiULzNgkSZ/SBjDaXz sSWZRsQpk3qRQcK+hvMtkDvrmbtpI8JOscsYj52Df9SUsGP2/rPFgA+ngN6LMnzTSpOK vwUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b="F8/Idme1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si2531553edw.265.2020.07.23.13.02.17; Thu, 23 Jul 2020 13:02:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b="F8/Idme1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726870AbgGWT7M (ORCPT + 99 others); Thu, 23 Jul 2020 15:59:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbgGWT7M (ORCPT ); Thu, 23 Jul 2020 15:59:12 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D47B7C0619DC; Thu, 23 Jul 2020 12:59:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=MRwVqr0N2b8WDaLImhLP0DB/IrZrREwuBWJI9q4jFik=; b=F8/Idme1+fZ+UyqfWxqOjQiiOv kWGRCzma/YyUhpR5nC5pQLnZ3KCnnK8P1BDAcvnLhea+4+0pM46KYYrL0VKeeVBQ4fR1RHSRbiVIZ SKgxxIqNgARKSoRnP6fdQiWkfmT80xSTcswSEb8FqfbbUFoR2KHKPY6f7HtQemc267mP6Kk/onlSj jZjLDvXaVO2nmOD6dwGyEwS+4+TQyR5UndHu1oP4FD68DfiLjzFMjmdA6cxlvjZ3vEn27my0iQPq8 t9vHlgWZ3ZcPcZY3aFq07InXlvZAAVknTFxaLbh9h7DDtBIqh7rO+TuX/H32s7lN3Np9/l9suq4YS 0TaiwXFg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyhMo-0008Nu-4V; Thu, 23 Jul 2020 19:58:59 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id F0287304E03; Thu, 23 Jul 2020 21:58:55 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7C49425942EEE; Thu, 23 Jul 2020 21:58:55 +0200 (CEST) Date: Thu, 23 Jul 2020 21:58:55 +0200 From: peterz@infradead.org To: Waiman Long Cc: Michael Ellerman , Nicholas Piggin , linuxppc-dev@lists.ozlabs.org, Will Deacon , Boqun Feng , Ingo Molnar , Anton Blanchard , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm-ppc@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH v3 5/6] powerpc/pseries: implement paravirt qspinlocks for SPLPAR Message-ID: <20200723195855.GU119549@hirez.programming.kicks-ass.net> References: <20200706043540.1563616-1-npiggin@gmail.com> <20200706043540.1563616-6-npiggin@gmail.com> <874kqhvu1v.fsf@mpe.ellerman.id.au> <8265d782-4e50-a9b2-a908-0cb588ffa09c@redhat.com> <20200723140011.GR5523@worktop.programming.kicks-ass.net> <845de183-56f5-2958-3159-faa131d46401@redhat.com> <20200723184759.GS119549@hirez.programming.kicks-ass.net> <6d6279ad-7432-63c1-14c3-18c4cff30bf8@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6d6279ad-7432-63c1-14c3-18c4cff30bf8@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 23, 2020 at 03:04:13PM -0400, Waiman Long wrote: > On 7/23/20 2:47 PM, peterz@infradead.org wrote: > > On Thu, Jul 23, 2020 at 02:32:36PM -0400, Waiman Long wrote: > > > BTW, do you have any comment on my v2 lock holder cpu info qspinlock patch? > > > I will have to update the patch to fix the reported 0-day test problem, but > > > I want to collect other feedback before sending out v3. > > I want to say I hate it all, it adds instructions to a path we spend an > > aweful lot of time optimizing without really getting anything back for > > it. > > It does add some extra instruction that may slow it down slightly, but I > don't agree that it gives nothing back. The cpu lock holder information can > be useful in analyzing crash dumps and in some debugging situation. I think > it can be useful in RHEL for this readon. How about an x86 config option to > allow distros to decide if they want to have it enabled? I will make sure > that it will have no performance degradation if the option is not enabled. Config knobs suck too; they create a maintenance burden (we get to make sure all the permutations works/build/etc..) and effectively nobody uses them, since world+dog uses what distros pick. Anyway, instead of adding a second per-cpu variable, can you see how horrible something like this is: unsigned char adds(unsigned char var, unsigned char val) { unsigned short sat = 0xff, tmp = var; asm ("addb %[val], %b[var];" "cmovc %[sat], %[var];" : [var] "+r" (tmp) : [val] "ir" (val), [sat] "r" (sat) ); return tmp; } Another thing to try is, instead of threading that lockval throughout the thing, simply: #define _Q_LOCKED_VAL this_cpu_read_stable(cpu_sat) or combined with the above #define _Q_LOCKED_VAL adds(this_cpu_read_stable(cpu_number), 2) and see if the compiler really makes a mess of things.