Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2294460lqo; Mon, 13 May 2024 13:51:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwFywlX6gedJa3S7/cAHgzfZ+1Gg/P1sLfjdViuVD//Tqa9QTX8F7Ujjn98giGyi5yJw2oQrr5rGUYcWmuCSGFlcyPxG9rCYtRXitdjw== X-Google-Smtp-Source: AGHT+IFppFjqPQ0Epj5b4NodJ5lOYrPVN4YF+elUD9WMzpbC7zOidaT1xktr15OPhLB5wzIV1rKM X-Received: by 2002:a05:6870:e614:b0:244:c6d6:2bcb with SMTP id 586e51a60fabf-244c6d639d1mr6959591fac.46.1715633504669; Mon, 13 May 2024 13:51:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715633504; cv=pass; d=google.com; s=arc-20160816; b=jYvHhc+bgcazZMm845kesoPpf8LR4SL6aFhV3x5mP5Fag0G3oVM/bF6CGNo1Hb3j2a dQVtvl0Y20L/+MyI8v47Jwgjw6oYpJU6/ilaTJEiH4qFJnaJPNOjgZp2a9BZoHww/LVs dLjA3ay7TiMQlKvj755UsO4zyEL409gPWTaASI+9SI0Sp4JLeD4WGYjKHyvwO+k94fth vbeUpYpI9c8d3oLrfTrrb/IqdyyNO5x9qNZodZtdtM7aBedmnVmDTXsY9hz07rnbzvWP JJK369Tj0si1w4L3scNgD4kJbdOn9xu4d3sABuxUirDw25qaYB+i55vPnvhpAfbdGxQX JLfg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ohg7QBR5YMba9ZVB+DO4D5OJkiJ6POMUfI81iI6T5gM=; fh=v2M7gzBYJN/8kNwFplkziralj8TMgoUTAsXDnwySf6k=; b=GCqBpQNwAc0FXT+/mhogDcvAyThCdEYPO8QXPBH0LMTei/dxwYXghkO/mmO8hYi9P7 IAynAK/3/ChwMVdw/AbYK727sbO66q6adzs4/V7iB06N+7ggBdC1OS/bktHAGKZQnUU9 CCttELQxojjlaFcbl42qNhp8GUwb2V75ya1DUTI9Rfgnu7lt/AJIWKFqW0WXOiqXvc/o FpwltinMCScXZrm0Kog3LU/3dP52ILEEExWkK7bfx91tZkJNzBf5eI8bCnjZ+OCTRMvV oXABpE/HZwOZDJJv4dm05NpnGJGQpbUSyioguI++NnYsEfxqJnvFv0K3XNTwGKkYt7Vq SKcw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cXe+QG05; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-178087-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178087-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-63413d71213si9564021a12.794.2024.05.13.13.51.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 13:51:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178087-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cXe+QG05; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-178087-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178087-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 672F62866BF for ; Mon, 13 May 2024 20:51:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3F9C823DE; Mon, 13 May 2024 20:51:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cXe+QG05" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B0F03A1A2; Mon, 13 May 2024 20:51:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715633495; cv=none; b=qmnBzdHxOBXVnhxT6DX67SGXrM127owc0DKFF3xDCWxx5Q2896yUxvnB5aLFGQskCZHaCwhcE4rHf52NYC4TirnKXc+I/K9bjQWqQhxVC9YfkKIYRi1+8TD6s/K7UV/JDX+HAs3AvvIZVNNo3u2E8xgwP1LBtkzM9YI+l0vkpjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715633495; c=relaxed/simple; bh=x1s6uZWdvm+KEY3Apexxgf5pQTfniOCvOTs3jXtO7wk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=POcBw1CJ4kMq9sjzvqAgv/bV8M5XMsb671hTwCMiYdTsLYT1GxQgJ4i6YsVnd/B4p+HPBWP0KuvI+qPjMzjEjyd3t/qFXBU9H310+lj43IMj/gAI6c9WcpI8koJUFkPkEfLDX3V9SBol3zBJ0bCp8xhl9b4V3yQM+WTMcXWbdbY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cXe+QG05; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715633494; x=1747169494; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=x1s6uZWdvm+KEY3Apexxgf5pQTfniOCvOTs3jXtO7wk=; b=cXe+QG055mFNENquv+Xl0X+iKRgQSphPMIVyb/+k9AoZQUP8z+MOjHZI XB04Ev7y70tvjij9VHctHNdHBIutCjSsY+2XYmTYZdhtzny9TR9vZIL8t R6bo7v2s/EDDZuSZ0ZNMSmU24/AaohoSvtQlmf5KNvgRKG7THoMs1oLke PGWOG7HV2LLhC+KE/q+RDAoTliR8QaF8UOmo4HbbyqX7cjKC4OfszX3lr Eo9dUa7KMW+y/j+3WL3ojyd4dkf9Vj5mhb7bPbT+KKGi53dfkTkF6smdw Pzw5e36hdZBfzyDJGX4xlICuT0s65lzAtZV3zGtwNQ5LFSSJgGEtBufRs g==; X-CSE-ConnectionGUID: NZR/EfZaRLiWtyLQzKjIeQ== X-CSE-MsgGUID: iLedArpxR1aPYndKjsV2NA== X-IronPort-AV: E=McAfee;i="6600,9927,11072"; a="22737126" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="22737126" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 13:51:33 -0700 X-CSE-ConnectionGUID: cCQB5xTpQYC76ith1YZAwQ== X-CSE-MsgGUID: WExAGTfLQSyd0xOustYf6w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="34896296" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 13:51:32 -0700 Date: Mon, 13 May 2024 13:51:32 -0700 From: Isaku Yamahata To: Binbin Wu Cc: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, seanjc@google.com, michael.roth@amd.com, isaku.yamahata@intel.com, thomas.lendacky@amd.com, isaku.yamahata@linux.intel.com Subject: Re: [PATCH 02/21] KVM: Allow page-sized MMU caches to be initialized with custom 64-bit values Message-ID: <20240513205132.GB168153@ls.amr.corp.intel.com> References: <20240227232100.478238-1-pbonzini@redhat.com> <20240227232100.478238-3-pbonzini@redhat.com> <6bd61607-9491-4517-8fc8-8d61d9416cab@linux.intel.com> <4d0d9f64-4cc4-4c1e-ba27-ff70c9827570@linux.intel.com> <20240513203839.GA168153@ls.amr.corp.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240513203839.GA168153@ls.amr.corp.intel.com> On Mon, May 13, 2024 at 01:38:39PM -0700, Isaku Yamahata wrote: > > > > index 9c99c9373a3e..c9828feb7a1c 100644 > > > > --- a/virt/kvm/kvm_main.c > > > > +++ b/virt/kvm/kvm_main.c > > > > @@ -401,12 +401,17 @@ static void kvm_flush_shadow_all(struct kvm *kvm) > > > >   static inline void *mmu_memory_cache_alloc_obj(struct > > > > kvm_mmu_memory_cache *mc, > > > >                              gfp_t gfp_flags) > > > >   { > > > > +    void *page; > > > > + > > > >       gfp_flags |= mc->gfp_zero; > > > >         if (mc->kmem_cache) > > > >           return kmem_cache_alloc(mc->kmem_cache, gfp_flags); > > > > -    else > > > > -        return (void *)__get_free_page(gfp_flags); > > > > + > > > > +    page = (void *)__get_free_page(gfp_flags); > > > > +    if (page && mc->init_value) > > > > +        memset64(page, mc->init_value, PAGE_SIZE / > > > > sizeof(mc->init_value)); > > > > Do we need a static_assert() to make sure mc->init_value is 64bit? > > That's overkill because EPT entry is defined as 64bit and KVM uses u64 for it > uniformly. Oops, I picked the wrong mail to reply. Sorry for noise. -- Isaku Yamahata