From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1173C31E5E for ; Mon, 17 Jun 2019 18:50:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83020208E4 for ; Mon, 17 Jun 2019 18:50:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zfpt3uun" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727964AbfFQSui (ORCPT ); Mon, 17 Jun 2019 14:50:38 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:41784 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfFQSuh (ORCPT ); Mon, 17 Jun 2019 14:50:37 -0400 Received: by mail-pl1-f196.google.com with SMTP id m7so879648pls.8; Mon, 17 Jun 2019 11:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YT9HuF+UAL5f5ci7H4JzJ/S6XavqO8+S9ops45crT04=; b=Zfpt3uunBLYcSG089usKV8UfK0qMkW9RgZ/ht+cK7fx45yQdRXzuM4k6DPI6zvCSfi 0b3jkIINqBOHb/zU/1f0XcGlK9C4FAg1iZvHzrqz40G30DXvdJOSbiC4XdmQGerLkQoR aT5EgFrx3EcOeDl7CDlpQ/A7/rYmh9HJ3rnFe7W2D9/WpSraIO3SQSjJc5BPwRcg+dHw SPuWuixjDd2kTd8bJJKGjPMpHwnDksjI2b6kT33SjyErxJAJ+adv5BIpRJz1FUgmsg31 WMNCDArPFaqyMrcsw7wSYB32SF083r7pR7XN3BQJ2niCYfBu5lNlOnPi4o+qmzNvSq00 xS6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YT9HuF+UAL5f5ci7H4JzJ/S6XavqO8+S9ops45crT04=; b=UCSgS4deqGLCX+CSokBFkOSjx9KcNevDlb5p2/llRSeV1MpdubiliUxSpp8WMYQDXk d8yD7QqsjpZnqEcjXUqWK5c6lvnjNmTf0QYZX4gYzPUivvN/2GAakSWwWSN7blbORHF2 HZCECwKA1x7G8VizXXXv6mUUQNX1QIvNi5Nitf+cYfDX/ExNnuyelrv3jCbwS1DSGJcE DrDE18LDdglKCE0tmD7jmbdl8LtT6O3pWl9Z329QSLK9uuZMbW2hcozVushzcmueLpSi 1NJeU8ehfLMCFWAalMedjt+AXsfuEPtSnCTXSYC1wGvmDxKsRFuM/GaXaxM0KLCDOoga h7XA== X-Gm-Message-State: APjAAAWQLRTdHCIlPL/rbOPtyzfjQvXKQqUhpDFRgwtlgGgt11IuW/yJ 71730fD6F54fZNWUDV1olL/+XSqJ X-Google-Smtp-Source: APXvYqx5UAroLnXpaBq2i2aaY3z6bqvsMT+mzSSAf5PPJfwRApihHPP0h7obDCWJIslPN6lv94WgXg== X-Received: by 2002:a17:902:2862:: with SMTP id e89mr110159490plb.258.1560797436896; Mon, 17 Jun 2019 11:50:36 -0700 (PDT) Received: from [10.33.114.148] ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id x25sm12686727pfm.48.2019.06.17.11.50.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 11:50:36 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [RFC 00/10] Process-local memory allocations for hiding KVM secrets From: Nadav Amit In-Reply-To: Date: Mon, 17 Jun 2019 11:50:34 -0700 Cc: Andy Lutomirski , Alexander Graf , Thomas Gleixner , Marius Hillenbrand , kvm list , LKML , Kernel Hardening , Linux-MM , Alexander Graf , David Woodhouse , the arch/x86 maintainers , Peter Zijlstra Content-Transfer-Encoding: quoted-printable Message-Id: <3131CDA2-F6CF-43AC-A9FC-448DC6983596@gmail.com> References: <20190612170834.14855-1-mhillenb@amazon.de> <58788f05-04c3-e71c-12c3-0123be55012c@amazon.com> <63b1b249-6bc7-ffd9-99db-d36dd3f1a962@intel.com> <698ca264-123d-46ae-c165-ed62ea149896@intel.com> <5AA8BF10-8987-4FCB-870C-667A5228D97B@gmail.com> To: Dave Hansen X-Mailer: Apple Mail (2.3445.104.11) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org > On Jun 17, 2019, at 11:07 AM, Dave Hansen = wrote: >=20 > On 6/17/19 9:53 AM, Nadav Amit wrote: >>>> For anyone following along at home, I'm going to go off into crazy >>>> per-cpu-pgds speculation mode now... Feel free to stop reading = now. :) >>>>=20 >>>> But, I was thinking we could get away with not doing this on = _every_ >>>> context switch at least. For instance, couldn't 'struct = tlb_context' >>>> have PGD pointer (or two with PTI) in addition to the TLB info? = That >>>> way we only do the copying when we change the context. Or does = that tie >>>> the implementation up too much with PCIDs? >>> Hmm, that seems entirely reasonable. I think the nasty bit would be >>> figuring out all the interactions with PV TLB flushing. PV TLB >>> flushes already don't play so well with PCID tracking, and this will >>> make it worse. We probably need to rewrite all that code = regardless. >> How is PCID (as you implemented) related to TLB flushing of kernel = (not >> user) PTEs? These kernel PTEs would be global, so they would be = invalidated >> from all the address-spaces using INVLPG, I presume. No? >=20 > The idea is that you have a per-cpu address space. Certain kernel > virtual addresses would map to different physical address based on = where > you are running. Each of the physical addresses would be "owned" by a > single CPU and would, by convention, never use a PGD that mapped an > address unless that CPU that "owned" it. >=20 > In that case, you never really invalidate those addresses. I understand, but as I see it, this is not related directly to PCIDs.