Received: by 10.223.164.202 with SMTP id h10csp959190wrb; Sun, 26 Nov 2017 16:44:56 -0800 (PST) X-Google-Smtp-Source: AGs4zMbja9RXaqCyFAdTu+KAw/7cVRYA5sUdOUW9JInmveobHXiJi+9ByqeXwOBCwYiS5KChlvLp X-Received: by 10.98.14.15 with SMTP id w15mr15589014pfi.222.1511743496392; Sun, 26 Nov 2017 16:44:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511743496; cv=none; d=google.com; s=arc-20160816; b=McpFFuuLyEPVHih3GcoC8gD9eW+PDNC8VRwdgZ+hAXdBgh9CrapxxO38M84gMTqC2d mDt3npTLxSapqxPpp5xyAZ4n/eWq4/Z15HkWUz46KjPWZ8s/Xf+dzmu5U3+Y9mGg+0yF eiV7o80RHzXe16H3leZPAPYab30uAHvpA/ip9EYuZWtU9C8eVUEL5Iuz13C2uZTo7A6c 4i11wZn1ud7vwFtnAM5QyZJgBYE0u4gDCNN8k9CKgV2LfHcLeIDGHsJ2391aXuLtlikD aiRSQYmazz1JCTAMTbLngDCBt6T8XFupTIaqLfo6DyHli9g4B8qITCV1zyySVGya3NAC FTJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=vq3RIgSPPQbCWkHfViPhNjshPYw0IteGtMGRjqUA5Zs=; b=dQ7eOcg59avodnFq/00x97pWIH/hpggHpOKLFUVwklNFlik9af1UDBDShheDJl7RmW T9hBWYaeEQ7t2OT3vN6AwMbqmu2hr/Cg+P1LK0YjvH4360XDOxbn0J1+m4Lbr0DfIBui /8KOZQNI91qzI+4OnfpvdUBCtNSSY409KIK0FBOsZK6fGJOHvKBocuk3tjZRuKPAlxAR bVBKZmTl5+u+Wd3pJUZmlqKhVyZhwpj93Zz4w6ANuyf4vfqLzQ/KKE7WKmnnBFZ0P5Om FC/+Gx4xpJcryk3c6xvISdO8s0cQ+EbkSrAuU2pxgKE/F7n0ImF1JBrur7MBvX0xOSFc TUqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MrYEZ4H5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g71si24298063pfd.400.2017.11.26.16.44.33; Sun, 26 Nov 2017 16:44:56 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=MrYEZ4H5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752283AbdK0Anm (ORCPT + 78 others); Sun, 26 Nov 2017 19:43:42 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:42083 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752114AbdK0Ank (ORCPT ); Sun, 26 Nov 2017 19:43:40 -0500 Received: by mail-ot0-f195.google.com with SMTP id 18so22846652oty.9; Sun, 26 Nov 2017 16:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vq3RIgSPPQbCWkHfViPhNjshPYw0IteGtMGRjqUA5Zs=; b=MrYEZ4H5arR8ZSD+w0Z2Njc4ejPmR0+FT1SQZy1ZW/se4Cp+10CVHfPe2KZmmh0U8F mBIErnrBgCh7Unw+1w+M6DM8dxs2OPeTcf3ZnvGQcFdN8vAlp80Dr5ZIfVt7h6VK1xf4 Umwl1mJE7S1xeaps0Zi0qcO0hGqx24wGjqHC8fvMv1M+EEnXjEouugDkbefTL1GzU7Rr 0erfFNZ0/MLOzVzj2HNWKArhA2dTkPMYQZgpkPDFDtbU7Cff9/cn0ewQmOwM5PPFs4ju S/qoeYxEiyr+2a7ceUGAlC77o5ZKLMga5Bb4E1JHna+9QVYioU/B0+cNPDetdgV9FZce isGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vq3RIgSPPQbCWkHfViPhNjshPYw0IteGtMGRjqUA5Zs=; b=UnXBSCRMjmG688V21yuKWrz1rtooHQMTVW6MoqvDKwD+gp3Ac5yHdECGtuV+X8BCnn 70Caq+VnxhOtg7iQKfQbr3ciQy6DWDbzCXBXQ/yK10H4IA5ZThvgeSW8vidR++1p7MWN ic+mjql3Rd4o5kRPI4ZhaFgVquzYW3cXM7pd8SebOlGPr7WJBuiCx1UINRlLVKLiQWcu VSRwMm6RndsLIK/T/QF3Yi3/hbvE+bN6uBpqPpz9FvVWt9tgVH488aBeAFzq2WjhKpeK Jhj9EF17Ecab4ru1ykn1Xmqwnon3kEBEjp80SAMRlIMD3+IDSZZxwDiGgAo8hrPq0LV2 Z2rg== X-Gm-Message-State: AJaThX7orU1Aq8ZlzmMVhb9CLgnic8GMTj9v9Zx1OFbYveXSPQu7ddhV NWbi0co1MGIY3WL9+4rqa/f3uLu3/9Phpnpwooc= X-Received: by 10.157.72.131 with SMTP id d3mr24203677otf.137.1511743419770; Sun, 26 Nov 2017 16:43:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.209.8 with HTTP; Sun, 26 Nov 2017 16:43:39 -0800 (PST) In-Reply-To: <20171116045407.GF14563@u40b0340c692b58f6553c.ant.amazon.com> References: <1509999980-10828-1-git-send-email-eduval@amazon.com> <20171108173651.GA3664@flask> <20171109085547.GA5107@u40b0340c692b58f6553c.ant.amazon.com> <20171109141732.GA20859@flask> <20171116045407.GF14563@u40b0340c692b58f6553c.ant.amazon.com> From: Wanpeng Li Date: Mon, 27 Nov 2017 08:43:39 +0800 Message-ID: Subject: Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set To: Eduardo Valentin Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Paolo Bonzini , Matt Wilson , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "the arch/x86 maintainers" , Peter Zijlstra , Waiman Long , kvm , linux-doc@vger.kernel.org, "linux-kernel@vger.kernel.org" , "Jan H . Schoenherr" , Anthony Liguori Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eduardo, 2017-11-16 12:54 GMT+08:00 Eduardo Valentin : > Hey Radim, > > On Thu, Nov 09, 2017 at 03:17:33PM +0100, Radim Kr=C4=8Dm=C3=A1=C5=99 wro= te: > > > >> >> This is what I'm doubting, because the patch is adding about two >> thousand cycles to every spinlock-taken path. >> Doesn't this patch yield better results? >> >> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c >> index 3df743b60c80..d9225e48c11a 100644 >> --- a/arch/x86/kernel/kvm.c >> +++ b/arch/x86/kernel/kvm.c >> @@ -676,6 +676,12 @@ void __init kvm_spinlock_init(void) >> { >> if (!kvm_para_available()) >> return; >> + >> + if (kvm_para_has_feature(KVM_FEATURE_PV_DEDICATED)) { >> + static_branch_disable(&virt_spin_lock_key); >> + return; >> + } >> + > > Yes, the above suggestion is a much better approach. The code has probabl= y changed from the time I wrote the first version. I will refresh with the = above suggestion. Do you mind to send a new version since the merge window is closed? Regards, Wanpeng Li > > >> /* Does host kernel support KVM_FEATURE_PV_UNHALT? */ >> if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT)) >> return; >> >> > However, = the key aspect >> > here is this patch gives a way for the host to instruct the guest to u= se qspinlock. >> > Even with Longman's patch which allows guest to select the spinlock im= plementation, >> > there should still be the auto-select mode. In such mode, PV_DEDICATED= should >> > allow the host to get the guest to use qspinlock, without, the guest w= ill fallback >> > to tas when PV_UNHALT =3D=3D 0. >> >> I agree that a flag can be useful for certains setups. > > Cool! > >> > > -- > All the best, > Eduardo Valentin From 1584205308566971919@xxx Thu Nov 16 07:05:14 +0000 2017 X-GM-THRID: 1583352031107436177 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread