Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1707651pxb; Thu, 28 Oct 2021 08:37:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXDv//8PHEbJAOe/9DqaS5We1jARwDPLwxoF0d9XbSvcXtxkDKtVi6vFCr0RFrl9dOhE1G X-Received: by 2002:a17:90b:1d92:: with SMTP id pf18mr13603540pjb.38.1635435424314; Thu, 28 Oct 2021 08:37:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635435424; cv=none; d=google.com; s=arc-20160816; b=IrIQAsx+10HijyJ6CE6p+ty1G41Gh2UmQkNBLbzoverJtIi7cholqQYZzxVOieqnyd qJuCG7WD6shhUavnlByjeE4EM1xRsQUKcJh+9FYa3UVNP3WaVnUA1n7McgJCMdnCwz34 cXNj55ThP2AsAzevkwcdAVu3l2FuLf8/l5HMvIrw72b5M/Jb+nj9Pba7z3ipBUdb6mOL DHbCVBLjnewTr0uC//ekU79I3v2CHRffdQ6hSCFrkblJlL7DtVZ/gl1XMhEPHtultuOK 3ZM3Kjm4ge3ng6d1XUhj4a6tG3M63bCxVaei/5mDQ5p+xReNGZPafzUYUiD+OgBVBjDR sduA== 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=ObU0mLn8cgLGt35bHM9Ve7PBUotjGGEWKnNtAqnV8Y0=; b=Lio/fJLyEGWQFjysk6PUKDb+BqcHAvWDeq4pjBWhAePOFklNVm/H0vSAgdzbK0QJat al44wYn2dANjXvcOaxC4B3ScvJlbZHb2bLK4jqC0S0geItKEmqR0Zy9toWNS6/2myheH 4yJVKP0Jzw5lllwKojVt9oizTHvg7FHyHe3XxkBekqRvyn0vZNxZFuk3Jlez9F4hqIJS D5BhxJNNqmpXZUWOhHj92HAddb5D+/L2liX5OBfElIpzcYtTC1rxyB2ONNs6ke8c745j /9EXrdBDSZsN2c2EDWL8aTUNkwNQBR0rZTsHdyzPM+jHYVqqbGpWeym0EnUaAdQdIYod VX7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Dh2oRVWq; 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 i3si4422405plr.144.2021.10.28.08.36.49; Thu, 28 Oct 2021 08:37:04 -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=Dh2oRVWq; 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 S230170AbhJ1Pgx (ORCPT + 99 others); Thu, 28 Oct 2021 11:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbhJ1Pgx (ORCPT ); Thu, 28 Oct 2021 11:36:53 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FC32C061767 for ; Thu, 28 Oct 2021 08:34:26 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id g184so6734399pgc.6 for ; Thu, 28 Oct 2021 08:34:26 -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=ObU0mLn8cgLGt35bHM9Ve7PBUotjGGEWKnNtAqnV8Y0=; b=Dh2oRVWq7FNB4VxeeBx+DY+B7J6W36/D0YFmfA4JinPWULNj2JAyVIdGN5W95l+d90 4Uu/ZwJdWUivmqUAxVTynE14t1JCgr4B8VIlvCnfQRBjV/9sZBN9FbtVQViBrcsIkfKk FKX6ULIrvBdeMPobrWIP7p55k83rg/EH2wU4GD4W9e2j7rIISQUbKASJH6T77kFM7m0Z Qtlmy8wjfeMDEMJrWpV2K5PFqGDN6VxYLPZtUxrtHEs4QyogxcvUebO7UVfiBHutG04k U0NkfKu6Je8Pt6shzy+xbyjZteg84KZAIk3v/fR91ZfKR/MAff+MA9k1aMrDIiCOqEqs s/bw== 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=ObU0mLn8cgLGt35bHM9Ve7PBUotjGGEWKnNtAqnV8Y0=; b=cGatOcopayXA43Uhhddtl8SJsQNveDBfdGh7JeI7z8quJHl3vPYL8Fy+Hu6/ZYsRU0 qdJJe59gxgqclXQPAydhpFiG5VQUMn5dCVfcswMCGSoulXfbwIR5vWHliBTlRxYn4SlR RZLi5n9gStI9zpmKO6f+ja7MPsWY2O1TUzby/Wh4frBWRCeNajdil4jEHh1hNqYA03LM wOdDcxQKaolH365unGTLUUJPEPgIjtYuYv7aFrEdqhIw8/luCTYrDwRDLsOoPxUS5UZJ 9ikhSdaZxBSjjKdlwt2BG+NO4/x09pt2SSLFpHvSa4c2+ya8HK2v1Qz3L8Y/SYkiZNdE RL2w== X-Gm-Message-State: AOAM530RR9DBIrw2jqyywwVe2o5v3UA+OBbhkwo6M1aOHJqWpZFJ5BQ2 89HLNCwt//r5fvF5jnWdjsEggw== X-Received: by 2002:aa7:9427:0:b0:47c:3b8e:5253 with SMTP id y7-20020aa79427000000b0047c3b8e5253mr5166508pfo.69.1635435265242; Thu, 28 Oct 2021 08:34:25 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id p12sm4586055pfh.52.2021.10.28.08.34.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 08:34:24 -0700 (PDT) Date: Thu, 28 Oct 2021 15:34:21 +0000 From: Sean Christopherson To: Maxim Levitsky Cc: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini , 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 21/43] KVM: VMX: Clean up PI pre/post-block WARNs Message-ID: References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-22-seanjc@google.com> <6b2bdfad87e268e861b6cc331d25790dade8e27b.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6b2bdfad87e268e861b6cc331d25790dade8e27b.camel@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 28, 2021, Maxim Levitsky wrote: > On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > > Move the WARN sanity checks out of the PI descriptor update loop so as > > not to spam the kernel log if the condition is violated and the update > > takes multiple attempts due to another writer. This also eliminates a > > few extra uops from the retry path. > > > > Technically not checking every attempt could mean KVM will now fail to > > WARN in a scenario that would have failed before, but any such failure > > would be inherently racy as some other agent (CPU or device) would have > > to concurrent modify the PI descriptor. ... > Don't know for sure if this is desired. I'll would just use WARN_ON_ONCE instead > if the warning spams the log. > > If there is a race I would rather want to catch it even if rare. Paolo had similar concerns[*]. I copied the most relevant part of the discussion below, let me know if you object to the outcome. Thanks for the reviews! [*] https://lore.kernel.org/all/YXllGfrjPX1pVUx6@google.com/T/#u On Wed, Oct 27, 2021 at 8:38 AM Paolo Bonzini wrote: > On 27/10/21 17:28, Sean Christopherson wrote: > > On Wed, Oct 27, 2021, Paolo Bonzini wrote: > > > On 27/10/21 16:41, Sean Christopherson wrote: > > > > 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). > > > > > > Yeah, I can agree with that. Can you add it in a comment above the cmpxchg > > > loop, it can be as simple as > > > > > > /* The processor can set ON concurrently. */ > > > > > > when you respin patch 21 and the rest of the series? > > > > I can definitely add a comment, but I think that comment is incorrect. > > It's completely backwards indeed. I first had "the hardware" and then > shut down my brain for a second to replace it. > > > So something like this? > > > > /* ON can be set concurrently by a different vCPU or by hardware. */ > > Yes, of course.