Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1668851ybh; Thu, 23 Jul 2020 14:59:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE+JRpwJq3iiDmEGg9U+hVbIVIEde9ZicweGpsq4lo+Z/3/IdSsJA24Mj221i1D9/1SbWu X-Received: by 2002:a05:6402:3048:: with SMTP id bu8mr6382312edb.367.1595541575755; Thu, 23 Jul 2020 14:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595541575; cv=none; d=google.com; s=arc-20160816; b=ZXDIW8ClHYgPsgcIEXXp8Q5qEKDlfNKhPOufbNmli1S/YEkyAsngVXRa9ELta1Hz6N DQj0b9I4rRDFkcVy4feDKNqL/QtbjhLjU3mrD4fQMWVDpbOFeJujkEtRk93Q6iNvB9K/ IXqLL+Yk2Q3bmUJS/Z2SGZbggm50F5jn802Axeyounx60Im63PYyMn7rzvgjrmJ/bdOn XMpQJhHDGXuiFX3C/xc6IqoVJ7ndpXExnykWztAkwIHsmOZiDFBhsOffOH+kF4Rnvn6q iGtd7v9bNhK0O15SryVGbSpsowHKnTPFJ5CwrhZ4ZjMALK3J3DcHe7JAttmttFikAxoH l8oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=T3T05BblW5qcrnE9EzvsH5COWPH3G8n5S+3dyvDj4j8=; b=0y8dm5bychMcDk22aeXK3uJrb6Ir0bK3eLyeBIuvtqMc77VustEV76p2jBw5Emf7t5 2ImkWZ0KTJ0AS3VsMB/ryPn42yrXB7/Jg8RZSy4bI0UHibsRyJEAW7GZo82nowrNPXET R0wkSn3stBpwKKC5s3rof6Zo+LcykWUaaWSC//37Cl/LfMqjBkJ/bUVaDtC00Um2KfRh 6IPIvb3K4iE35Qp7Ih6Z5DzjPjjnJmcwLlXOO3YpMTZx6lGdTtVHgIw/hoee0KONrRfe Ae/jtdMeOsyolwDniA2NaGj/TsDpof09h4tSpFWK1j8fHuVUxOh4iV/ajbX1HwXxfO77 wzhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NNZgxHPY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si3445001edn.145.2020.07.23.14.59.13; Thu, 23 Jul 2020 14:59:35 -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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NNZgxHPY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726368AbgGWV6x (ORCPT + 99 others); Thu, 23 Jul 2020 17:58:53 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:50226 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726697AbgGWV6w (ORCPT ); Thu, 23 Jul 2020 17:58:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595541531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T3T05BblW5qcrnE9EzvsH5COWPH3G8n5S+3dyvDj4j8=; b=NNZgxHPYs7IiJSENv23mZk1yvLJWyFHvx9PaUvtbFiATGc0fHdN/j3DhIep3IxgB5/Oqmo I55Vg6aqdMmQt5WkO4PBr/ENZ0vLouZEYuSY2kdpYnxpfJx2384HcOMqaOyIvKfJ7C/vWp JuCJ1bDLV+D2D5Y3yBT1m4y66grP22o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-309-1wwkHWrOOpOP_vwI3YSGQw-1; Thu, 23 Jul 2020 17:58:47 -0400 X-MC-Unique: 1wwkHWrOOpOP_vwI3YSGQw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6195D80183C; Thu, 23 Jul 2020 21:58:45 +0000 (UTC) Received: from llong.remote.csb (ovpn-119-128.rdu2.redhat.com [10.10.119.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6E245C1D3; Thu, 23 Jul 2020 21:58:43 +0000 (UTC) Subject: Re: [PATCH v3 5/6] powerpc/pseries: implement paravirt qspinlocks for SPLPAR To: peterz@infradead.org 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 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> <20200723195855.GU119549@hirez.programming.kicks-ass.net> From: Waiman Long Organization: Red Hat Message-ID: <4fbe47a5-dbc9-427a-5b21-b31b37bc751a@redhat.com> Date: Thu, 23 Jul 2020 17:58:43 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200723195855.GU119549@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/23/20 3:58 PM, peterz@infradead.org wrote: > 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. > Thanks for the suggestion. I will try that out. Cheers, Longman