Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2087447imm; Thu, 19 Jul 2018 13:00:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeBx6hoSfy2Ne3+9iOoACgfzwXla4CvcVLxwhv62ygCsF8tCiIOtwiH0CZZyp5kKTCCO7kL X-Received: by 2002:a17:902:6802:: with SMTP id h2-v6mr11246496plk.113.1532030411498; Thu, 19 Jul 2018 13:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532030411; cv=none; d=google.com; s=arc-20160816; b=IQgsQM6ZFWimhPXXgzSTYGU0Ay/Be9/5imUsw/v8b3jvWTVnBjwPZw9e7Ij1BQQpsR 5cstMrfP16aUnuD96oGAd4rsGDldJRZgfyinshBj2IRNsPfYbPEGy4w19+Ci8XQdPD7r mab5vNYh3G1IiBaaa15+E4uh1tVzVlR2Nq68dKNJ2eZExVNTRuI5GkZjA7Z8AS/J21w8 JfuPK3ZPnX1vP9FcwQ0cN/qZUU5nqbzM56kpV7ZiDG7LcXmH4YeLiJI80lHrHNPvKUc3 KEx8zjXaKORaIJYe1/RPoleMFP8WhbmSMxbu4NClJDFGvj2/2eUc+itF32hWGgH4ljYQ mf9Q== 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 :arc-authentication-results; bh=ppSmgmEKy/WTJRjizY3QzrfcEULLX52tf0spG0TWikE=; b=dygZZfx/P/e0wJ+32QGf+UPuek48xfGItqBVpMgCiPEwSd+FZfAGlNmt1xIcmP82ib XBF4sSHFYc0eO+gCrf6b55DD71x73xmAgTUrOeJX5rRdKNG1q81sDWSqGZbql+mx1tox mI5W9VxaapLoAOXM1onYPzKX87o8ZWbIZisD4isQukHLdMIXoPLS7J8Zu8bYuE4G9bwW Sd/CYdQMGSnTAIx4zwriy31vTPklFhKcDzulwVaV/UuFZLxMKWrv5rbKLsihbZMUbM31 0lX3gTVJV6LNLAOMbtvWHO7XI0zqflvVhSCivBKxtjrxKJvEcNRKggHV4iJGO6wSJiFS CEmA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n68-v6si751pga.662.2018.07.19.12.59.56; Thu, 19 Jul 2018 13:00:11 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727743AbeGSUnx (ORCPT + 99 others); Thu, 19 Jul 2018 16:43:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57216 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727449AbeGSUnx (ORCPT ); Thu, 19 Jul 2018 16:43:53 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D06E0CE1D6; Thu, 19 Jul 2018 19:59:13 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-175.bos.redhat.com [10.18.17.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C842111AF1D; Thu, 19 Jul 2018 19:59:12 +0000 (UTC) Subject: Re: [PATCH] xen/spinlock: Don't use pvqspinlock if only 1 vCPU To: Boris Ostrovsky , Juergen Gross , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Cc: x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Konrad Rzeszutek Wilk References: <1532008100-26922-1-git-send-email-longman@redhat.com> <22f2465a-128e-730f-bc51-5a55ef16a039@oracle.com> From: Waiman Long Organization: Red Hat Message-ID: Date: Thu, 19 Jul 2018 15:59:12 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <22f2465a-128e-730f-bc51-5a55ef16a039@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 19 Jul 2018 19:59:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 19 Jul 2018 19:59:13 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'longman@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/19/2018 03:18 PM, Boris Ostrovsky wrote: > On 07/19/2018 09:48 AM, Waiman Long wrote: >> On a VM with only 1 vCPU, the locking fast paths will always be >> successful. In this case, there is no need to use the the PV qspinlock >> code which has higher overhead on the unlock side than the native >> qspinlock code. >> >> Signed-off-by: Waiman Long >> --- >> arch/x86/xen/spinlock.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c >> index cd97a62..38f47ae 100644 >> --- a/arch/x86/xen/spinlock.c >> +++ b/arch/x86/xen/spinlock.c >> @@ -130,7 +130,8 @@ void xen_uninit_lock_cpu(int cpu) >> void __init xen_init_spinlocks(void) >> { >> >> - if (!xen_pvspin) { >> + /* Don't need to use pvqspinlock code if there is only 1 vCPU. */ >> + if (!xen_pvspin || num_possible_cpus() == 1) { >> printk(KERN_DEBUG "xen: PV spinlocks disabled\n"); >> return; >> } > > I think we need to set xen_pvspin to false for such configurations. > Notice that xen_init_lock_cpu() will try to perform some additional > pvspinlock initializations. > > > -boris The other pvqspinlock initialization has no runtime impact other than allocating a bit of extra memory. Anyway, I will revise the patch to disable xen_pvspin under such condition. -Longman