Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3015779ybt; Mon, 22 Jun 2020 12:43:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWHDviel6G9CA1cVrC0xb2DtRKcrkFJhmrFtQUV0NG+p7wmh7zvMpzoA7SYNqsqJUZ8Pd2 X-Received: by 2002:aa7:c790:: with SMTP id n16mr19271114eds.54.1592854995326; Mon, 22 Jun 2020 12:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592854995; cv=none; d=google.com; s=arc-20160816; b=VFgVjiRIQXfonE+XpyHPtTtnZJ84C2IsQ8mWvY7cOjyJvPKYPC92d+g0lLEUIYckIf R1l5LTLsqUObNoiVER0tlj8+rdV52wfF3JiL+j74UJvv0HwSkvWmykRHrknjwH+I3hZ5 PVt6cG25oAeeYCDP0Fmzaihcn3r3DOikDsUmU+tIWmDvzdMMkZ3DJE0thFfFUHW73stH Iy9hvE8UIzT68ioL4VJe41cNnuz0GonnlFth3xDyam73bZd5j0aEoV0PtmO/TTyF7zWR +dB8KYkFJx9wH3g9pkNNHp7+3V2un+KiwT9QkCL1DDJWuDp/ETMowGJt0M/JbLfOxgdD KZ0Q== 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:ironport-sdr:ironport-sdr; bh=enTIFrPK+7qam/nTBt+nfbIrFO2aAyH2hYiv+s8IrEE=; b=0mORnshftOvdni/7CwuzsJ8xVS6yZT9NudEMY2QDikBmDOZ5DJVyjrWuqRmyI3oVYT Vk0rkbJeWw2WvG3sAW5fUAG7+bWtImekbxthLt3Qlr2GZZme0O8jpSFvNAR/OI2JlQgN ifJz8NzDhcYRIECa1EI1DhD8zTEIl4Ep12U+xy07r8mQU0NiaKHEcJPqA/qd3h0S8bmu zkdRP0v4DkqHlLV94XSWEtfW94hxcT/Js0U3w7qzNQeGFSitJ7qtewX3BIdbee+LhDAf FfTQfby7LLGExI2EY+GnbYkcS/WJyImCRya3U1Lw4VGng0sl8ochSAP2OF+d5pOFmRRA 1n/A== 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 k11si10318172eji.338.2020.06.22.12.42.51; Mon, 22 Jun 2020 12:43:15 -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 S1728397AbgFVTk6 (ORCPT + 99 others); Mon, 22 Jun 2020 15:40:58 -0400 Received: from mga04.intel.com ([192.55.52.120]:9154 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728068AbgFVTk5 (ORCPT ); Mon, 22 Jun 2020 15:40:57 -0400 IronPort-SDR: bDFNHcrkkwTVLHcqJAVsIhF+D5EQz8IBOT+h3PIExNcPygWH8I0b57hHUyvT+qLL63ao6JeFLI jpB+FhXvdFAQ== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="141358938" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="141358938" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 12:40:56 -0700 IronPort-SDR: O2b/9H8givv7m7N6NdtbF7yIVm6rD/0I5UzGQRLHIHJLsztvgSIXbC7QNG8I+x4aNniWrNxrWX DnQr+RzAI2QA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="264595386" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by fmsmga008.fm.intel.com with ESMTP; 22 Jun 2020 12:40:55 -0700 Date: Mon, 22 Jun 2020 12:40:55 -0700 From: Sean Christopherson To: Ben Gardon Cc: Marc Zyngier , Paul Mackerras , Christian Borntraeger , Janosch Frank , Paolo Bonzini , James Morse , Julien Thierry , Suzuki K Poulose , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Feiner , Peter Shier , Junaid Shahid , Christoffer Dall Subject: Re: [PATCH 10/21] KVM: x86/mmu: Make __GFP_ZERO a property of the memory cache Message-ID: <20200622194055.GC6151@linux.intel.com> References: <20200605213853.14959-1-sean.j.christopherson@intel.com> <20200605213853.14959-11-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 10, 2020 at 11:57:32AM -0700, Ben Gardon wrote: > > --- > > arch/x86/include/asm/kvm_host.h | 1 + > > arch/x86/kvm/mmu/mmu.c | 7 ++++++- > > 2 files changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > > index e7a427547557..fb99e6776e27 100644 > > --- a/arch/x86/include/asm/kvm_host.h > > +++ b/arch/x86/include/asm/kvm_host.h > > @@ -251,6 +251,7 @@ struct kvm_kernel_irq_routing_entry; > > */ > > struct kvm_mmu_memory_cache { > > int nobjs; > > + gfp_t gfp_zero; > This would make more sense to me if it could be used for general extra > gfp flags and was called gfp_flags or something, or it was a boolean > that was later translated into the flag being set. Storing the > gfp_zero flag here is a little counter-intuitive. Probably not worth > changing unless you're sending out a v2 for some other reason. Ideally, this would be a generic gfp_flags field, but that's basically a non-starter for patch 5, which uses GFP_ATOMIC for the "oh crap the cache is empty" error handling. Allowing arbitrary flags would be a mess. I went with storing a full gfp_t because that produces more optimal code. This isn't a super critical path and it's only a few cycles, but it seems worthwhile given the frequency with which this code will be called, and since this happens under mmu_lock. 348 gfp_flags |= mc->gfp_zero; 0x00000000000058ab <+59>: mov 0x4(%rbx),%eax 0x00000000000058ae <+62>: or $0x400cc0,%eax versus 349 gfp_flags |= __GFP_ZERO; 0x00000000000058a7 <+55>: cmpb $0x1,0x4(%rbx) 0x00000000000058ab <+59>: mov 0x8(%rbx),%rdi <-- unrelated interleaved code 0x00000000000058af <+63>: sbb %eax,%eax 0x00000000000058b1 <+65>: xor %al,%al 0x00000000000058b3 <+67>: add $0x400dc0,%eax