Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2522198iof; Wed, 8 Jun 2022 06:47:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysWIEmtZmmiBLZcoLN4ywSKZHJ/Mlrwav1jD94L6X2oAp3tuvVRESyZOHU1T8eT3eNSx28 X-Received: by 2002:a17:902:f254:b0:164:1078:2c28 with SMTP id j20-20020a170902f25400b0016410782c28mr34092591plc.64.1654696035119; Wed, 08 Jun 2022 06:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654696035; cv=none; d=google.com; s=arc-20160816; b=NDUYAMnhTgxHDknl71Yj6snPigiLjyRUS+qfKym1UpwuGIbWbPaxqM5s6V9nOj0L87 7o2ZT2TLJJbnQfEe/BVp0qhp27XN6VJyGEstErVKCLfCqVWTCIWYyWuHHItJRGWS9jVH u0NVgfJz8746id/Rzjr9E+J1etkY0Gl6Ed8jwyD7RP+eWwjXetLB8zqTqJ8GXcw+np6m t2/AQuO4Rj6i4TBFBV1GDtipBV4ttdLJ8KRifomR3HP5HvK1rRuhAttpXQfCJo1UFYIU 6ZR7ZP4PyhD8JrHF2BGSVZ3XjYkwg+dlBXerGQIntq5ryctK/iY4MLKdWixRsPkHHuQ4 sI1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=SkCtRFwTpix6cqqR0vaJf3gcR2UPvZl1kedDkrrQHQk=; b=Ye0MhKqrP+sIt+wYM/2Z3SF+CIDxWxf3EolwZDsFypMHIH0ZtK2IxrZMOiVyznV8ob 3JjwMZwoINR68ZfEn6tw4bXbp8I1Bleuw0FcF2LNcTIohIDyLfmTxFMlIu4BlcxYGDKI Mo4XwjTbZBM904EP4FtA5rD9qTXMT3+uTAlwP+wWsKCcG5S9awUi5OpkAPfZoZxMaJ8g jppC5iBfO0WXW1jZ2mZp4ubMzHldfXo6BJq25HrgGc/RMQir92aTT8D+HaBfBJNS7e9M o96k/dNbQtFlLgVNr4kO5ZE/Zjw5Xj/qDSs+/Qtcwzy3QKyA/j/8crRSb6i9GJ368Da+ jb2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VSiXTQm3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k8-20020a056a00168800b00518d5ac69a1si31499792pfc.216.2022.06.08.06.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 06:47:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VSiXTQm3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 158094DF69; Wed, 8 Jun 2022 06:22:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240069AbiFHNVz (ORCPT + 99 others); Wed, 8 Jun 2022 09:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239983AbiFHNVy (ORCPT ); Wed, 8 Jun 2022 09:21:54 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D800C1C113 for ; Wed, 8 Jun 2022 06:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654694513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SkCtRFwTpix6cqqR0vaJf3gcR2UPvZl1kedDkrrQHQk=; b=VSiXTQm3e6DudFLvYkpft7tiTUPk5DFy64mwYBkw9h6q4EZ19z1kTFhj1IFBGSXt1U9DLs Sty1JRLGF9skdmi2eeu6RdOghzHuV86s+hWPsFyu1USDpuTEXWfXR4nPmg99043NG0ytHb zuOymXZGKnzrBW+8LunVXuQdAF/NHbE= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-464-q1k0C7_FMBWyjBaIn2z_4g-1; Wed, 08 Jun 2022 09:21:47 -0400 X-MC-Unique: q1k0C7_FMBWyjBaIn2z_4g-1 Received: by mail-wm1-f69.google.com with SMTP id p42-20020a05600c1daa00b0039c62488f7eso1107162wms.7 for ; Wed, 08 Jun 2022 06:21:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=SkCtRFwTpix6cqqR0vaJf3gcR2UPvZl1kedDkrrQHQk=; b=5YN9fLwt2VgbOiYRUSV9SpH/knB5YzQAjCB2c+Qg+8HZfuMLRGXEBSRGk0oF9bn4Yi V0YuktjXn5QuFNMwvDg0BVjFwiTBp3sizatYaHX2UlWH//dcA+PUX4OqYkSKFj0N6riL JtdBcMuBw1VYoru6fiTNKnGmyXeAR7ojNaYJSkzv09k2AJ9vEyE3/NoA84sLY9d7GD69 FDgNK+ZCpgAU8QT1v3nX0ZxIn3/DWwYny5wGwsjz3GYnQsiqmesG/NOJ0ENn4mHsgPyw ckwqEHSHqTdD0b61J+bTDWuFCxVKoajDnlX7z+2u6AS1E0MQ+zZ1EDLc6QDGJBTX1TAw 752Q== X-Gm-Message-State: AOAM5337SRGllO9fkTpMIDe/HowL0VG1DuU0t6rUnNMwZYB/11nKlpfH zFbFhGvhyCd3f+XYEyYZSgkDBQ/XJr5d2GWcIP6lmt9BhT4TUuI0mInQqVSQLJzNxuYS2AfGso8 H+tMWnNW4wQ7mXAdIJe2sclIF X-Received: by 2002:adf:f20d:0:b0:214:c726:ce76 with SMTP id p13-20020adff20d000000b00214c726ce76mr26699118wro.649.1654694506287; Wed, 08 Jun 2022 06:21:46 -0700 (PDT) X-Received: by 2002:adf:f20d:0:b0:214:c726:ce76 with SMTP id p13-20020adff20d000000b00214c726ce76mr26699096wro.649.1654694506013; Wed, 08 Jun 2022 06:21:46 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:9af8:e5f5:7516:fa89? ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.googlemail.com with ESMTPSA id c14-20020adffb0e000000b00213465d202esm18742388wrr.46.2022.06.08.06.21.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jun 2022 06:21:45 -0700 (PDT) Message-ID: Date: Wed, 8 Jun 2022 15:21:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 4/7] KVM: x86: SVM: fix avic_kick_target_vcpus_fast Content-Language: en-US To: Maxim Levitsky , kvm@vger.kernel.org Cc: Wanpeng Li , Vitaly Kuznetsov , Sean Christopherson , Jim Mattson , "H. Peter Anvin" , Joerg Roedel , Dave Hansen , Ingo Molnar , Suravee Suthikulpanit , linux-kernel@vger.kernel.org, Thomas Gleixner , x86@kernel.org, Borislav Petkov , stable@vger.kernel.org References: <20220606180829.102503-1-mlevitsk@redhat.com> <20220606180829.102503-5-mlevitsk@redhat.com> From: Paolo Bonzini In-Reply-To: <20220606180829.102503-5-mlevitsk@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/6/22 20:08, Maxim Levitsky wrote: > There are two issues in avic_kick_target_vcpus_fast > > 1. It is legal to issue an IPI request with APIC_DEST_NOSHORT > and a physical destination of 0xFF (or 0xFFFFFFFF in case of x2apic), > which must be treated as a broadcast destination. > > Fix this by explicitly checking for it. > Also don’t use ‘index’ in this case as it gives no new information. > > 2. It is legal to issue a logical IPI request to more than one target. > Index field only provides index in physical id table of first > such target and therefore can't be used before we are sure > that only a single target was addressed. > > Instead, parse the ICRL/ICRH, double check that a unicast interrupt > was requested, and use that info to figure out the physical id > of the target vCPU. > At that point there is no need to use the index field as well. > > > In addition to fixing the above issues, also skip the call to > kvm_apic_match_dest. > > It is possible to do this now, because now as long as AVIC is not > inhibited, it is guaranteed that none of the vCPUs changed their > apic id from its default value. > > > This fixes boot of windows guest with AVIC enabled because it uses > IPI with 0xFF destination and no destination shorthand. > > Fixes: 7223fd2d5338 ("KVM: SVM: Use target APIC ID to complete AVIC IRQs when possible") > Cc: stable@vger.kernel.org > > Signed-off-by: Maxim Levitsky Is it possible to use kvm_intr_is_single_vcpu_fast, or am I missing something? Series queued, thanks. Paolo