lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <09c7b69ca411e2edea6cbd10ae0c3388bee6dfce.camel@intel.com>
Date:   Wed, 5 Jul 2023 07:54:45 +0000
From:   "Huang, Kai" <kai.huang@...el.com>
To:     "peterz@...radead.org" <peterz@...radead.org>
CC:     "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "Brown, Len" <len.brown@...el.com>,
        "Raj, Ashok" <ashok.raj@...el.com>,
        "Huang, Ying" <ying.huang@...el.com>,
        "Hansen, Dave" <dave.hansen@...el.com>,
        "david@...hat.com" <david@...hat.com>,
        "bagasdotme@...il.com" <bagasdotme@...il.com>,
        "ak@...ux.intel.com" <ak@...ux.intel.com>,
        "Wysocki, Rafael J" <rafael.j.wysocki@...el.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Chatre, Reinette" <reinette.chatre@...el.com>,
        "Christopherson,, Sean" <seanjc@...gle.com>,
        "pbonzini@...hat.com" <pbonzini@...hat.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "Yamahata, Isaku" <isaku.yamahata@...el.com>,
        "nik.borisov@...e.com" <nik.borisov@...e.com>,
        "hpa@...or.com" <hpa@...or.com>, "Shahar, Sagi" <sagis@...gle.com>,
        "imammedo@...hat.com" <imammedo@...hat.com>,
        "bp@...en8.de" <bp@...en8.de>, "Luck, Tony" <tony.luck@...el.com>,
        "isaku.yamahata@...il.com" <isaku.yamahata@...il.com>,
        "Gao, Chao" <chao.gao@...el.com>,
        "sathyanarayanan.kuppuswamy@...ux.intel.com" 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>,
        "x86@...nel.org" <x86@...nel.org>,
        "Williams, Dan J" <dan.j.williams@...el.com>
Subject: Re: [PATCH v12 07/22] x86/virt/tdx: Add skeleton to enable TDX on
 demand

On Wed, 2023-07-05 at 09:16 +0200, Peter Zijlstra wrote:
> On Tue, Jul 04, 2023 at 09:50:22PM +0000, Huang, Kai wrote:
> > On Tue, 2023-07-04 at 18:58 +0200, Peter Zijlstra wrote:
> > > On Fri, Jun 30, 2023 at 02:24:56PM -0700, Sean Christopherson wrote:
> > > 
> > > > Waiting until userspace attempts to create the first TDX guest adds complexity
> > > > and limits what KVM can do to harden itself.  Currently, all feature support in
> > > > KVM is effectively frozen at module load.  E.g. most of the setup code is
> > > > contained in __init functions, many module-scoped variables are effectively 
> > > > RO after init (though they can't be marked as such until we smush kvm-intel.ko
> > > > and kvm-amd.ko into kvm.ko, which is tentatively the long-term plan).  All of
> > > > those patterns would get tossed aside if KVM waits until userspace attempts to
> > > > create the first guest.
> > > 
> > > ....
> > > 
> > > People got poked and the following was suggested:
> > > 
> > > On boot do:
> > > 
> > >  TDH.SYS.INIT
> > >  TDH.SYS.LP.INIT
> > >  TDH.SYS.CONFIG
> > >  TDH.SYS.KEY.CONFIG
> > > 
> > > This should get TDX mostly sorted, but doesn't consume much resources.
> > > Then later, when starting the first TDX guest, do the whole
> > > 
> > >  TDH.TDMR.INIT
> > > 
> > > dance to set up the PAMT array -- which is what gobbles up memory. From
> > > what I understand the TDH.TDMR.INIT thing is not one of those
> > > excessively long calls.
> > 
> > The TDH.TDMR.INIT itself has it's own latency requirement implemented in the TDX
> > module, thus it only initializes a small chunk  (1M I guess) in each call. 
> > Therefore we need a loop to do bunch of TDH.TDMR.INIT in order to initialize all
> > PAMT entries for all TDX-usable memory, which can be time-consuming.
> 
> Yeah, so you can put a cond_resched() in that loop and all is well, you
> do not negatively affect other tasks. Because *that* was the concern
> raised.

Yes cond_resched() has been done.  It's in patch 16 (x86/virt/tdx: Initialize
all TDMRs).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ