Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3791131imm; Mon, 17 Sep 2018 03:20:32 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaVp3h6dfsMymhn8gGVmh93dMBW9idQhIpEd+fKPuo5kUJu8TeDwQLxyYSMoy8QgljmHE6u X-Received: by 2002:a63:9a02:: with SMTP id o2-v6mr20941631pge.440.1537179632472; Mon, 17 Sep 2018 03:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537179632; cv=none; d=google.com; s=arc-20160816; b=UWAkOiLaj4qkY69wJeUjATtz3tImVasbERvsg1QyTyafjzKk2y8tln0dyMQPIu0Eyi T3vR1p9Zqqv3mYow0zCBPw8UI6C+jMxTQ+9FS3Nju6ZsZpX0LSS8SB4bdBubYGVlThHw aRr491RrkYmUr3iAbOZL6sPJ/jFvRPx9y4asRyy8f4dZA9vBRr+WBuyv1TwgM4wbA12J D+72BQ1mYIx76cKSiqrYDkIqUiZv0J5gcKC5iBlQP6QO+kGLb7XUelsUpmJYJaY2hJdj 5ICRc9KFASCz6UhRLVuJpVPMiDH8gCrEsZcAoT80oQW9AzaNkGn+NKZoNpPJLCEH6YVe teEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=m7MAok2CBuFVicuzTHSXJHysUHJmU8cEVDBtH07ivqc=; b=fPbM6CU/guVxcQ6k+bDaN0OsQB+nFG01rY3KRiG12iKfRuBHoOxtDWHUH7XhTZ45pT yPloDssXpppcZ0FBdS8kDh7vakKXmbSuw4hOJXS5j74trKiBNreR7dC7mMiBRynXUUFM RNQw+tFlPy22HvPj9/ptiUQLv6ZIx9VBrT/ibkzJ+wHCqwI6V3CEAGT9yrQGiY1R/b3w zdLadqotpzBAyiFVuEmcLgm2YDdJoGgXnSyK840S74v/o92RKkKysTW5JVVRZAIgKesK 6F8w3XoPGvz3BnAjWF5CciAilnQ1YRp0TIQlePYRnd+jx9sLpe8TkLfEwal57sekcK15 y4GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=vnz0POuq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10-v6si14567242pge.674.2018.09.17.03.20.16; Mon, 17 Sep 2018 03:20:32 -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=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=vnz0POuq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727946AbeIQPqk (ORCPT + 99 others); Mon, 17 Sep 2018 11:46:40 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:41995 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726824AbeIQPqj (ORCPT ); Mon, 17 Sep 2018 11:46:39 -0400 Received: by mail-lf1-f68.google.com with SMTP id e11-v6so1488312lfc.9 for ; Mon, 17 Sep 2018 03:19:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho-ws.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=m7MAok2CBuFVicuzTHSXJHysUHJmU8cEVDBtH07ivqc=; b=vnz0POuqQKoyWTwHWOhUVPOSPqBVtV3j1B0pG3B88AkAVnUG9oaxB0u37C3rBnug9Z EEq5PDbBuzGS/CA9ypHdl0KVMQ1oHLjnKZ95BI0f5GH25AvXyXcbYcj538W2M7iVBn2r fbggTGKJTROgum8Yf6aKM15WN5eDXwE+5NS20eMTA0o4qMj5+dyP4h9UoV93YyrR0xs4 X4xIRJuFbWno09grw7Yu8RYq+nkyphaulBy7fzZGYbr90wrg4Xm4f2TRY+XVRc53kz0C jhVu8T7xK1bkEKTuyZ8aPV1WigtqFAObrEbv1mCwpeZ9hMX3mVWNXkBzVgbKsw2/HWkS L0Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=m7MAok2CBuFVicuzTHSXJHysUHJmU8cEVDBtH07ivqc=; b=LINMAIIJqoP/KLqDmLWhGKQHCtqpRIUq5KrFiM0M+qhC/0SNCR1UirQD7YvHHCnJ/0 b1hPvXWWnIJemfn8OFzB49Iq/ssJMeSWHkvS4SSps+b0nxVnhvtV4FF+0NJuSQOEj1Ql pOZ9eDEqTz2bjupv8K0zAZPpT+WbiXLiFCW1ZC+JnYa4S8aNgIGr/lt/wMfh3okXvWUb Zow1+QyRYzG8kzTgU7STTHQaXNuzcFR2KeeFHJb/WhZTyrJlumfPQeukyNQXILKN0RTc QpT2bZqTvZ66I/z1cJPCJqka3bDOBIUB4WEjmxdT3ZFyUPqlDw2pLwOTZQ3ES+WMgC/0 nf0Q== X-Gm-Message-State: APzg51CIeAjMr4NvRvOSwIdX61eqz6/bVxRtQaZ+6cK/mO06KdRZUGwG VFgRatF7SLEl+KhpLXlHF5V/Yg7ncLYONiUB X-Received: by 2002:a19:8d45:: with SMTP id p66-v6mr15220411lfd.44.1537179593681; Mon, 17 Sep 2018 03:19:53 -0700 (PDT) Received: from cisco (penitent.factor.volia.net. [93.74.255.199]) by smtp.gmail.com with ESMTPSA id u191-v6sm2799404lja.13.2018.09.17.03.19.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Sep 2018 03:19:52 -0700 (PDT) Date: Mon, 17 Sep 2018 04:19:50 -0600 From: Tycho Andersen To: Julian Stecklina Cc: Juerg Haefliger , Linus Torvalds , David Woodhouse , Konrad Rzeszutek Wilk , 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 , Khalid Aziz , 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) Message-ID: <20180917101950.GG4672@cisco> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 17, 2018 at 12:01:02PM +0200, Julian Stecklina wrote: > Juerg Haefliger writes: > > >> I've updated my XPFO branch[1] to make some of the debugging optional > >> and also integrated the XPFO bookkeeping with struct page, instead of > >> requiring CONFIG_PAGE_EXTENSION, which removes some checks in the hot > >> path. > > > > FWIW, that was my original design but there was some resistance to > > adding more to the page struct and page extension was suggested > > instead. > > From looking at both versions, I have to say that having the metadata in > struct page makes the code easier to understand and removes some special > cases and bookkeeping. > > > I'm wondering how much performance we're loosing by having to split > > hugepages. Any chance this can be quantified somehow? Maybe we can > > have a pool of some sorts reserved for userpages and group allocations > > so that we can track the XPFO state at the hugepage level instead of > > at the 4k level to prevent/reduce page splitting. Not sure if that > > causes issues or has any unwanted side effects though... > > Optimizing the allocation/deallocation path might be worthwhile, because > that's where most of the overhead goes. I haven't looked into how to do > this yet. I'd appreciate if someone has pointers to code that tries to > achieve similar functionality to get me started. > > That being said, I'm wondering whether we have unrealistic expectations > about the overhead here and whether it's worth turning this patch into > something far more complicated. Opinions? I think that implementing Dave Hansen's suggestions of not doing flushes/other work on every map/unmap, but only when pages are added to the various free lists will probably help out a lot. That's where I got stuck last time when I was trying to do it, though :) Cheers, Tycho