Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp885017pxb; Wed, 27 Oct 2021 14:27:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNLKHmiZrpUWIk91ntJpPrJIAGY3as4EzklWKB2C1HC8lmz74PdfWlNf0j8NiVEWK90o66 X-Received: by 2002:a05:6a00:140c:b0:447:96be:2ade with SMTP id l12-20020a056a00140c00b0044796be2ademr85068pfu.26.1635370045310; Wed, 27 Oct 2021 14:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370045; cv=none; d=google.com; s=arc-20160816; b=jHpo5IpOn/cfoHO34g7L/WNYwG/XAVgrgH7kVSLvyKHQNhOYX854OzTIrC4L9if1HL 8BFZpL+PTaO5fmJK6ovLj8jkbYbE4AzQ60Dr+QhIKiRc489mIOQQkXmHcaiOwdPKkEBg CLQFUaluXaRr2AFGHpXhKRIoV2IIrZJhDlhHJK3afafnhzo49ZkrcKOR7I53OYjyOp7D 8EkkSwu4/jhaomqcn+zZMk8fRNMbuz/bmpHAt40lYvVhVUl8L0YDyDx4lyqx+3KWpSmw 4AzIuzlZsC/PTtArETM9DFvao8kvOIBRsdz/RCCTdTD+9dCC4bMw8n9tflxL6LWQQEUl Dgqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6OXSnlnR0rRr4zd42xResiJ3HjI4vG4520z7JUuMyYs=; b=E9GL7wVsbcN2fbQP3redoqPFWLHmvkIl+Q/l61tnWH/veNHUiNSM+XQkNDNTKEaioo 42sYtF15F3V4DSxscOW1i7NvlDC0NWmytQzwV6sIDefHXg9yBu6FkstJVef6RnP1e5LP 2eLWA+KDpK9F19mqPzlqSbSqb0ePTQrQHBPpaXO1ltZKTbsmGde+8KPewVzJs+0pYYlS PLkgvR08LZ7pMpa2is8Uqbx4IdW6eQP3jo6h6rI9adLC4UV6kECePHOFxr6FtDHtAy8P hCJ9mnwb7rEW9aRM/1IH9ux8Ea2oaJm3drKFH3rvvIrxtATKR0rDAXssYCfReXKT1f5e tfzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=BjRC0MDF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x1si1330185pgr.287.2021.10.27.14.27.12; Wed, 27 Oct 2021 14:27:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=BjRC0MDF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239006AbhJ0OoA (ORCPT + 97 others); Wed, 27 Oct 2021 10:44:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237854AbhJ0On7 (ORCPT ); Wed, 27 Oct 2021 10:43:59 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 903AAC061745 for ; Wed, 27 Oct 2021 07:41:34 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id y1-20020a17090a134100b001a27a7e9c8dso4928661pjf.3 for ; Wed, 27 Oct 2021 07:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=6OXSnlnR0rRr4zd42xResiJ3HjI4vG4520z7JUuMyYs=; b=BjRC0MDFBU5q9E3Xn8qZmMldFXyvZ//eySha9xAzB0jmoDoGvnBh5rZJNDCpSwdREy 9EoAYcD7qkeaNtvcOM9mdpbf0o5Zx8GfPrl52oPVsVupbvte1MAYXeh2gVgPvsjmKTcr OvG3N8s6IdOwoiORDWmu79MSfTC8tCdjVwsKVWNIZ01jMG+JmYVN7Tn36JxeYZuyLkmP l/68I6qwCJelKOJxW8ZO7A5e+myyHTZHJETfMvox2BFMDLmdkBWjqGYYnYuVXEvP/t+D dTunWvGIgVZuDjHHD1Ty/XEe2DuBSz3CLrLeXdA9pKLBh6KsJK0Pre9s46e4k0Dr+ooy 7X+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=6OXSnlnR0rRr4zd42xResiJ3HjI4vG4520z7JUuMyYs=; b=VVoOV7RO6/K3h9hqHC3NjSSVjUdv+n+WiLrhc2vVUNEW4+DHhaqlyXTsW4rvYNru4i cR3D7gEXNpJPd/LTq/nGqw+3DZZd1w2m5oH63EoNA/lXNHkkWfcQqyBLU4Kq5KITJnep ixd5OPFKV9JP4dAULipa6JOyibz9CzttaOH0abXG2lEYt6VsRrAZWJiPSJDwuqipgIW/ FOUHbG7QsNGFRNGr7xdAXevnQ0wvV+mIOVWiDMbUjeb9J2nQrdqDJB2wcFUhLaMEgxwz D0Eo4fSCnY27plCsUhz2M5FmQUGvBz64oJaPoN5CgdhNbEp+7KjFLy82A6P6CgkLAnPP JEEg== X-Gm-Message-State: AOAM533HZbN7v/uAfG32mLjRP/qlBI97YMFdRmYqBpt7VSutW4Majnrd cseJz8Y6WawVbd4o6k3GJY9yKQ== X-Received: by 2002:a17:902:e812:b0:13f:3be8:b15a with SMTP id u18-20020a170902e81200b0013f3be8b15amr27601253plg.49.1635345693861; Wed, 27 Oct 2021 07:41:33 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id e9sm203521pfv.189.2021.10.27.07.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 07:41:33 -0700 (PDT) Date: Wed, 27 Oct 2021 14:41:29 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , Oliver Upton , Jing Zhang Subject: Re: [PATCH v2 00/43] KVM: Halt-polling and x86 APICv overhaul Message-ID: References: <20211009021236.4122790-1-seanjc@google.com> <614858dd-106c-64cc-04bc-f1887b2054d1@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <614858dd-106c-64cc-04bc-f1887b2054d1@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 25, 2021, Paolo Bonzini wrote: > On 09/10/21 04:11, Sean Christopherson wrote: > Queued 1-20 and 22-28. Initially I skipped 21 because I didn't receive it, > but I have to think more about whether I agree with it. https://lkml.kernel.org/r/20211009021236.4122790-22-seanjc@google.com > In reality the CMPXCHG loops can really fail just once, because they only > race with the processor setting ON=1. But if the warnings were to trigger > at all, it would mean that something iffy is happening in the > pi_desc->control state machine, and having the check on every iteration is > (very marginally) more effective. Yeah, the "very marginally" caveat is essentially my argument. The WARNs are really there to ensure that the vCPU itself did the correct setup/clean before and after blocking. Because IRQs are disabled, a failure on iteration>0 but not iteration=0 would mean that a different CPU or a device modified the PI descriptor. If that happens, (a) something is wildly wrong and (b) as you noted, the odds of the WARN firing in the tiny window between iteration=0 and iteration=1 are really, really low. The other thing I don't like about having the WARN in the loop is that it suggests that something other than the vCPU can modify the NDST and SN fields, which is wrong and confusing (for me). The WARNs in the loops made more sense when the loops ran with IRQs enabled prior to commit 8b306e2f3c41 ("KVM: VMX: avoid double list add with VT-d posted interrupts"). Then it would be at least plausible that a vCPU could mess up its own descriptor while being scheduled out/in.