From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A372C433EF for ; Mon, 27 Jun 2022 13:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235532AbiF0N0F (ORCPT ); Mon, 27 Jun 2022 09:26:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233892AbiF0N0C (ORCPT ); Mon, 27 Jun 2022 09:26:02 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A4F2063D5 for ; Mon, 27 Jun 2022 06:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656336360; 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=naeqYXHlGAllaeUBiv2eXRj7Ab0soUVGYGMw5VF+feE=; b=Hxj0vkRyCE5YuH02QfbsYqhYZ0Z1+yW58IzlY43GCV9b7ahHsp8a9/ptO5UBlOTlS/t3zE dxQFQEJuodXBfGDc84CEu4a0t+YVX9OFxMqAzHrT62eG0YB05+vcFXsFDrA0yYPoj7w8+E o3Uqn6UGpg5iA77t06MNr85LqpO+TMQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-519-ms0AQoCiMEW_P8SRgRceKQ-1; Mon, 27 Jun 2022 09:25:57 -0400 X-MC-Unique: ms0AQoCiMEW_P8SRgRceKQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 690A93C11060; Mon, 27 Jun 2022 13:25:56 +0000 (UTC) Received: from [10.22.10.125] (unknown [10.22.10.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id 742B82166B29; Mon, 27 Jun 2022 13:25:55 +0000 (UTC) Message-ID: <14a3278e-0299-8138-ff73-654d0208bdfa@redhat.com> Date: Mon, 27 Jun 2022 09:25:54 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2] x86/paravirt: useless assignment instructions cause Unixbench full core performance degradation Content-Language: en-US To: Guo Hui , peterz@infradead.org Cc: jgross@suse.com, srivatsa@csail.mit.edu, amakhalov@vmware.com, pv-drivers@vmware.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, will@kernel.org, boqun.feng@gmail.com, virtualization@lists.linux-foundation.org, wangxiaohua@uniontech.com, linux-kernel@vger.kernel.org References: <20220627021350.25714-1-guohui@uniontech.com> <62b94621.1c69fb81.3a378.57ccSMTPIN_ADDED_BROKEN@mx.google.com> From: Waiman Long In-Reply-To: <62b94621.1c69fb81.3a378.57ccSMTPIN_ADDED_BROKEN@mx.google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/27/22 01:54, Guo Hui wrote: > Thank you very much Longman, my patch is as you said, only disable > node_cpu on X86, enable node_cpu on arm64, powerpc, s390 architectures; > the code is in file arch/x86/kernel/paravirt-spinlocks.c: >     DECLARE_STATIC_KEY_FALSE(preemted_key); >     static_branch_enable(&preemted_key); > > the default value of preemted_key is false and the if conditional > statement is reversed, > the code is in file kernel/locking/osq_lock.c: >     DEFINE_STATIC_KEY_FALSE(preemted_key); > >     static inline int node_cpu(struct optimistic_spin_node *node) >     { >         int cpu = 0; > >         if (!static_branch_unlikely(&preemted_key)) >             cpu = node->cpu - 1; > >         return cpu; >   } > > In this way, only one nop instruction is added to architectures arm64, > powerpc and s390, including virtual machines, without any other changes. You are right. I am probably too tired last night to read the patch more carefully. Cheers, Longman From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2B6A0C43334 for ; Mon, 27 Jun 2022 13:26:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B025F60D74; Mon, 27 Jun 2022 13:26:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B025F60D74 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MZumfXL7 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fBnz5wx8j58M; Mon, 27 Jun 2022 13:26:10 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 0448360AFA; Mon, 27 Jun 2022 13:26:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0448360AFA Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E08B6C0039; Mon, 27 Jun 2022 13:26:09 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8FB0BC002D for ; Mon, 27 Jun 2022 13:26:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 4C89E41988 for ; Mon, 27 Jun 2022 13:26:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4C89E41988 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MZumfXL7 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mbnpsxxaWkK0 for ; Mon, 27 Jun 2022 13:26:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 33AD041951 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 33AD041951 for ; Mon, 27 Jun 2022 13:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656336362; 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=naeqYXHlGAllaeUBiv2eXRj7Ab0soUVGYGMw5VF+feE=; b=MZumfXL7Lz3XqmAC/xFDEJ386+/1AwRhnfIbT8wF8HYqtQS6LSVDLyQWuxTYdqUYINUBS+ /iKp7i+n/0Tvck26ukoq1GT3UVOZjMGwIZLOkAM0EDXMhDrgLH1wiI8QDU2an1fBWIARX0 eg8nT4Rt2wO/+ReCxPigBlszFNEEAxg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-519-ms0AQoCiMEW_P8SRgRceKQ-1; Mon, 27 Jun 2022 09:25:57 -0400 X-MC-Unique: ms0AQoCiMEW_P8SRgRceKQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 690A93C11060; Mon, 27 Jun 2022 13:25:56 +0000 (UTC) Received: from [10.22.10.125] (unknown [10.22.10.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id 742B82166B29; Mon, 27 Jun 2022 13:25:55 +0000 (UTC) Message-ID: <14a3278e-0299-8138-ff73-654d0208bdfa@redhat.com> Date: Mon, 27 Jun 2022 09:25:54 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2] x86/paravirt: useless assignment instructions cause Unixbench full core performance degradation Content-Language: en-US To: Guo Hui , peterz@infradead.org References: <20220627021350.25714-1-guohui@uniontech.com> <62b94621.1c69fb81.3a378.57ccSMTPIN_ADDED_BROKEN@mx.google.com> From: Waiman Long In-Reply-To: <62b94621.1c69fb81.3a378.57ccSMTPIN_ADDED_BROKEN@mx.google.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Cc: jgross@suse.com, x86@kernel.org, hpa@zytor.com, pv-drivers@vmware.com, boqun.feng@gmail.com, dave.hansen@linux.intel.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, mingo@redhat.com, bp@alien8.de, amakhalov@vmware.com, tglx@linutronix.de, will@kernel.org, wangxiaohua@uniontech.com X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" T24gNi8yNy8yMiAwMTo1NCwgR3VvIEh1aSB3cm90ZToKPiBUaGFuayB5b3UgdmVyeSBtdWNoIExv bmdtYW4sIG15IHBhdGNoIGlzIGFzIHlvdSBzYWlkLCBvbmx5IGRpc2FibGUgCj4gbm9kZV9jcHUg b24gWDg2LCBlbmFibGUgbm9kZV9jcHUgb24gYXJtNjQsIHBvd2VycGMsIHMzOTAgYXJjaGl0ZWN0 dXJlczsKPiB0aGUgY29kZSBpcyBpbiBmaWxlIGFyY2gveDg2L2tlcm5lbC9wYXJhdmlydC1zcGlu bG9ja3MuYzoKPiDCoMKgwqAgREVDTEFSRV9TVEFUSUNfS0VZX0ZBTFNFKHByZWVtdGVkX2tleSk7 Cj4gwqDCoMKgIHN0YXRpY19icmFuY2hfZW5hYmxlKCZwcmVlbXRlZF9rZXkpOwo+Cj4gdGhlIGRl ZmF1bHQgdmFsdWUgb2YgcHJlZW10ZWRfa2V5IGlzIGZhbHNlIGFuZCB0aGUgaWYgY29uZGl0aW9u YWwgCj4gc3RhdGVtZW50IGlzIHJldmVyc2VkLAo+IHRoZSBjb2RlIGlzIGluIGZpbGUga2VybmVs L2xvY2tpbmcvb3NxX2xvY2suYzoKPiDCoMKgwqAgREVGSU5FX1NUQVRJQ19LRVlfRkFMU0UocHJl ZW10ZWRfa2V5KTsKPgo+IMKgwqDCoCBzdGF0aWMgaW5saW5lIGludCBub2RlX2Nw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