jump-label: export jump_label_inc/jump_label_dec
Subsystems (5)
PATCH 1/5 jump-label: export jump_label_inc/jump_label_dec
Export these two symbols, they will be used by mmu audit
--- kernel/jump_label.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/jump_label.c +2 -0
@@ -70,6 +70,7 @@ void jump_label_inc(struct jump_label_key *key)jump_label_update (key,JUMP_LABEL_ENABLE );jump_label_unlock (); } +EXPORT_SYMBOL_GPL (jump_label_inc);void jump_label_dec (struct jump_label_key *key) {
@@ -79,6 +80,7 @@ void jump_label_dec(struct jump_label_key *key)jump_label_update (key,JUMP_LABEL_DISABLE );jump_label_unlock (); } +EXPORT_SYMBOL_GPL (jump_label_dec);static int addr_conflict (struct jump_entry *entry,void *start,void *end) {
Signature · 1 line
1.7.7.3
PATCH 2/5 KVM: MMU: audit: replace mmu audit tracepoint with jump-lable
The tracepoint is only used to audit mmu code, it should not be exposed to user, let us replace it with jump-lable
--- arch/x86/kvm/mmu.c | 16 +++++++++++----- arch/x86/kvm/mmu_audit.c | 28 +++++++++++++--------------- arch/x86/kvm/mmutrace.h | 19 ------------------- arch/x86/kvm/paging_tmpl.h | 4 ++-- 4 files changed, 26 insertions(+), 41 deletions(-)
arch/x86/kvm/mmu.c +11 -5
@@ -68,6 +68,12 @@ char *audit_point_name[] = { "post sync" }; +#ifdef CONFIG_KVM_MMU_AUDIT +static void kvm_mmu_audit (struct kvm_vcpu *vcpu,int point); +#else +static void kvm_mmu_audit (struct kvm_vcpu *vcpu,int point) { } +#endif +#undef MMU_DEBUG#ifdef MMU_DEBUG
@@ -2852,12 +2858,12 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu)return ;vcpu_clear_mmio_info (vcpu, ~0ul ); -trace_kvm_mmu_audit (vcpu,AUDIT_PRE_SYNC ); +kvm_mmu_audit (vcpu,AUDIT_PRE_SYNC );if (vcpu->arch.mmu.root_level ==PT64_ROOT_LEVEL ) {hpa_t root = vcpu->arch.mmu.root_hpa; sp =page_header (root);mmu_sync_children (vcpu, sp); -trace_kvm_mmu_audit (vcpu,AUDIT_POST_SYNC ); +kvm_mmu_audit (vcpu,AUDIT_POST_SYNC );return ; }for (i =0 ; i <4 ; ++i) {
@@ -2869,7 +2875,7 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu)mmu_sync_children (vcpu, sp); } } -trace_kvm_mmu_audit (vcpu,AUDIT_POST_SYNC ); +kvm_mmu_audit (vcpu,AUDIT_POST_SYNC ); }void kvm_mmu_sync_roots (struct kvm_vcpu *vcpu)
@@ -3667,7 +3673,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,spin_lock (&vcpu->kvm->mmu_lock); ++vcpu->kvm->stat.mmu_pte_write; -trace_kvm_mmu_audit (vcpu,AUDIT_PRE_PTE_WRITE ); +kvm_mmu_audit (vcpu,AUDIT_PRE_PTE_WRITE ); mask.cr0_wp = mask.cr4_pae = mask.nxe =1 ;for_each_gfn_indirect_valid_sp (vcpu->kvm, sp, gfn, node) {
@@ -3700,7 +3706,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, }mmu_pte_write_flush_tlb (vcpu, zap_page, remote_flush, local_flush);kvm_mmu_commit_zap_page (vcpu->kvm, &invalid_list); -trace_kvm_mmu_audit (vcpu,AUDIT_POST_PTE_WRITE ); +kvm_mmu_audit (vcpu,AUDIT_POST_PTE_WRITE );spin_unlock (&vcpu->kvm->mmu_lock); }
arch/x86/kvm/mmu_audit.c +13 -15
@@ -224,30 +224,29 @@ static void audit_vcpu_spte(struct kvm_vcpu *vcpu)mmu_spte_walk (vcpu, audit_spte); } -static void kvm_mmu_audit (void *ignore,struct kvm_vcpu *vcpu,int point) +static bool mmu_audit; +static struct jump_label_key mmu_audit_key; + +static void kvm_mmu_audit (struct kvm_vcpu *vcpu,int point) { static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10); -if (!__ratelimit (&ratelimit_state)) -return ; +if (static_branch ((&mmu_audit_key))) { +if (!__ratelimit (&ratelimit_state)) +return ; - vcpu->kvm->arch.audit_point = point; -audit_all_active_sps (vcpu->kvm); -audit_vcpu_spte (vcpu); + vcpu->kvm->arch.audit_point = point; +audit_all_active_sps (vcpu->kvm); +audit_vcpu_spte (vcpu); + } } -static bool mmu_audit; -static void mmu_audit_enable (void ) { -int ret; -if (mmu_audit)return ; - ret =register_trace_kvm_mmu_audit (kvm_mmu_audit,NULL ); -WARN_ON (ret); - +jump_label_inc (&mmu_audit_key); mmu_audit = true; }
@@ -256,8 +255,7 @@ static void mmu_audit_disable(void)if (!mmu_audit)return ; -unregister_trace_kvm_mmu_audit (kvm_mmu_audit,NULL ); -tracepoint_synchronize_unregister (); +jump_label_dec (&mmu_audit_key); mmu_audit = false; }
arch/x86/kvm/mmutrace.h +0 -19
@@ -243,25 +243,6 @@ TRACE_EVENT(TP_printk ("addr:%llx gfn %llx access %x" , __entry->addr, __entry->gfn, __entry->access) ); - -TRACE_EVENT ( - kvm_mmu_audit, - TP_PROTO(struct kvm_vcpu *vcpu, int audit_point), -TP_ARGS (vcpu, audit_point), - -TP_STRUCT__entry ( - __field(struct kvm_vcpu *, vcpu) -__field (int, audit_point) - ), - -TP_fast_assign ( - __entry->vcpu = vcpu; - __entry->audit_point = audit_point; - ), - -TP_printk ("vcpu:%d %s" , __entry->vcpu->cpu, - audit_point_name[__entry->audit_point]) -);#endif /* _TRACE_KVMMMU_H */ #undef TRACE_INCLUDE_PATH
arch/x86/kvm/paging_tmpl.h +2 -2
@@ -632,7 +632,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code,if (mmu_notifier_retry (vcpu, mmu_seq)) goto out_unlock; -trace_kvm_mmu_audit (vcpu,AUDIT_PRE_PAGE_FAULT ); +kvm_mmu_audit (vcpu,AUDIT_PRE_PAGE_FAULT );kvm_mmu_free_some_pages (vcpu);if (!force_pt_level)transparent_hugepage_adjust (vcpu, &walker.gfn, &pfn, &level);
@@ -643,7 +643,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code, sptep, *sptep, emulate); ++vcpu->stat.pf_fixed; -trace_kvm_mmu_audit (vcpu,AUDIT_POST_PAGE_FAULT ); +kvm_mmu_audit (vcpu,AUDIT_POST_PAGE_FAULT );spin_unlock (&vcpu->kvm->mmu_lock);return emulate;
Signature · 1 line
1.7.7.3
Re: [PATCH 2/5] KVM: MMU: audit: replace mmu audit tracepoint with jump-lable
Quoted 8 lines · Xiao Guangrong
arch/x86/kvm/mmu_audit.c +3
-2+static void kvm_mmu_audit (struct kvm_vcpu *vcpu,int point) { static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10); -if (!__ratelimit (&ratelimit_state)) -return ; +if (static_branch ((&mmu_audit_key))) { +if (!__ratelimit (&ratelimit_state))
arch/x86/kvm/mmu_audit.c static void audit_vcpu_spte(struct kvm_vcpu *vcpu) · line 242
Quoted 10 lines
arch/x86/kvm/mmu_audit.c +5
-3+return ; - vcpu->kvm->arch.audit_point = point; -audit_all_active_sps (vcpu->kvm); -audit_vcpu_spte (vcpu); + vcpu->kvm->arch.audit_point = point; +audit_all_active_sps (vcpu->kvm); +audit_vcpu_spte (vcpu); + } }
hmmm..this always going to do a call to 'kvm_mmu_audit' and then return. I think you want to avoid the function call altogether. You could do something like:
#define kvm_mmu_audit()
if (static_branch((&mmu_audit_key))) {
__kvm_mmu_audit();
}and s/kvm_mmu_audit/__kvm_mmu_audit
That should give you a single nop for the case where kvm_mmu_audit is disabled instead of a function call.
Thanks,
-Jason
Re: [PATCH 2/5] KVM: MMU: audit: replace mmu audit tracepoint with jump-lable
Quoted 9 lines · Jason Baron
hmmm..this always going to do a call to '
kvm_mmu_audit' and then return. I think you want to avoid the function call altogether. You could do something like:#define kvm_mmu_audit() if (static_branch((&mmu_audit_key))) { __kvm_mmu_audit(); }
Quoted 4 lines
and s/kvm_mmu_audit/__kvm_mmu_audit
That should give you a single nop for the case where
kvm_mmu_auditis disabled instead of a function call.
Good point, thanks Jason!
Avi, could you please apply the following patch instead?
Subject: [PATCH v2 2/5] KVM: MMU: audit: replace mmu audit tracepoint with jump-lable
The tracepoint is only used to audit mmu code, it should not be exposed to user, let us replace it with jump-lable
--- arch/x86/kvm/mmu.c | 23 ++++++++++++----------- arch/x86/kvm/mmu_audit.c | 17 +++++++++-------- arch/x86/kvm/mmutrace.h | 19 ------------------- arch/x86/kvm/paging_tmpl.h | 4 ++-- 4 files changed, 23 insertions(+), 40 deletions(-)
arch/x86/kvm/mmu.c +12 -11
@@ -2840,6 +2840,13 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu)return mmu_alloc_shadow_roots (vcpu); } +#ifdef CONFIG_KVM_MMU_AUDIT +#include "mmu_audit.c" +#else +static void kvm_mmu_audit (struct kvm_vcpu *vcpu,int point) { } +static void mmu_audit_disable (void ) { } +#endif +static void mmu_sync_roots (struct kvm_vcpu *vcpu) {int i;
@@ -2852,12 +2859,12 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu)return ;vcpu_clear_mmio_info (vcpu, ~0ul ); -trace_kvm_mmu_audit (vcpu,AUDIT_PRE_SYNC ); +kvm_mmu_audit (vcpu,AUDIT_PRE_SYNC );if (vcpu->arch.mmu.root_level ==PT64_ROOT_LEVEL ) {hpa_t root = vcpu->arch.mmu.root_hpa; sp =page_header (root);mmu_sync_children (vcpu, sp); -trace_kvm_mmu_audit (vcpu,AUDIT_POST_SYNC ); +kvm_mmu_audit (vcpu,AUDIT_POST_SYNC );return ; }for (i =0 ; i <4 ; ++i) {
@@ -2869,7 +2876,7 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu)mmu_sync_children (vcpu, sp); } } -trace_kvm_mmu_audit (vcpu,AUDIT_POST_SYNC ); +kvm_mmu_audit (vcpu,AUDIT_POST_SYNC ); }void kvm_mmu_sync_roots (struct kvm_vcpu *vcpu)
@@ -3667,7 +3674,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,spin_lock (&vcpu->kvm->mmu_lock); ++vcpu->kvm->stat.mmu_pte_write; -trace_kvm_mmu_audit (vcpu,AUDIT_PRE_PTE_WRITE ); +kvm_mmu_audit (vcpu,AUDIT_PRE_PTE_WRITE ); mask.cr0_wp = mask.cr4_pae = mask.nxe =1 ;for_each_gfn_indirect_valid_sp (vcpu->kvm, sp, gfn, node) {
@@ -3700,7 +3707,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, }mmu_pte_write_flush_tlb (vcpu, zap_page, remote_flush, local_flush);kvm_mmu_commit_zap_page (vcpu->kvm, &invalid_list); -trace_kvm_mmu_audit (vcpu,AUDIT_POST_PTE_WRITE ); +kvm_mmu_audit (vcpu,AUDIT_POST_PTE_WRITE );spin_unlock (&vcpu->kvm->mmu_lock); }
@@ -4030,12 +4037,6 @@ void kvm_mmu_destroy(struct kvm_vcpu *vcpu)mmu_free_memory_caches (vcpu); } -#ifdef CONFIG_KVM_MMU_AUDIT -#include "mmu_audit.c" -#else -static void mmu_audit_disable (void ) { } -#endif -void kvm_mmu_module_exit (void ) {mmu_destroy_caches ();
arch/x86/kvm/mmu_audit.c +9 -8
@@ -224,7 +224,7 @@ static void audit_vcpu_spte(struct kvm_vcpu *vcpu)mmu_spte_walk (vcpu, audit_spte); } -static void kvm_mmu_audit (void *ignore,struct kvm_vcpu *vcpu,int point) +static void __kvm_mmu_audit (struct kvm_vcpu *vcpu,int point) { static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10);
@@ -237,17 +237,19 @@ static void kvm_mmu_audit(void *ignore, struct kvm_vcpu *vcpu, int point) }static bool mmu_audit; +static struct jump_label_key mmu_audit_key; + +#define kvm_mmu_audit (vcpu, point) \ + if (static_branch((&mmu_audit_key))) { \ + __kvm_mmu_audit(vcpu, point); \ + }static void mmu_audit_enable (void ) { -int ret; -if (mmu_audit)return ; - ret =register_trace_kvm_mmu_audit (kvm_mmu_audit,NULL ); -WARN_ON (ret); - +jump_label_inc (&mmu_audit_key); mmu_audit = true; }
@@ -256,8 +258,7 @@ static void mmu_audit_disable(void)if (!mmu_audit)return ; -unregister_trace_kvm_mmu_audit (kvm_mmu_audit,NULL ); -tracepoint_synchronize_unregister (); +jump_label_dec (&mmu_audit_key); mmu_audit = false; }
arch/x86/kvm/mmutrace.h +0 -19
@@ -243,25 +243,6 @@ TRACE_EVENT(TP_printk ("addr:%llx gfn %llx access %x" , __entry->addr, __entry->gfn, __entry->access) ); - -TRACE_EVENT ( - kvm_mmu_audit, - TP_PROTO(struct kvm_vcpu *vcpu, int audit_point), -TP_ARGS (vcpu, audit_point), - -TP_STRUCT__entry ( - __field(struct kvm_vcpu *, vcpu) -__field (int, audit_point) - ), - -TP_fast_assign ( - __entry->vcpu = vcpu; - __entry->audit_point = audit_point; - ), - -TP_printk ("vcpu:%d %s" , __entry->vcpu->cpu, - audit_point_name[__entry->audit_point]) -);#endif /* _TRACE_KVMMMU_H */ #undef TRACE_INCLUDE_PATH
arch/x86/kvm/paging_tmpl.h +2 -2
@@ -632,7 +632,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code,if (mmu_notifier_retry (vcpu, mmu_seq)) goto out_unlock; -trace_kvm_mmu_audit (vcpu,AUDIT_PRE_PAGE_FAULT ); +kvm_mmu_audit (vcpu,AUDIT_PRE_PAGE_FAULT );kvm_mmu_free_some_pages (vcpu);if (!force_pt_level)transparent_hugepage_adjust (vcpu, &walker.gfn, &pfn, &level);
@@ -643,7 +643,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code, sptep, *sptep, emulate); ++vcpu->stat.pf_fixed; -trace_kvm_mmu_audit (vcpu,AUDIT_POST_PAGE_FAULT ); +kvm_mmu_audit (vcpu,AUDIT_POST_PAGE_FAULT );spin_unlock (&vcpu->kvm->mmu_lock);return emulate;
Signature · 1 line
1.7.7.3
Re: [PATCH 2/5] KVM: MMU: audit: replace mmu audit tracepoint with jump-lable
Quoted 9 lines · Xiao Guangrong
Subject: [PATCH v2 2/5] KVM: MMU: audit: replace mmu audit tracepoint with jump-lable
The tracepoint is only used to audit mmu code, it should not be exposed to user, let us replace it with jump-lable
static bool
mmu_audit;
arch/x86/kvm/mmu_audit.c static void kvm_mmu_audit(void *ignore, struct kvm_vcpu *vcpu, int point) · line 245
Quoted 6 lines
arch/x86/kvm/mmu_audit.c +6
-0+static struct jump_label_key mmu_audit_key; + +#define kvm_mmu_audit (vcpu, point) \ + if (static_branch((&mmu_audit_key))) { \ + __kvm_mmu_audit(vcpu, point); \ + }
static inline function, please, and as an incremental against next. I'll fold it to the parent patch.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [PATCH 2/5] KVM: MMU: audit: replace mmu audit tracepoint with jump-lable
Quoted 7 lines · Avi Kivity
Quoted 6 lines · Xiao Guangrong
Subject: [PATCH v2 2/5] KVM: MMU: audit: replace mmu audit tracepoint with jump-lable
The tracepoint is only used to audit mmu code, it should not be exposed to user, let us replace it with jump-lable
Quoted 14 lines
Review
Quoted 9 lines
static bool
mmu_audit;(quoted diff) +6
-0+static struct jump_label_key mmu_audit_key; + +#define kvm_mmu_audit(vcpu, point) \ + if (static_branch((&mmu_audit_key))) { \ + __kvm_mmu_audit(vcpu, point); \ + }static inline function, please, and as an incremental against next. I'll fold it to the parent patch.
OK, this is the new one. Thanks!
Subject: [PATCH] KVM: MMU: audit: inline audit function
inline audit function and little cleanup
--- arch/x86/kvm/mmu.c | 28 +++++++--------------------- arch/x86/kvm/mmu_audit.c | 29 +++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 29 deletions(-)
arch/x86/kvm/mmu.c +7 -21
@@ -59,21 +59,6 @@ enum { AUDIT_POST_SYNC }; -char *audit_point_name[] = { -"pre page fault" , -"post page fault" , -"pre pte write" , -"post pte write" , -"pre sync" , -"post sync" -}; - -#ifdef CONFIG_KVM_MMU_AUDIT -static void kvm_mmu_audit (struct kvm_vcpu *vcpu,int point); -#else -static void kvm_mmu_audit (struct kvm_vcpu *vcpu,int point) { } -#endif -#undef MMU_DEBUG#ifdef MMU_DEBUG
@@ -1539,6 +1524,13 @@ static int kvm_sync_page_transient(struct kvm_vcpu *vcpu,return ret; } +#ifdef CONFIG_KVM_MMU_AUDIT +#include "mmu_audit.c" +#else +static void kvm_mmu_audit (struct kvm_vcpu *vcpu,int point) { } +static void mmu_audit_disable (void ) { } +#endif +static int kvm_sync_page (struct kvm_vcpu *vcpu,struct kvm_mmu_page *sp,struct list_head *invalid_list) {
@@ -4035,12 +4027,6 @@ void kvm_mmu_destroy(struct kvm_vcpu *vcpu)mmu_free_memory_caches (vcpu); } -#ifdef CONFIG_KVM_MMU_AUDIT -#include "mmu_audit.c" -#else -static void mmu_audit_disable (void ) { } -#endif -void kvm_mmu_module_exit (void ) {mmu_destroy_caches ();
arch/x86/kvm/mmu_audit.c +21 -8
@@ -19,6 +19,15 @@#include <linux/ratelimit.h> +char const *audit_point_name[] = { +"pre page fault" , +"post page fault" , +"pre pte write" , +"post pte write" , +"pre sync" , +"post sync" +}; + #define audit_printk(kvm, fmt, args...) \ printk(KERN_ERR "audit: (%s) error: " \ fmt, audit_point_name[kvm->arch.audit_point], ##args)
@@ -227,18 +236,22 @@ static void audit_vcpu_spte(struct kvm_vcpu *vcpu)static bool mmu_audit;static struct jump_label_key mmu_audit_key; -static void kvm_mmu_audit (struct kvm_vcpu *vcpu,int point) +static void __kvm_mmu_audit (struct kvm_vcpu *vcpu,int point) { static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10); -if (static_branch ((&mmu_audit_key))) { -if (!__ratelimit (&ratelimit_state)) -return ; +if (!__ratelimit (&ratelimit_state)) +return ; - vcpu->kvm->arch.audit_point = point; -audit_all_active_sps (vcpu->kvm); -audit_vcpu_spte (vcpu); - } + vcpu->kvm->arch.audit_point = point; +audit_all_active_sps (vcpu->kvm); +audit_vcpu_spte (vcpu); +} + +static inline void kvm_mmu_audit (struct kvm_vcpu *vcpu,int point) +{ +if (static_branch ((&mmu_audit_key))) +__kvm_mmu_audit (vcpu, point); }static void mmu_audit_enable (void )
Signature · 1 line
1.7.7.3
Avi Kivity
AppliedRe: [PATCH 2/5] KVM: MMU: audit: replace mmu audit tracepoint with jump-lable
Quoted 5 lines · Xiao Guangrong
Subject: [PATCH] KVM: MMU: audit: inline audit function
inline audit function and little cleanup
Thanks, applied.
Signature · 1 line
error compiling committee.c: too many arguments to function
PATCH 3/5 KVM: x86: remove the dead code of KVM_EXIT_HYPERCALL
In reply to Xiao GuangrongKVM_EXIT_HYPERCALL is not used anymore, so remove the code
--- arch/x86/kvm/x86.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
arch/x86/kvm/x86.c +0 -4
@@ -5386,10 +5386,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)if (r <=0 ) goto out; -if (kvm_run->exit_reason ==KVM_EXIT_HYPERCALL ) -kvm_register_write (vcpu,VCPU_REGS_RAX , - kvm_run->hypercall.ret); - r =__vcpu_run (vcpu); out:
Signature · 1 line
1.7.7.3
Re: [PATCH 3/5] KVM: x86: remove the dead code of KVM_EXIT_HYPERCALL
Quoted 2 lines · Xiao Guangrong
KVM_EXIT_HYPERCALLis not used anymore, so remove the code
Why not remove the define as well?
Quoted 28 lines
Signed-off-by Xiao Guangrong <[email protected]>--- arch/x86/kvm/x86.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)arch/x86/kvm/x86.c +0
-4@@ -5386,10 +5386,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)if (r <=0 ) goto out; -if (kvm_run->exit_reason ==KVM_EXIT_HYPERCALL ) -kvm_register_write (vcpu,VCPU_REGS_RAX , - kvm_run->hypercall.ret); - r =__vcpu_run (vcpu); out:Signature · 7 lines
1.7.7.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
--
Gleb.
Re: [PATCH 3/5] KVM: x86: remove the dead code of KVM_EXIT_HYPERCALL
Quoted 6 lines · Gleb Natapov
Quoted 2 lines · Xiao Guangrong
KVM_EXIT_HYPERCALLis not used anymore, so remove the codeWhy not remove the define as well?
It's in kvm.h, best not to touch it in case someone has
case KVM_EXIT_HYPERCALL:
abort();Signature · 1 line
error compiling committee.c: too many arguments to function
PATCH 4/5 KVM: MMU: move the relevant mmu code to mmu.c
In reply to Xiao GuangrongMove the mmu code in kvm_arch_vcpu_init() to kvm_mmu_create()
--- arch/x86/include/asm/kvm_host.h | 6 ++++++ arch/x86/kvm/mmu.c | 6 +++++- arch/x86/kvm/x86.c | 11 +---------- 3 files changed, 12 insertions(+), 11 deletions(-)
arch/x86/include/asm/kvm_host.h +6 -0
@@ -752,6 +752,7 @@ void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu);int kvm_mmu_load (struct kvm_vcpu *vcpu);void kvm_mmu_unload (struct kvm_vcpu *vcpu);void kvm_mmu_sync_roots (struct kvm_vcpu *vcpu); +gpa_t translate_nested_gpa (struct kvm_vcpu *vcpu,gpa_t gpa,u32 access);gpa_t kvm_mmu_gva_to_gpa_read (struct kvm_vcpu *vcpu,gva_t gva,struct x86_exception *exception); gpa_t kvm_mmu_gva_to_gpa_fetch(struct kvm_vcpu *vcpu, gva_t gva,
@@ -773,6 +774,11 @@ void kvm_disable_tdp(void);int complete_pio (struct kvm_vcpu *vcpu);bool kvm_check_iopl (struct kvm_vcpu *vcpu); +static inline gpa_t translate_gpa (struct kvm_vcpu *vcpu,gpa_t gpa,u32 access) +{ +return gpa; +} +static inline struct kvm_mmu_page *page_header (hpa_t shadow_page) {struct page *page =pfn_to_page (shadow_page >>PAGE_SHIFT );
arch/x86/kvm/mmu.c +5 -1
@@ -3839,7 +3839,11 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu)int kvm_mmu_create (struct kvm_vcpu *vcpu) {ASSERT (vcpu); -ASSERT (!VALID_PAGE (vcpu->arch.mmu.root_hpa)); + + vcpu->arch.walk_mmu = &vcpu->arch.mmu; + vcpu->arch.mmu.root_hpa =INVALID_PAGE ; + vcpu->arch.mmu.translate_gpa = translate_gpa; + vcpu->arch.nested_mmu.translate_gpa = translate_nested_gpa;return alloc_mmu_pages (vcpu); }
arch/x86/kvm/x86.c +1 -10
@@ -3427,12 +3427,7 @@ void kvm_get_segment(struct kvm_vcpu *vcpu, kvm_x86_ops->get_segment (vcpu, var, seg); } -static gpa_t translate_gpa (struct kvm_vcpu *vcpu,gpa_t gpa,u32 access) -{ -return gpa; -} - -static gpa_t translate_nested_gpa (struct kvm_vcpu *vcpu,gpa_t gpa,u32 access) +gpa_t translate_nested_gpa (struct kvm_vcpu *vcpu,gpa_t gpa,u32 access) {gpa_t t_gpa;struct x86_exception exception;
@@ -5912,10 +5907,6 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) kvm = vcpu->kvm; vcpu->arch.emulate_ctxt.ops = &emulate_ops; - vcpu->arch.walk_mmu = &vcpu->arch.mmu; - vcpu->arch.mmu.root_hpa =INVALID_PAGE ; - vcpu->arch.mmu.translate_gpa = translate_gpa; - vcpu->arch.nested_mmu.translate_gpa = translate_nested_gpa;if (!irqchip_in_kernel (kvm) ||kvm_vcpu_is_bsp (vcpu)) vcpu->arch.mp_state =KVM_MP_STATE_RUNNABLE ;else
Signature · 1 line
1.7.7.3
PATCH 5/5 KVM: MMU: remove oos_shadow parameter
In reply to Xiao GuangrongThe unsync code should be stable now, maybe it is the time to remove this parameter to cleanup the code a little bit
--- Documentation/kernel-parameters.txt | 3 --- arch/x86/kvm/mmu.c | 5 ----- 2 files changed, 0 insertions(+), 8 deletions(-)
Documentation/kernel-parameters.txt +0 -3
@@ -1178,9 +1178,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. kvm.ignore_msrs=[KVM] Ignore guest accesses to unhandled MSRs. Default is 0 (don't ignore, but inject #GP) - kvm.oos_shadow= [KVM] Disable out-of-sync shadow paging. - Default is 1 (enabled) - kvm.mmu_audit= [KVM] This is a R/W parameter which allows audit KVM MMU at runtime. Default is 0 (off)
arch/x86/kvm/mmu.c +0 -5
@@ -93,9 +93,6 @@ static int dbg = 0;module_param (dbg, bool,0644 );#endif -static int oos_shadow =1 ; -module_param (oos_shadow, bool,0644 ); -#ifndef MMU_DEBUG #define ASSERT (x) do { } while (0)#else
@@ -2196,8 +2193,6 @@ static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn,return 1 ;if (!need_unsync && !s->unsync) { -if (!oos_shadow) -return 1 ; need_unsync = true; } }
Signature · 1 line
1.7.7.3
Re: [PATCH 5/5] KVM: MMU: remove oos_shadow parameter
Quoted 3 lines · Xiao Guangrong
The unsync code should be stable now, maybe it is the time to remove this parameter to cleanup the code a little bit
Thanks, all applied.
Signature · 1 line
error compiling committee.c: too many arguments to function