From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28D7DC433F5 for ; Wed, 27 Oct 2021 14:41:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1247660F56 for ; Wed, 27 Oct 2021 14:41:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238010AbhJ0OoB (ORCPT ); Wed, 27 Oct 2021 10:44:01 -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-Google-Smtp-Source: ABdhPJwpvrRMvTZfA8g36IWigq/Ddl2lTxPKT07H9cOHEBI6XhDgd4CVWZEorIKgU9/kACcZuDTlgw== 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DDA5C433F5 for ; Wed, 27 Oct 2021 14:41:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3017A60F9B for ; Wed, 27 Oct 2021 14:41:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3017A60F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Sml+2SApV6bcT3DNQTxdxuL/z9oXbzF0HSvBkOnVo8g=; b=DjhPHDzmqTP6HL ClOU9cbiBr7pLczboObJag0A2BlM6ZHcbKPQLiIKya44SbnTeUzJZJDNqoRZWRhokWwC2S07wwEB2 mFGnGhATNB2WxGnaaSDCKckPW+S1yBQcIYfO6mMRGKk671G+Qa0faVKHBOesIoOpc9CmYfb2I++Td 0rxWwH6mN0cEuphkvj6NF+1NXd19M2u+A+8Y1TdBOpx744sX1IhjuCEJGwRTzWtb4fp+srscBCYpS 1SVo1Cb8vlIFlHIHKWFI+5NM8VMOge8hNFRBNmxI2/uIQCDvJoHavuhC9QFjJaQTQIOmsvPp5n+3a o0I1iGPlIuecX01dtCsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfk7h-0059rf-Gf; Wed, 27 Oct 2021 14:41:49 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfk7T-0059nz-DT for linux-riscv@lists.infradead.org; Wed, 27 Oct 2021 14:41:37 +0000 Received: by mail-pl1-x62c.google.com with SMTP id y1so2134920plk.10 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=a7MUAhaqD9hpodenEA/hPeWllA2JCaZ/ziYBRivf4FHzfJyIHe6xDLy+aULUg/i5U6 wGTR3OzLaB8+hPTTYlYDTyKpGnuHujcIRGLK5EXEESjb8xSUGZMILfzabPXeqLHe05W4 hr/vJ2p7zWEXVbY3Rf4MQsaj+biDgS9ovTgwdeVCLjp4UOnh/xnxnqf/cegriXNTOBfd kxrohz1kDJt7yZbGk4kgJFg6464356cYj6P11v0MKbcBjLkFnnCmmyHZbYsSeXMEkUaK xUuF8eLQOsyXGEXDgb23EAFdjtLMSicvUkYcSLTb1z3fBpx7Q5l+Ioj7cPXpxJjBHNDg a97g== X-Gm-Message-State: AOAM533Nm8ztCJ4FT3sryVV6OKYOqca1tZJe4Wodzg39dtfdLpgWPIlN Nx0S12wn+ef/KtLudA2QgGrKBw== X-Google-Smtp-Source: ABdhPJwpvrRMvTZfA8g36IWigq/Ddl2lTxPKT07H9cOHEBI6XhDgd4CVWZEorIKgU9/kACcZuDTlgw== 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-Disposition: inline In-Reply-To: <614858dd-106c-64cc-04bc-f1887b2054d1@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_074135_505609_FF504095 X-CRM114-Status: GOOD ( 14.87 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E11B5C433EF for ; Wed, 27 Oct 2021 14:41:38 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 5C2B3610FC for ; Wed, 27 Oct 2021 14:41:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5C2B3610FC Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id DA7784B1A4; Wed, 27 Oct 2021 10:41:37 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id moL2cAUp9P+q; Wed, 27 Oct 2021 10:41:36 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id D67424B18F; Wed, 27 Oct 2021 10:41:36 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 627684B15A for ; Wed, 27 Oct 2021 10:41:36 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4I5nfxSRmGsr for ; Wed, 27 Oct 2021 10:41:35 -0400 (EDT) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 0F64F4B09C for ; Wed, 27 Oct 2021 10:41:35 -0400 (EDT) Received: by mail-pj1-f41.google.com with SMTP id n11-20020a17090a2bcb00b001a1e7a0a6a6so5349615pje.0 for ; Wed, 27 Oct 2021 07:41:35 -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=MuMctsuDs6JYwhaFsV3GbrrwF4SbBalV8uoogfCyxTMUNsktEZu5sqVszkbw8khBDZ nmXxATDoVZ6z5uNg+oJ91eXl3ccjd9+zO9zrkMfDme4/dEfCEuKvSRaLFwi86NtFmBNr DHb3YDnri27yRrNYPgo7nNoPBqksQJymiNPD+IwEGU25NkyCEqtYmYjnK02aeZKRPKLP X8PXCn1rwvVLBzchYo5DTR8vrZAU+h8QYaDY5CQZtiTvKA7fScB3GX0wEi5z7Hg094xT nTx3NNkMHQYnOt17P0/SczQk66Za1jnXHMKiO0yJtn76UBdB41wn9uEDgq37qubmI4R5 cIAg== X-Gm-Message-State: AOAM531filAC9PKJPA+iE5Z1GSkGaa9YUQlPh2LtQVTcxaX3RS/K4VX9 EmjbFWyhzfngLCk2p3lnJQ8AtQ== X-Google-Smtp-Source: ABdhPJwpvrRMvTZfA8g36IWigq/Ddl2lTxPKT07H9cOHEBI6XhDgd4CVWZEorIKgU9/kACcZuDTlgw== 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 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-Disposition: inline In-Reply-To: <614858dd-106c-64cc-04bc-f1887b2054d1@redhat.com> Cc: Cornelia Huck , Wanpeng Li , kvm@vger.kernel.org, David Hildenbrand , linux-kernel@vger.kernel.org, Paul Mackerras , Atish Patra , linux-riscv@lists.infradead.org, Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, Janosch Frank , Marc Zyngier , Joerg Roedel , Huacai Chen , Christian Borntraeger , Aleksandar Markovic , Albert Ou , kvm-ppc@vger.kernel.org, Paul Walmsley , David Matlack , linux-arm-kernel@lists.infradead.org, Jim Mattson , Anup Patel , linux-mips@vger.kernel.org, Palmer Dabbelt , kvm-riscv@lists.infradead.org, Vitaly Kuznetsov X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu 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. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38F69C433EF for ; Wed, 27 Oct 2021 14:42:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0759160F21 for ; Wed, 27 Oct 2021 14:42:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0759160F21 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=V9N4AiweRF3QWASkzMxElzMsXt7rQg60qvHuE8MU3io=; b=YzCdomJGcpwnby 4RUR7j6dNLDzySkYT1CjnDrzP+zD8MGOR0yz6sRRJbJTSyPSCdRALarfpsLfGfKQQ+zgj9GHerzQS 8lmFipQR1MjdE5T9rnZbJLY2/jNDotzEmMTweXX7szLsYPRrYOfIvHNGHbeg3A/lAi61t/Y/g4NCr lSRkwkbw8fdOtab7MPyYUtDDr7ItTf1ihqJED+wzuSOR/lE/eXoOQqLV96br9Y07Byc+QtSExMr7f 5yEbkF6bqp6n75VR/42UM0s7A3teZKJd0SZD0strHqfqqK0VFXTTs9OeS7Kr126kKxUnrwq/Acc6d pLcS52p3ASXQRZaM5QUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfk7X-0059pj-ES; Wed, 27 Oct 2021 14:41:39 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfk7T-0059nx-Du for linux-arm-kernel@lists.infradead.org; Wed, 27 Oct 2021 14:41:36 +0000 Received: by mail-pj1-x102b.google.com with SMTP id n36-20020a17090a5aa700b0019fa884ab85so5295643pji.5 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=JimVGolYeBbR4CU97g5QK2ENXmXvQFCPpVxKMDJsL/is9S/z5f5QI9fUtyJb4RnvQn ve5J97z868TOdn+lJVedspFjqcSbUt9K9o9qNjSbOPu2iWM1RkUh3ew8uaoA8nf+/yov O3boXxWIzo8VqoEHe4svmxJtrUx3D/h8IOQbIWYi0Esnt2yi+7Kjw3Yc2xwLQdBdysz7 JN3uBrySJLuyg+eUGyD7fhqTL1vdq4pL8UdLW6dN8hwngosu9zu/c0kioEBIO/fUzLdv uEYYeh88OJj9ayQ7/vJfG4WL2FWz5ZGuraGu3JyezxXPyAHxTTaCQmXAJclehyw4rZN8 xxqg== X-Gm-Message-State: AOAM533Q19zCsfXdbo4Df9QeuGjB6fq3Qh4R/OL2RsmsPPPa3GLerfMr 67aAxwInud0enEhxcAOnbD2hBA== X-Google-Smtp-Source: ABdhPJwpvrRMvTZfA8g36IWigq/Ddl2lTxPKT07H9cOHEBI6XhDgd4CVWZEorIKgU9/kACcZuDTlgw== 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-Disposition: inline In-Reply-To: <614858dd-106c-64cc-04bc-f1887b2054d1@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_074135_502636_7189E22F X-CRM114-Status: GOOD ( 16.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel