Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp583944pxk; Wed, 23 Sep 2020 10:30:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9UWdfaF+4eu9tegH9ltviC+Qe9O5EB06GGoNFPVgUyjbHADZVU2W9lwupuYADA4GdhqWY X-Received: by 2002:a17:906:f92:: with SMTP id q18mr690926ejj.237.1600882249570; Wed, 23 Sep 2020 10:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600882249; cv=none; d=google.com; s=arc-20160816; b=E70WGHS3k8Mpqe1ogQ7YfN3n/2xTraanfsZ+lh/GjbOGuDcGmJ/U1JU4B8Mx8HIvxC m3vLyhKjt5XPvvcNaluks3JcDYAJk0bAZ7osbw8ooLm8UfRaSMfrqImwr3voGSBCksUM 1q1D+YmtMPREm2o0tTGbcV1s9YxI0V5Qh3gV9ptP6N8gVnII9er9xdi72Ucv36/E5O7V pmPcEsAnwAgTcpKrhhkGVmbJcqu5vwRXXBoEnq3ia8GBGQxdk+XVVDs9fN+C4+y7fnCA QxaXV0JPiEC74gjrTO/rfSQW/c2B3W7xCmLkexm94aaUHN65I5Z1OQ4Pg4+d23nmKIG8 UJxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=lhUR6zW6953en6nRgeJ1SY/pn97z4Zxr4SK2tuL3c+c=; b=ERMNTGzJaBkZ9XE0Wo0xwhJx4DPJ/Q+6izjzP8FYMiR1apfmQB5WMnKybYEhGK7Cnc JGiZjR7YbZsOYV1/HbgQC9S5GHEUeqCpI4fQkKYDsCuQCduw0wyAv+zg71UXfPgowdYE FibokHbkOYjrzqAIj3cdoLJJAK/2a1TvAGqcyGbjh+LzErkowfg66a1solCi1O3GD8wX BSveQvddheUh3LNVAfSZdCMyr0kf4PDmjnI8YxdIETGxL+z6mhUK0LmgTkpw1QknavQk 8wqdwqn2BLCyZ6tJrY1v0vcpuOGDtLoEN4rCEkRyIa2gaZACVre1bd7NzWd2PZihO3Hd H1wQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p10si370363edh.108.2020.09.23.10.30.25; Wed, 23 Sep 2020 10:30:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbgIWR0s (ORCPT + 99 others); Wed, 23 Sep 2020 13:26:48 -0400 Received: from mga14.intel.com ([192.55.52.115]:2454 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726413AbgIWR0s (ORCPT ); Wed, 23 Sep 2020 13:26:48 -0400 IronPort-SDR: VH9o6JVYXgLsEneQCkF8j1STLfjAz9xDIjfwFHV4QbB/pm9erjKyXWO5lQG6Wvisqfb6pt0DoC 8GfkS8qieCNw== X-IronPort-AV: E=McAfee;i="6000,8403,9753"; a="160251105" X-IronPort-AV: E=Sophos;i="5.77,293,1596524400"; d="scan'208";a="160251105" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2020 10:26:47 -0700 IronPort-SDR: ey9SEz/jSNaz0OtMzWULGxth9YBvWEynGLnavUxHtQq2r16MsoeDfOaVHdAf9zM8fjL9NTqBRV uvqiUNKNCA6g== X-IronPort-AV: E=Sophos;i="5.77,293,1596524400"; d="scan'208";a="486522044" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.160]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2020 10:26:47 -0700 Date: Wed, 23 Sep 2020 10:26:46 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Cfir Cohen , "kvm @ vger . kernel . org" , Lendacky Thomas , Singh Brijesh , Grimm Jon , David Rientjes , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: SVM: Mark SEV launch secret pages as dirty. Message-ID: <20200923172646.GB32044@linux.intel.com> References: <20200807012303.3769170-1-cfir@google.com> <20200919045505.GC21189@sjchrist-ice> <5ac77c46-88b4-df45-4f02-72adfb096262@redhat.com> <20200923170444.GA20076@linux.intel.com> <548b7b73-7a13-8267-414e-2b9e1569c7f7@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <548b7b73-7a13-8267-414e-2b9e1569c7f7@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 07:16:08PM +0200, Paolo Bonzini wrote: > On 23/09/20 19:04, Sean Christopherson wrote: > >> Two of the three instances are a bit different though. What about this > >> which at least shortens the comment to 2 fewer lines: > > Any objection to changing those to "Flush (on non-coherent CPUs)"? I agree > > it would be helpful to call out the details, especially for DBG_*, but I > > don't like that it reads as if the flush is unconditional. > > Hmm... It's already fairly long lines so that would wrap to 3 lines, and Dang, I was hoping it would squeeze into 2. > the reference to the conditional flush wasn't there before either. Well, the flush wasn't conditional before (ignoring the NULL check). > sev_clflush_pages could be a better place to mention that (or perhaps > it's self-explanatory). I agree, but with /* * Flush before LAUNCH_UPDATE encrypts pages in place, in case the cache * contains the data that was written unencrypted. */ sev_clflush_pages(inpages, npages); there's nothing in the comment or code that even suggests sev_clflush_pages() is conditional, i.e. no reason for the reader to peek at the implemenation. What about: /* * Flush (on non-coherent CPUs) before LAUNCH_UPDATE encrypts pages in * place, the cache may contain data that was written unencrypted. */