Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3765891imm; Mon, 17 Sep 2018 02:53:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYskeRk3jE5gVyracUbSQYJq3gBOpaWT0vYyFSTPyiiBxoBFw/UhB0J65Kp1zU5Tp3z9WXO X-Received: by 2002:a62:8559:: with SMTP id u86-v6mr25229726pfd.32.1537177987581; Mon, 17 Sep 2018 02:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537177987; cv=none; d=google.com; s=arc-20160816; b=aRBtx7mCopxz7q0H1KsnsfDA1HpsD0k1PvwY7y9ld6eOqYeFqP7Hu6qD+Vw9QvQsIi I+fUYc9N1PVBgomRzbAm2EnsHdz80l8dS4eRINkCsltHpJh0STNxYs+qjqFUJaYRw04r sxISjaeSfqeSRUsMDdee9mnDxoG3n3gLKkxtK1gswOpNdkIeGJLDHjuIb/f/SbIl2P1G 5Pnfe1n45uDWms3E75Ps156vo/QlLtj2H2WXK2POQiXxSFiIeHhSwaHiZer5Zl63qRyk NljpRLrzG9N4pZVuHzZ/A4RYfldea7TjWUsjGkjF5Oo68zuPr1Wz9MpeV7iU1q3uo7XP 2kdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dkim-signature; bh=gI5xpfu/M4Z3NU3FfOGhaGnYOeIRNAeRd1+IUFhLM5I=; b=Sdg81RKiy1Vqr0iwgH1rD9ErbVkplZOz0id5dO4awGjpOJQIy4q7lrFi2nL0kTlFY7 6ALljpIRWtmxbKboY9RjdkRaQzYhpAXeKlId37ACIfdXmcHzxvNYTlRTD1UbK+WPbfb+ av4/SRkL6DeoT9oKHl1gpF9ckOgYYb47hStwMlB5ts9ZnyyszXn1dMxjhpcT1PYFDNDI XOvyJRPU4BN3t6txzUNTFIfvf+0Ay8vT9HOTM8+eC6bBPL29LS9V11pvB1yL4CCwXEjf 6DmyviK/4h/4kYKjnRDiJRxtRpxRFxiV+g+JzIaT+OV6+pgYuJFxzeAHeRh7PbsqmMZL w9sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=iaUB5np2; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p19-v6si15193624pgm.109.2018.09.17.02.52.51; Mon, 17 Sep 2018 02:53:07 -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; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=iaUB5np2; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728321AbeIQPS3 (ORCPT + 99 others); Mon, 17 Sep 2018 11:18:29 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:12550 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeIQPS3 (ORCPT ); Mon, 17 Sep 2018 11:18:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1537177910; x=1568713910; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=gI5xpfu/M4Z3NU3FfOGhaGnYOeIRNAeRd1+IUFhLM5I=; b=iaUB5np2hbr0VgqspxwsmohTbI2mw6tMQ8fv7uHQDwpWIsCa20cEsY// G86+P6UR2NWgLYZPhtjpB116XzBDmrbe6OPb0Qx1VORk3Cw8apm7I0Jte Xm1rrqTuw6CkxzcRlzSxA/+8qQgNbxqcQT5/WP1zYb125nkF6LAaGqv43 o=; X-IronPort-AV: E=Sophos;i="5.53,384,1531785600"; d="scan'208";a="758625088" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2b-baacba05.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Sep 2018 09:51:47 +0000 Received: from u54ee758033e858cfa736.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2b-baacba05.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w8H9pg4e130822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 17 Sep 2018 09:51:43 GMT Received: from u54ee758033e858cfa736.ant.amazon.com (localhost [127.0.0.1]) by u54ee758033e858cfa736.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w8H9pegM022715; Mon, 17 Sep 2018 11:51:41 +0200 Received: (from jsteckli@localhost) by u54ee758033e858cfa736.ant.amazon.com (8.15.2/8.15.2/Submit) id w8H9pcxD022714; Mon, 17 Sep 2018 11:51:38 +0200 X-Authentication-Warning: u54ee758033e858cfa736.ant.amazon.com: jsteckli set sender to jsteckli@amazon.de using -f From: Julian Stecklina To: Khalid Aziz Cc: Linus Torvalds , David Woodhouse , Konrad Rzeszutek Wilk , juerg.haefliger@hpe.com, deepa.srinivasan@oracle.com, Jim Mattson , Andrew Cooper , Linux Kernel Mailing List , Boris Ostrovsky , linux-mm , Thomas Gleixner , joao.m.martins@oracle.com, pradeep.vincent@oracle.com, Andi Kleen , kanth.ghatraju@oracle.com, Liran Alon , Kees Cook , Kernel Hardening , chris.hyser@oracle.com, Tyler Hicks , John Haxby , Jon Masters Subject: Re: Redoing eXclusive Page Frame Ownership (XPFO) with isolated CPUs in mind (for KVM to isolate its guests per CPU) References: <5efc291c-b0ed-577e-02d1-285d080c293d@oracle.com> Date: Mon, 17 Sep 2018 11:51:38 +0200 In-Reply-To: <5efc291c-b0ed-577e-02d1-285d080c293d@oracle.com> (Khalid Aziz's message of "Fri, 14 Sep 2018 11:06:53 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Khalid Aziz writes: > I ran tests with your updated code and gathered lock statistics. Change in > system time for "make -j60" was in the noise margin (It actually went up by > about 2%). There is some contention on xpfo_lock. Average wait time does not > look high compared to other locks. Max hold time looks a little long. From > /proc/lock_stat: > > &(&page->xpfo_lock)->rlock: 29698 29897 0.06 134.39 15345.58 0.51 422474670 960222532 0.05 30362.05 195807002.62 0.20 > > Nevertheless even a smaller average wait time can add up. Thanks for doing this! I've spent some time optimizing spinlock usage in the code. See the two last commits in my xpfo-master branch[1]. The optimization in xpfo_kunmap is pretty safe. The last commit that optimizes locking in xpfo_kmap is tricky, though, and I'm not sure this is the right approach. FWIW, I've modeled this locking strategy in Spin and it doesn't find any problems with it. I've tested the result on a box with 72 hardware threads and I didn't see a meaningful difference in kernel compile performance. It's still hovering around 2%. So the question is, whether it's actually useful to do these optimizations. Khalid, you mentioned 5% overhead. Can you give the new code a spin and see whether anything changes? Julian [1] http://git.infradead.org/users/jsteckli/linux-xpfo.git/shortlog/refs/heads/xpfo-master -- Amazon Development Center Germany GmbH Berlin - Dresden - Aachen main office: Krausenstr. 38, 10117 Berlin Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger Ust-ID: DE289237879 Eingetragen am Amtsgericht Charlottenburg HRB 149173 B