Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp52839lqg; Fri, 26 Apr 2024 08:32:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZo0jWb+LgjkvLIF/ZL3GYt1OYz5dzEzOboH3PiUQZFfbIF52UQ6KBJ+M6MYAzOEqZfQOxDluwBP8/G0TIN1CO8LoT+8/UUVibAl2JcA== X-Google-Smtp-Source: AGHT+IGG0NIY7GfMHFr9Gwur+vhSQXP3zuhbdSNHVyp/F12Wk+Qaj1fNwKkzSjGbS6ciQT7NHhPr X-Received: by 2002:a05:6a20:1013:b0:1a7:242a:cb69 with SMTP id gs19-20020a056a20101300b001a7242acb69mr3024068pzc.40.1714145571293; Fri, 26 Apr 2024 08:32:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714145571; cv=pass; d=google.com; s=arc-20160816; b=kGKCOMiDxaLWokOoyiN+r64w7SfV9mJx0/JO80n/gCke9B6eY3n3l0W8xm3O96G5Cg jn+ozsRuM99ZQB1d913Qpqegg9wOnINuf4P4t9HBPVYhrs6Tc9IPMeL/Ohqk7MzDBNQS i+jlJH5nlCEppophgO8RsTBniI81LLD0ixnOgG7n9dFRQT4c18Riq58cF6iZmJcRxV5W KkRj80odyMHVn2LnEpWGvL0BuOPc+i+emEvPBNGx3nXDA8qZl1CuOZQS8wGC/KqSFCqo cJ05XX0QRFq2xtHINwt1nQOI6ee8sskFiwA1teGIUyKp0eYty/1zrSRMi01T4+r9zQn4 xvKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=D+UDqDG3emdl+nwdFJP3bYWMhdA98juEbDMYnX+rP1E=; fh=AR3sb/bfOURZU+sWBpoSYkKjZHcVM7Bs3bPlSMnu02w=; b=Apr92mz4rXD9NGuzG+KnLbZdgccrQsDKyNUllJ1TKSArSXclIyDYL/g9bo3WRMqemo r9ynf5/woMFqEq31PeWDWTP4kmzcWC6XF0UfcsKm62VqMvm5Slp6NwRkk7ujwvLCcL6v JL6FyAEK4SSJAivr6s2uqpWQGy9YqZDkaALoNKt4lyHhfTXfZRYgscYK+xVs+pwSZuv+ +PzPx+SlDzXKrOWGxzVa9ttfMDBFlG3KAPWlR0M1A6HoQebY9h0jOWZyzTv8OtnGuKBz BnNmq1LHv5kwOtyuHFfVVtD+gTEhe8TK3GizJX/NZsC4XIEIPfXAvRFwehEP3omAyFT0 12GA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="PJv+/VHk"; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-160284-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l65-20020a633e44000000b005f808ee8efasi12012120pga.809.2024.04.26.08.32.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 08:32:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160284-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="PJv+/VHk"; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-160284-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0FA4D281716 for ; Fri, 26 Apr 2024 15:28:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C41414901A; Fri, 26 Apr 2024 15:28:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PJv+/VHk" Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12569824B3 for ; Fri, 26 Apr 2024 15:28:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145307; cv=none; b=Hq6Lbyu5nRxQnqib8nDxCHh1gZ48gf/0o0KvXLMXHIGPTtfX1QAPqw65tu09d+eAoftxhRLbREieFgWRcjkZBM/+U/FeFzZSVnjfBVtndV1deTkqp4n0A83eWm304MDPWevY7z5ry+vtF944aL/CZGQouhLmIcVOMCStuknZne4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714145307; c=relaxed/simple; bh=4VyWsxlGEIu53oKuIILv9zWJlbPO/mHfes72GPHmjG4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=DmHfyN2dhMPMzmkiuCfwiS53vZ51oZ7QwE/PpOFGHxmjxMmLiF1evKI1D05L6UTRvO/Mejp7LXJM5jCmbkY0f2aDJ/zw6DHPYR0r2fJb2L0r2a+nIWnfgc45V1WXtcPLUh8rYbn4XOBT7Ww2B76n+zDiXyZJZGlYv1Wxkf3erws= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=PJv+/VHk; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-1eb1471c7dbso5511015ad.1 for ; Fri, 26 Apr 2024 08:28:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714145305; x=1714750105; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=D+UDqDG3emdl+nwdFJP3bYWMhdA98juEbDMYnX+rP1E=; b=PJv+/VHk4jnQZImQ0D+scqckc/10xbjLetAvmjZrZ0y+lZ+HZWkNuTMDdJB91clNTz ndj7QlYwg4o7ZQPXtDchSF2+0x5l113ZV7g5G9+w2k9YxjdM+XAJNiVMZSZWaXSAmcJa FaCPyn1IUfA6dPEPMbW65EXH3A2cMrrbkGIgFqbW2FQY037IVrwI6e2PxFs+NWl7Odt/ DUO/W/MI8RNlcgmwITnLcJj54YmUPmkhOF8R4bZeBYRF6JDSrrFBa7tOfaH7parJZSN/ ReR1JRA/KhuyOEr6NOthWdcKXp7vi5AIDcWPfYAvvnwYx/nMduieh4qHeVGqIZkcgSKS gCow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714145305; x=1714750105; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=D+UDqDG3emdl+nwdFJP3bYWMhdA98juEbDMYnX+rP1E=; b=Q8CLJUkIcNMji1WZ99NQgQiLRYFIFywP0LBpZMJfY1IzndibNmyfHbI1WvKTRmMIYG KK0Bi+SmY+tn2NofgrX49bsbj0ceXhqULVzw3HPfNaA2z60kayWxbkADEbwR3+IFNTK7 LZoz2MvUYAysMFfN40h+JozDBLtxRezeT0Ej1Ra7/2KDrez1IKkj99sJuMopevsc0agf Cvi+w0iDK40O5McaWr3zmIIRtiNC/DnivKvLwyZIhJE7IrLANI1QSAbtWtyJuHyRRIMc tyGct21RbYHOZnhQ/5aKxXfpeLKMzby7PjPWrxR55rqXJEipt36YmoDVcQITCDvgZEyX +l/w== X-Forwarded-Encrypted: i=1; AJvYcCUbHmIs4L4hBNJJreFVfrCa6FWjlLkcFT+HkKlkKB8tdmnToYo8g0roqChryvTUyBgEchLPnV+N/CXYeWrrsi4nh8dGsg9gO410+nDv X-Gm-Message-State: AOJu0Yxr59b/qIOINMNhKrBEdZ0m/KeWvnSW1vWtk9wMjpjvcTjCRlBS AK5DNc+CHPE8Xghh0WpGZjjPiun1+Pw4Q8yHmEqEyBz92kt+faCIKrP+3jNq+5jPAkdNmi4+I/Y reA== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:903:41c2:b0:1e6:624c:f1b8 with SMTP id u2-20020a17090341c200b001e6624cf1b8mr815ple.0.1714145305134; Fri, 26 Apr 2024 08:28:25 -0700 (PDT) Date: Fri, 26 Apr 2024 08:28:23 -0700 In-Reply-To: <970c8891af05d0cb3ccb6eab2d67a7def3d45f74.camel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <2daf03ae-6b5a-44ae-806e-76d09fb5273b@linux.intel.com> <20240313171428.GK935089@ls.amr.corp.intel.com> <52bc2c174c06f94a44e3b8b455c0830be9965cdf.camel@intel.com> <1d1da229d4bd56acabafd2087a5fabca9f48c6fc.camel@intel.com> <20240319215015.GA1994522@ls.amr.corp.intel.com> <970c8891af05d0cb3ccb6eab2d67a7def3d45f74.camel@intel.com> Message-ID: Subject: Re: [PATCH v19 011/130] KVM: Add new members to struct kvm_gfn_range to operate on From: Sean Christopherson To: Rick P Edgecombe Cc: "tabba@google.com" , Isaku Yamahata , Tina Zhang , Kai Huang , "binbin.wu@linux.intel.com" , Bo2 Chen , "sagis@google.com" , "isaku.yamahata@linux.intel.com" , "isaku.yamahata@gmail.com" , Erdem Aktas , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , Hang Yuan , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="us-ascii" On Fri, Apr 26, 2024, Rick P Edgecombe wrote: > On Fri, 2024-04-26 at 08:39 +0100, Fuad Tabba wrote: > > > I'm fine with those names. Anyway, I'm fine with wither way, two bools or > > > enum. > > > > I don't have a strong opinion, but I'd brought it up in a previous > > patch series. I think that having two bools to encode three states is > > less intuitive and potentially more bug prone, more so than the naming > > itself (i.e., _only): Hmm, yeah, I buy that argument. We could even harded further by poisoning '0' to force KVM to explicitly. Aha! And maybe use a bitmap? enum { BUGGY_KVM_INVALIDATION = 0, PROCESS_SHARED = BIT(0), PROCESS_PRIVATE = BIT(1), PROCESS_PRIVATE_AND_SHARED = PROCESS_SHARED | PROCESS_PRIVATE, }; > > https://lore.kernel.org/all/ZUO1Giju0GkUdF0o@google.com/ > > Currently in our internal branch we switched to: > exclude_private > exclude_shared > > It came together bettter in the code that uses it. If the choice is between an enum and exclude_*, I would strongly prefer the enum. Using exclude_* results in inverted polarity for the code that triggers invalidations. > But I started to wonder if we actually really need exclude_shared. For TDX > zapping private memory has to be done with more care, because it cannot be re- > populated without guest coordination. But for shared memory if we are zapping a > range that includes both private and shared memory, I don't think it should hurt > to zap the shared memory. Hell no, I am not risking taking on more baggage in KVM where userspace or some other subsystem comes to rely on KVM spuriously zapping SPTEs in response to an unrelated userspace action.