Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1907569imu; Fri, 14 Dec 2018 02:39:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/X/csbmowkvBXp6skq8t4LagFys7Ic3r1AtiFquR7OQjP4k8ZA744x2VW23CJLmUA+KeKt3 X-Received: by 2002:a63:ca0a:: with SMTP id n10mr2255342pgi.258.1544783982073; Fri, 14 Dec 2018 02:39:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544783982; cv=none; d=google.com; s=arc-20160816; b=WJ+AvRxqS290B0AN+b6O29Fn1yDNJldQk1fBPzVUfdz4GaLSXF6en9hRBKIULf1l8c aq7eibJsdgPKZqfbd1f6WTR9ikTb+R3v06C5DtTBafjVXJLBkHiKKcJCdZmo4esK7xjE zNwe3YB2KcjjZzRQCNgYuQfEWOJqywKQjYl6/ZV8DLpbNyGej1Nv1XI8R1tmMUoiDdk0 u4kM6RsFFfHObuprdHLVKpWfB2IiwucnQZqbXsNvY+1k8xcAYjsk/qYesip48bQ8rkaR 8h1ap0xf3arP+MQQol9H1i5OfDllF6+vxWxJsyAUSGgYvSTbEzHPShhh8WFO/27kP3TP bUBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=zCJfAye8CO0+uJoVSGrIenX9GvXqvSLM2AnmaIMB4CE=; b=bPPUqr7EfkKW5kkllI33ZTtY7Air0/2mwxpRZhLHpFBEIXNI8jbrKL56/pjUYAYH+g Z1+g60TleIWwoMi1Xv60WBiaHcSSnotJ07ELobGfKoaN23TYiTBvehq5lUwg3f7h2tl0 NG3khDyGcJtYKsvLVrHm0b+IkEsgccEM++lZ+wSTRn9eoMR+7EQc08YYAi3kqKVJLqF7 qtxNKZl1GWL0HPuFaR85AsN39I5APIvybrNd4XSTewmeE0Xiq+y+2RDg+h1VTaaq0IRb dXrnjkGA5AK52jolxw7PT9fa4vbLnqOiBABCvpQhh86sJjIZsxCE7mfH4eCUgdab86j5 zccg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si3948306pgn.258.2018.12.14.02.39.27; Fri, 14 Dec 2018 02:39:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729541AbeLNKg6 (ORCPT + 99 others); Fri, 14 Dec 2018 05:36:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36510 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726281AbeLNKg5 (ORCPT ); Fri, 14 Dec 2018 05:36:57 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE764300238C; Fri, 14 Dec 2018 10:36:56 +0000 (UTC) Received: from [10.36.112.72] (ovpn-112-72.ams2.redhat.com [10.36.112.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A98665ED50; Fri, 14 Dec 2018 10:36:54 +0000 (UTC) Subject: Re: [PATCH] x86/hyper-v: Stop caring about EOI for direct stimers To: Vitaly Kuznetsov , kvm@vger.kernel.org Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, Roman Kagan References: <20181205153621.14343-1-vkuznets@redhat.com> From: Paolo Bonzini Openpgp: preference=signencrypt Autocrypt: addr=pbonzini@redhat.com; prefer-encrypt=mutual; keydata= mQHhBFRCcBIBDqDGsz4K0zZun3jh+U6Z9wNGLKQ0kSFyjN38gMqU1SfP+TUNQepFHb/Gc0E2 CxXPkIBTvYY+ZPkoTh5xF9oS1jqI8iRLzouzF8yXs3QjQIZ2SfuCxSVwlV65jotcjD2FTN04 hVopm9llFijNZpVIOGUTqzM4U55sdsCcZUluWM6x4HSOdw5F5Utxfp1wOjD/v92Lrax0hjiX DResHSt48q+8FrZzY+AUbkUS+Jm34qjswdrgsC5uxeVcLkBgWLmov2kMaMROT0YmFY6A3m1S P/kXmHDXxhe23gKb3dgwxUTpENDBGcfEzrzilWueOeUWiOcWuFOed/C3SyijBx3Av/lbCsHU Vx6pMycNTdzU1BuAroB+Y3mNEuW56Yd44jlInzG2UOwt9XjjdKkJZ1g0P9dwptwLEgTEd3Fo UdhAQyRXGYO8oROiuh+RZ1lXp6AQ4ZjoyH8WLfTLf5g1EKCTc4C1sy1vQSdzIRu3rBIjAvnC tGZADei1IExLqB3uzXKzZ1BZ+Z8hnt2og9hb7H0y8diYfEk2w3R7wEr+Ehk5NQsT2MPI2QBd wEv1/Aj1DgUHZAHzG1QN9S8wNWQ6K9DqHZTBnI1hUlkp22zCSHK/6FwUCuYp1zcAEQEAAbQj UGFvbG8gQm9uemluaSA8cGJvbnppbmlAcmVkaGF0LmNvbT6JAg0EEwECACMFAlRCcBICGwMH CwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRB+FRAMzTZpsbceDp9IIN6BIA0Ol7MoB15E 11kRz/ewzryFY54tQlMnd4xxfH8MTQ/mm9I482YoSwPMdcWFAKnUX6Yo30tbLiNB8hzaHeRj jx12K+ptq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VD/9 QC2FJISSUDnRC0PawGSZDXhmvITJMdD4TjYrePYhSY4uuIV02v028TVAaYbIhxvDY0hUQE4r 8ZbGRLn52bEzaIPgl1p/adKfeOUeMReg/CkyzQpmyB1TSk8lDMxQzCYHXAzwnGi8WU9iuE1P 0wARAQABiQHzBBgBAgAJBQJUQnHuAhsMAAoJEH4VEAzNNmmxp1EOoJy0uZggJm7gZKeJ7iUp eX4eqUtqelUw6gU2daz2hE/jsxsTbC/w5piHmk1H1VWDKEM4bQBTuiJ0bfo55SWsUNN+c9hh IX+Y8LEe22izK3w7mRpvGcg+/ZRG4DEMHLP6JVsv5GMpoYwYOmHnplOzCXHvmdlW0i6SrMsB Dl9rw4AtIa6bRwWLim1lQ6EM3PWifPrWSUPrPcw4OLSwFk0CPqC4HYv/7ZnASVkR5EERFF3+ 6iaaVi5OgBd81F1TCvCX2BEyIDRZLJNvX3TOd5FEN+lIrl26xecz876SvcOb5SL5SKg9/rCB ufdPSjojkGFWGziHiFaYhbuI2E+NfWLJtd+ZvWAAV+O0d8vFFSvriy9enJ8kxJwhC0ECbSKF Y+W1eTIhMD3aeAKY90drozWEyHhENf4l/V+Ja5vOnW+gCDQkGt2Y1lJAPPSIqZKvHzGShdh8 DduC0U3xYkfbGAUvbxeepjgzp0uEnBXfPTy09JGpgWbg0w91GyfT/ujKaGd4vxG2Ei+MMNDm S1SMx7wu0evvQ5kT9NPzyq8R2GIhVSiAd2jioGuTjX6AZCFv3ToO53DliFMkVTecLptsXaes uUHgL9dKIfvpm+rNXRn9wAwGjk0X/A== Message-ID: <60893fd2-5b66-9745-94b7-07a5c272d9f6@redhat.com> Date: Fri, 14 Dec 2018 11:36:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <20181205153621.14343-1-vkuznets@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 14 Dec 2018 10:36:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/12/18 16:36, Vitaly Kuznetsov wrote: > Turns out we over-engineered Direct Mode for stimers a bit: unlike > traditional stimers where we may want to try to re-inject the message upon > EOI, Direct Mode stimers just set the irq in APIC and kvm_apic_set_irq() > fails only when APIC is disabled (see APIC_DM_FIXED case in > __apic_accept_irq()). Remove the redundant part. > > Suggested-by: Roman Kagan > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/kvm/hyperv.c | 36 +++--------------------------------- > 1 file changed, 3 insertions(+), 33 deletions(-) > > diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c > index e6a2a085644a..0a16a77e6ac3 100644 > --- a/arch/x86/kvm/hyperv.c > +++ b/arch/x86/kvm/hyperv.c > @@ -56,21 +56,8 @@ static inline int synic_get_sint_vector(u64 sint_value) > static bool synic_has_vector_connected(struct kvm_vcpu_hv_synic *synic, > int vector) > { > - struct kvm_vcpu *vcpu = synic_to_vcpu(synic); > - struct kvm_vcpu_hv *hv_vcpu = vcpu_to_hv_vcpu(vcpu); > - struct kvm_vcpu_hv_stimer *stimer; > int i; > > - for (i = 0; i < ARRAY_SIZE(hv_vcpu->stimer); i++) { > - stimer = &hv_vcpu->stimer[i]; > - if (stimer->config.enable && stimer->config.direct_mode && > - stimer->config.apic_vector == vector) > - return true; > - } > - > - if (vector < HV_SYNIC_FIRST_VALID_VECTOR) > - return false; > - > for (i = 0; i < ARRAY_SIZE(synic->sint); i++) { > if (synic_get_sint_vector(synic_read_sint(synic, i)) == vector) > return true; > @@ -96,14 +83,14 @@ static bool synic_has_vector_auto_eoi(struct kvm_vcpu_hv_synic *synic, > static void synic_update_vector(struct kvm_vcpu_hv_synic *synic, > int vector) > { > + if (vector < HV_SYNIC_FIRST_VALID_VECTOR) > + return; > + > if (synic_has_vector_connected(synic, vector)) > __set_bit(vector, synic->vec_bitmap); > else > __clear_bit(vector, synic->vec_bitmap); > > - if (vector < HV_SYNIC_FIRST_VALID_VECTOR) > - return; > - > if (synic_has_vector_auto_eoi(synic, vector)) > __set_bit(vector, synic->auto_eoi_bitmap); > else > @@ -382,9 +369,7 @@ int kvm_hv_synic_set_irq(struct kvm *kvm, u32 vpidx, u32 sint) > > void kvm_hv_synic_send_eoi(struct kvm_vcpu *vcpu, int vector) > { > - struct kvm_vcpu_hv *hv_vcpu = vcpu_to_hv_vcpu(vcpu); > struct kvm_vcpu_hv_synic *synic = vcpu_to_synic(vcpu); > - struct kvm_vcpu_hv_stimer *stimer; > int i; > > trace_kvm_hv_synic_send_eoi(vcpu->vcpu_id, vector); > @@ -392,14 +377,6 @@ void kvm_hv_synic_send_eoi(struct kvm_vcpu *vcpu, int vector) > for (i = 0; i < ARRAY_SIZE(synic->sint); i++) > if (synic_get_sint_vector(synic_read_sint(synic, i)) == vector) > kvm_hv_notify_acked_sint(vcpu, i); > - > - for (i = 0; i < ARRAY_SIZE(hv_vcpu->stimer); i++) { > - stimer = &hv_vcpu->stimer[i]; > - if (stimer->msg_pending && stimer->config.enable && > - stimer->config.direct_mode && > - stimer->config.apic_vector == vector) > - stimer_mark_pending(stimer, false); > - } > } > > static int kvm_hv_set_sint_gsi(struct kvm *kvm, u32 vpidx, u32 sint, int gsi) > @@ -566,8 +543,6 @@ static int stimer_start(struct kvm_vcpu_hv_stimer *stimer) > static int stimer_set_config(struct kvm_vcpu_hv_stimer *stimer, u64 config, > bool host) > { > - struct kvm_vcpu *vcpu = stimer_to_vcpu(stimer); > - struct kvm_vcpu_hv *hv_vcpu = vcpu_to_hv_vcpu(vcpu); > union hv_stimer_config new_config = {.as_uint64 = config}, > old_config = {.as_uint64 = stimer->config.as_uint64}; > > @@ -580,11 +555,6 @@ static int stimer_set_config(struct kvm_vcpu_hv_stimer *stimer, u64 config, > new_config.enable = 0; > stimer->config.as_uint64 = new_config.as_uint64; > > - if (old_config.direct_mode) > - synic_update_vector(&hv_vcpu->synic, old_config.apic_vector); > - if (new_config.direct_mode) > - synic_update_vector(&hv_vcpu->synic, new_config.apic_vector); > - > stimer_mark_pending(stimer, false); > return 0; > } > Queued, thanks. Paolo