lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111128223305.GB2519@redhat.com>
Date:	Mon, 28 Nov 2011 17:33:05 -0500
From:	Jason Baron <jbaron@...hat.com>
To:	Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
Cc:	Avi Kivity <avi@...hat.com>, Marcelo Tosatti <mtosatti@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>
Subject: Re: [PATCH 2/5] KVM: MMU: audit: replace mmu audit tracepoint with
 jump-lable

On Mon, Nov 28, 2011 at 08:41:00PM +0800, Xiao Guangrong wrote:
> +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);
> +	}
>  }

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ