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] [day] [month] [year] [list]
Message-ID: <847ff9d1-c160-f243-65cf-92bbe14abf33@redhat.com>
Date:   Fri, 2 Dec 2022 19:43:04 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     liujing <liujing@...s.chinamobile.com>
Cc:     tglx@...utronix.de, mingo@...hat.com, dave.hansen@...ux.intel.com,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: x86: Optimize your code to avoid unnecessary calls

Hi,

thanks for your contribution!  We can improve the code even further 
though.  You are still calling kvm_pic_update_irq() after 
kvm_set_ioapic(), and that is also unnecessary.

On 12/1/22 02:42, liujing wrote:
> @@ -6047,11 +6042,10 @@ static int kvm_vm_ioctl_set_irqchip(struct kvm *kvm, struct kvm_irqchip *chip)
>   		kvm_set_ioapic(kvm, &chip->chip.ioapic);
>   		break;
>   	default:
> -		r = -EINVAL;
> -		break;
> +		return -EINVAL;
>   	}
>   	kvm_pic_update_irq(pic);
> -	return r;

Please make instead a new function:

void
kvm_set_pic(struct kvm *kvm, int n, struct kvm_pic_state *state)
{
	struct kvm_pic *s = kvm->arch.vpic;

	pic_lock(s);
	memcpy(...)
	pic_update_irq(s);
	pic_unlock(s);
}

that lets you replace kvm_pic_update_irq() altogether.

Thanks!

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ