From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH v2 5/5] KVM: refactor asynchronous vcpu ioctl dispatch Date: Thu, 13 Aug 2015 10:53:57 +0200 Message-ID: <20150813085356.GA27468@potion.brq.redhat.com> References: <1438792381-19453-1-git-send-email-rkrcmar@redhat.com> <1438792381-19453-6-git-send-email-rkrcmar@redhat.com> <55CBA67C.1050703@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini To: Christian Borntraeger Return-path: Content-Disposition: inline In-Reply-To: <55CBA67C.1050703@de.ibm.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2015-08-12 22:03+0200, Christian Borntraeger: > Am 05.08.2015 um 18:33 schrieb Radim Kr=C4=8Dm=C3=A1=C5=99: >> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c >> @@ -2252,12 +2252,15 @@ static long kvm_vcpu_ioctl(struct file *filp= , >> * Special cases: vcpu ioctls that are asynchronous to vcpu execut= ion, >> * so vcpu_load() would break it. >> */ >> + switch (ioctl) { >> #if defined(CONFIG_S390) || defined(CONFIG_PPC) || defined(CONFIG_M= IPS) >> - if (ioctl =3D=3D KVM_S390_INTERRUPT || ioctl =3D=3D KVM_S390_IRQ |= | ioctl =3D=3D KVM_INTERRUPT) >> - return kvm_arch_vcpu_ioctl(filp, ioctl, arg); >> + case KVM_S390_INTERRUPT: >> + case KVM_S390_IRQ: >> + case KVM_INTERRUPT: >=20 > When you are it you might want to put the KVM_S390* withing CONFIG_S3= 90 and > KVM_INTERRUPT within CONFIG_PPC || CONFIG_MIPS Sure, thanks. > This might speed up the switch statement for s390/ppc/mips a tiny bit= =2E It will add > another ifdef, though. Paolo? =46or v3, I will name the decision as an inline function, which should make the #ifing more acceptable (at the cost of not having ioctls #defs in the body of kvm_vcpu_ioctl). Something like this, static inline bool kvm_asynchronous_ioctl(unsigned ioctl) { switch (ioctl) { #if defined(CONFIG_S390) case KVM_S390_INTERRUPT: case KVM_S390_IRQ: #endif #if defined(CONFIG_MIPS) case KVM_INTERRUPT: #endif case KVM_USER_EXIT: return true; } return false; } [...] if (kvm_asynchronous_ioctl(ioctl)) return kvm_arch_vcpu_ioctl(filp, ioctl, arg);