From nobody Sun May 19 23:20:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1563956938; cv=none; d=zoho.com; s=zohoarc; b=iQiqN1S9fSZwgRFEKMuw/4w+/TB1wn/y4bDXvQrW7HFK5x9dVHTdlXjDi41P5jtG/SHJz7/Y10jIGOTGFqAW/rmKSgD0EinsyBfuu0zojPowG1xvi1tJ4Sp564WeMwk5zRNct621jXszsntADlMc8EBcwQ3ZhBXvU/bmN2BZJFI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563956938; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=tqofjVlNlDB45ihJz6iTPY9hZP9RrxoKWKH3OuQrbDo=; b=cCeOFtUAOoZmmxyTXY3yOOQORyBfoSXlICZTOPHptRIENo6SUrD65W9Yv80UG6C0onfs+IHfR5wpn218SVqh2bdTloy1NRnWIbLzpCu85jJpGhbBEe/MRNEfZz5MLM2ibe6JuIXn3kAQD84LEpXNEJnmNHMHcOxPb62YKmGUH/A= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563956938751165.99842968799885; Wed, 24 Jul 2019 01:28:58 -0700 (PDT) Received: from localhost ([::1]:49666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCdm-0006Lx-60 for importer@patchew.org; Wed, 24 Jul 2019 04:28:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58117) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCda-0005xB-J2 for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:28:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCdZ-0007Na-2q for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:28:38 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:14214 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hqCdY-0007MO-Kq for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:28:36 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6O8SAuZ063449 for ; Wed, 24 Jul 2019 04:28:34 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2txhgqpet9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 24 Jul 2019 04:28:34 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 24 Jul 2019 09:28:32 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 24 Jul 2019 09:28:30 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6O8SThX37421558 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Jul 2019 08:28:29 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B9824C044; Wed, 24 Jul 2019 08:28:29 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB51F4C04E; Wed, 24 Jul 2019 08:28:28 +0000 (GMT) Received: from lep8c.aus.stglabs.ibm.com (unknown [9.40.192.207]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 24 Jul 2019 08:28:28 +0000 (GMT) From: Shivaprasad G Bhat To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Date: Wed, 24 Jul 2019 03:28:28 -0500 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19072408-0012-0000-0000-00000335A926 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19072408-0013-0000-0000-0000216F3C25 Message-Id: <156395684219.48058.9459603098282979575.stgit@lep8c.aus.stglabs.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-24_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1907240095 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v5] ppc: remove the idle_timer logic X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The KVM_CAP_PPC_IRQ_LEVEL is part of the kernel now since 2.6.37. Drop the redundant logic which is not excercised on new the kernels anymore. Signed-off-by: Shivaprasad G Bhat --- v4: https://lists.gnu.org/archive/html/qemu-devel/2019-07/msg04456.html Changes from v4: - it was discussed to drop the idle_timer logic instead of fixing the leak and keeping the redundant logic around. So, the patch does that. target/ppc/kvm.c | 74 +-------------------------------------------------= ---- 1 file changed, 2 insertions(+), 72 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 8a06d3171e..1c8f2319a0 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -56,7 +56,6 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = =3D { }; =20 static int cap_interrupt_unset; -static int cap_interrupt_level; static int cap_segstate; static int cap_booke_sregs; static int cap_ppc_smt; @@ -87,25 +86,6 @@ static int cap_large_decr; =20 static uint32_t debug_inst_opcode; =20 -/* - * XXX We have a race condition where we actually have a level triggered - * interrupt, but the infrastructure can't expose that yet, so the gue= st - * takes but ignores it, goes to sleep and never gets notified that th= ere's - * still an interrupt pending. - * - * As a quick workaround, let's just wake up again 20 ms after we inje= cted - * an interrupt. That way we can assure that we're always reinjecting - * interrupts in case the guest swallowed them. - */ -static QEMUTimer *idle_timer; - -static void kvm_kick_cpu(void *opaque) -{ - PowerPCCPU *cpu =3D opaque; - - qemu_cpu_kick(CPU(cpu)); -} - /* * Check whether we are running with KVM-PR (instead of KVM-HV). This * should only be used for fallback tests - generally we should use @@ -125,7 +105,6 @@ static int kvmppc_get_dec_bits(void); int kvm_arch_init(MachineState *ms, KVMState *s) { cap_interrupt_unset =3D kvm_check_extension(s, KVM_CAP_PPC_UNSET_IRQ); - cap_interrupt_level =3D kvm_check_extension(s, KVM_CAP_PPC_IRQ_LEVEL); cap_segstate =3D kvm_check_extension(s, KVM_CAP_PPC_SEGSTATE); cap_booke_sregs =3D kvm_check_extension(s, KVM_CAP_PPC_BOOKE_SREGS); cap_ppc_smt_possible =3D kvm_vm_check_extension(s, KVM_CAP_PPC_SMT_POS= SIBLE); @@ -161,11 +140,6 @@ int kvm_arch_init(MachineState *ms, KVMState *s) */ cap_ppc_pvr_compat =3D false; =20 - if (!cap_interrupt_level) { - fprintf(stderr, "KVM: Couldn't find level irq capability. Expect t= he " - "VM to stall at times!\n"); - } - kvm_ppc_register_host_cpu_type(ms); =20 return 0; @@ -491,8 +465,6 @@ int kvm_arch_init_vcpu(CPUState *cs) return ret; } =20 - idle_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, kvm_kick_cpu, cpu); - switch (cenv->mmu_model) { case POWERPC_MMU_BOOKE206: /* This target supports access to KVM's guest TLB */ @@ -1332,7 +1304,7 @@ int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, in= t level) return 0; } =20 - if (!kvm_enabled() || !cap_interrupt_unset || !cap_interrupt_level) { + if (!kvm_enabled() || !cap_interrupt_unset) { return 0; } =20 @@ -1349,49 +1321,7 @@ int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, i= nt level) =20 void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run) { - PowerPCCPU *cpu =3D POWERPC_CPU(cs); - CPUPPCState *env =3D &cpu->env; - int r; - unsigned irq; - - qemu_mutex_lock_iothread(); - - /* - * PowerPC QEMU tracks the various core input pins (interrupt, - * critical interrupt, reset, etc) in PPC-specific - * env->irq_input_state. - */ - if (!cap_interrupt_level && - run->ready_for_interrupt_injection && - (cs->interrupt_request & CPU_INTERRUPT_HARD) && - (env->irq_input_state & (1 << PPC_INPUT_INT))) - { - /* - * For now KVM disregards the 'irq' argument. However, in the - * future KVM could cache it in-kernel to avoid a heavyweight - * exit when reading the UIC. - */ - irq =3D KVM_INTERRUPT_SET; - - trace_kvm_injected_interrupt(irq); - r =3D kvm_vcpu_ioctl(cs, KVM_INTERRUPT, &irq); - if (r < 0) { - printf("cpu %d fail inject %x\n", cs->cpu_index, irq); - } - - /* Always wake up soon in case the interrupt was level based */ - timer_mod(idle_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - (NANOSECONDS_PER_SECOND / 50)); - } - - /* - * We don't know if there are more interrupts pending after - * this. However, the guest will return to userspace in the course - * of handling this one anyways, so we will get a chance to - * deliver the rest. - */ - - qemu_mutex_unlock_iothread(); + return; } =20 MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)