Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp1306104pxt; Sat, 7 Aug 2021 06:51:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeC2fSbLzte+O5sMgceRk4Rf7io+lSemuIwUWUwvBVE2z9k/eGKBZzQKNigfq9Q8RkMYbd X-Received: by 2002:a05:6638:1928:: with SMTP id p40mr14699809jal.93.1628344264128; Sat, 07 Aug 2021 06:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628344264; cv=none; d=google.com; s=arc-20160816; b=HYMA0fx2+2BBQj6V+gISofmZD7F9gIO0EuXrna0ju3Phq3QC3zVoFj+nPIlwTlbdwE obg/TyWpfP+ljyYC449CqhCAAFsELu3qFih8E465NBglZJRgZx5E6xCjcqbLMM3TT/ZH KuzTVEbh2wZp2O0qkZ+Qz/AdedAB/cRfyFlBFny3lwBLANtll+VFhAJr6cUxZeqlA0kS 0983NtPMqQJ8qbJMvh6xeeoVuzNrI9UYjTtcPyYqgQCIElu/xi9NjtLNipD5LahIFmgG pXsos4CAkiyZ4SrRuDhygG/Zj6xllxO+G6EXv6vLh2QDptqdg78w5QL7qIJQpMyZTMg7 giog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=AaBBtNAYhX+X64Q0FTJeD4fdcyTME+oaQEbI4zW7Bpc=; b=YAWlKAkfAEzszh2MLIXggY1M3n9dfVe0lnYh5OYgiA1xM1H9asEJa3B60OrNk1sTuS VHmlcbwz/VMjtRLL1QZ79vcDr3oQIkviKUTkBSfEGlLyV9H8iSVD1lEUJytEsAeutW6O ZkHnnPQskxkyEt3GtrVJq/Hls9cLqbGduyktzcT9Svg3YJE75dWP3qNQpUSvoJcng4k9 8Hx9BWvgJmkGHWUxrcHSykozTR1LenWvVv0iK/nNxTHSNgHzGr0cTWTLscnG1G7hz7Hx zZvbCuUpWsBwMQ5ELCcSGG1crhikDZAvxY6B8caddMoDePaZyZ82zs148okaXtcn19Ge RsXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EFa8bRLe; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k15si14102984jad.51.2021.08.07.06.50.37; Sat, 07 Aug 2021 06:51:04 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EFa8bRLe; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232356AbhHGNuC (ORCPT + 99 others); Sat, 7 Aug 2021 09:50:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:26150 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232299AbhHGNuC (ORCPT ); Sat, 7 Aug 2021 09:50:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628344184; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=AaBBtNAYhX+X64Q0FTJeD4fdcyTME+oaQEbI4zW7Bpc=; b=EFa8bRLe2dFE6oK0+f5l1tWFBVmVKlxZYVG7eeK7Z+PYaFJP7fwDLP8SCIss87GxuW994m 5HQLZsfSR2wW8nO2cGaSksgneUsS+7Z7Lb4PzC5KdRu7Pa0s7fh36a/+P0iYudjle320z5 9pduqN/eoTpvgT2NvajvmVG57E7lJdc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-25-JW6QHoQpPm-2ukZNNqvc8w-1; Sat, 07 Aug 2021 09:49:43 -0400 X-MC-Unique: JW6QHoQpPm-2ukZNNqvc8w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFCD81835AC3; Sat, 7 Aug 2021 13:49:41 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 812CE27CA4; Sat, 7 Aug 2021 13:49:37 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: isaku.yamahata@intel.com, David Matlack , seanjc@google.com, peterx@redhat.com Subject: [PATCH 00/16] KVM: x86: pass arguments on the page fault path via struct kvm_page_fault Date: Sat, 7 Aug 2021 09:49:20 -0400 Message-Id: <20210807134936.3083984-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a revival of Isaku's patches from https://lore.kernel.org/kvm/cover.1618914692.git.isaku.yamahata@intel.com/. The current kvm page fault handlers passes around many arguments to the functions. To simplify those arguments and local variables, introduce a data structure, struct kvm_page_fault, to hold those arguments and variables. struct kvm_page_fault is allocated on stack on the caller of kvm fault handler, kvm_mmu_do_page_fault(), and passed around. The patches were redone from scratch based on the suggested struct layout from the review (https://lore.kernel.org/kvm/YK65V++S2Kt1OLTu@google.com/) and the subjects of Isaku's patches, so I kept authorship for myself and gave him a "Suggested-by" tag. The first two steps are unrelated cleanups that come in handy later on. Paolo Paolo Bonzini (16): KVM: MMU: pass unadulterated gpa to direct_page_fault KVM: x86: clamp host mapping level to max_level in kvm_mmu_max_mapping_level KVM: MMU: Introduce struct kvm_page_fault KVM: MMU: change mmu->page_fault() arguments to kvm_page_fault KVM: MMU: change direct_page_fault() arguments to kvm_page_fault KVM: MMU: change page_fault_handle_page_track() arguments to kvm_page_fault KVM: MMU: change try_async_pf() arguments to kvm_page_fault KVM: MMU: change handle_abnormal_pfn() arguments to kvm_page_fault KVM: MMU: change __direct_map() arguments to kvm_page_fault KVM: MMU: change FNAME(fetch)() arguments to kvm_page_fault KVM: MMU: change kvm_tdp_mmu_map() arguments to kvm_page_fault KVM: MMU: change tdp_mmu_map_handle_target_level() arguments to kvm_page_fault KVM: MMU: change fast_page_fault() arguments to kvm_page_fault KVM: MMU: change kvm_mmu_hugepage_adjust() arguments to kvm_page_fault KVM: MMU: change disallowed_hugepage_adjust() arguments to kvm_page_fault KVM: MMU: change tracepoints arguments to kvm_page_fault arch/x86/include/asm/kvm_host.h | 4 +- arch/x86/kvm/mmu.h | 81 ++++++++++- arch/x86/kvm/mmu/mmu.c | 241 ++++++++++++++------------------ arch/x86/kvm/mmu/mmu_internal.h | 13 +- arch/x86/kvm/mmu/mmutrace.h | 18 +-- arch/x86/kvm/mmu/paging_tmpl.h | 96 ++++++------- arch/x86/kvm/mmu/tdp_mmu.c | 49 +++---- arch/x86/kvm/mmu/tdp_mmu.h | 4 +- 8 files changed, 253 insertions(+), 253 deletions(-) -- 2.27.0