Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp655319imm; Fri, 31 Aug 2018 09:40:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYgmgA0h3wd1oCIHKEUghE5esvpJBjD0n0QPXz3CevVKVYLOqx/XZpZUPVGJTHP5PDQOAUE X-Received: by 2002:a63:c20:: with SMTP id b32-v6mr2040480pgl.400.1535733655706; Fri, 31 Aug 2018 09:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535733655; cv=none; d=google.com; s=arc-20160816; b=D0eI6dROD3+I0uUG20GfhutUWu9eoOniYPUfUo8jqhEatz/qQcn+Dg2nw9Ly4kx/aE hr0Jwr5XGbiW7VrfvtLb790RqS9YhKQrOj3nqrBVhRoOrIr7EV+oDC4XlxokvEmy3FaX Bvvx9nQlDYhGJJ37Ctjzc5HsJJYvaNtU7+OQKI/mh3kkm90v1/DMPSh54wYFGE3LrahU hFsChKdiaEDu5UVhlvtm94zJCoKO+E6SdsoCBOuHei1G3jU2/QcYPLcDLO4WwW34K/rD j+ai7QbfpRtxP7D+Op2SHcFOa3k2qAmDz/YFHALKiMevmiodnP7NjPV3g5Fr+uYgtQ2R nR/w== 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:arc-authentication-results; bh=oa1MYnvIVs5eN0iARHFkVOWqEL0gw+jh924JQVDEW4k=; b=XiQ23KT/urbfe8BUswiUVWO3C+/u8O0ySvO3vYVHoRTUH18LVCP/qYjHr7P1hferIG LO+q5qAe4tXrp2pmV/8Rgl8KDkeX4qmEEg/I0X2b1qbJdcx/WLfziXbT+QDHkerkqjH/ GM6JbQuqgS8o9p2/jJVM+4sIprfhbTmamR8xNdbkS9rfnjaS6ePmk5PKiGer6c6OKDai 3cVjDoLQaZ9Tow+P1Z2aWbuIe8ZSxYq62AC8wGM5Mw46t1ua447Tv1orNejQsvTiCPUJ /2WUevFUNH4496/MyF9HBUqz0yJPaYf1VFfKcKuh90lpuxElwj/LkZ1ORVGEaP5ksztZ D4Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=lWNFfQOp; 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 l26-v6si10188619pfj.188.2018.08.31.09.40.41; Fri, 31 Aug 2018 09:40:55 -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=lWNFfQOp; 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 S1729018AbeHaTeu (ORCPT + 99 others); Fri, 31 Aug 2018 15:34:50 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:46450 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727303AbeHaTeu (ORCPT ); Fri, 31 Aug 2018 15:34:50 -0400 Received: by mail-pl1-f195.google.com with SMTP id a4-v6so5611161plm.13 for ; Fri, 31 Aug 2018 08:26:50 -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=oa1MYnvIVs5eN0iARHFkVOWqEL0gw+jh924JQVDEW4k=; b=lWNFfQOpsVNBLLjXGY6QyabHPi9r3F4Jf/sg27TSHSuWi/m3cnIHeI+AL00iLyoI7D PYwHkslQrBTTk6Cndw/RbIhXhCV87gWJgvFzNjKMOKKydE7pyATSw91sCAXVcYKOmXnq 2hUJZrcAfMY8VV3JzY9BKMXEuVTjqmXcx5GblK7jm1ZiAwC8oCH2Nb6sF1f6p1uMyq6r NceHK6rBy9O4d5BVXOR2vURMh9Gxs36hCrPi41r7Dr9iVhcQ2ulxVL/TDOxUIqMjSa14 mhyy3dYv7Ec5xuNr3D9qyamsShVOar9COslggB2C2NFhsh8TKRofjT6kJ5/By8xan2AH HKJw== 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=oa1MYnvIVs5eN0iARHFkVOWqEL0gw+jh924JQVDEW4k=; b=uPXvgh7VqGwn4ZVtflTpKKk4c1tfSCdY75esrZU76JeBiUu6pCX+ddpv2S+7wcu97R sVn2UiX2Vusb7JWzVZrN1biZQDD2t/1guSU8OFYdyLmmDHeM1uHbxXXD07sIEogmVoOM nbooelnB3Mzn+l44+Ze9s4ZPqsg2PN4YLomNQ6gBcRQlh52PodQzuN2Vclim1sCQ1q35 3VYG2Ipl/tKV5e8jeW3FioTBqdD14Uys36YLr8HtCmVqGKKrn3fsJblx6hBFbtdtdSMF zEdqxSJPZMp3NyH6v91R7M2cCZJPciSmKJzia0XGAwr9SKgg/IGBErBh4lP+hU9Rt8x4 7BOg== X-Gm-Message-State: APzg51B2psXGvqrOnhC5uBkJWZRucubmfPD9WnL8Xk8MMFPxVbNunbiS 4D4xT2LRjRqsdj2HjmolJtG5Rw== X-Received: by 2002:a17:902:286a:: with SMTP id e97-v6mr16108570plb.340.1535729209826; Fri, 31 Aug 2018 08:26:49 -0700 (PDT) Received: from cisco.cisco.com ([208.181.116.45]) by smtp.gmail.com with ESMTPSA id a20-v6sm27978820pfc.14.2018.08.31.08.26.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 31 Aug 2018 08:26:48 -0700 (PDT) Date: Fri, 31 Aug 2018 09:26:47 -0600 From: Tycho Andersen To: Julian Stecklina 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 , 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: <20180831152647.GC15213@cisco.cisco.com> 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 Thu, Aug 30, 2018 at 06:00:51PM +0200, Julian Stecklina wrote: > Hey everyone, > > On Mon, 20 Aug 2018 15:27 Linus Torvalds wrote: > > On Mon, Aug 20, 2018 at 3:02 PM Woodhouse, David wrote: > >> > >> It's the *kernel* we don't want being able to access those pages, > >> because of the multitude of unfixable cache load gadgets. > > > > Ahh. > > > > I guess the proof is in the pudding. Did somebody try to forward-port > > that patch set and see what the performance is like? > > I've been spending some cycles on the XPFO patch set this week. For the > patch set as it was posted for v4.13, the performance overhead of > compiling a Linux kernel is ~40% on x86_64[1]. The overhead comes almost > completely from TLB flushing. If we can live with stale TLB entries > allowing temporary access (which I think is reasonable), we can remove > all TLB flushing (on x86). This reduces the overhead to 2-3% for > kernel compile. Cool, thanks for doing this! Do you have any thoughts about what the 2-3% is? It seems to me like if we're not doing the TLB flushes, the rest of this should be *really* cheap, even cheaper than 2-3%. Dave Hansen had suggested coalescing things on a per mapping basis vs. doing it per page, which might help? > > It used to be just 500 LOC. Was that because they took horrible > > shortcuts? > > The patch is still fairly small. As for the horrible shortcuts, I let > others comment on that. Heh, things like xpfo_temp_map() aren't awesome, but that can hopefully be fixed by keeping a little bit of memory around for use where we are mapping things and can't fail. I remember some discussion about hopefully not having to sprinkle xpfo mapping calls everywhere in the kernel, so perhaps we could get rid of it entirely? Anyway, I'm working on some other stuff for the kernel right now, but I hope (:D) that it should be close to done, and I'll have more cycles to work on this soon too. Tycho