Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3215163lqo; Tue, 21 May 2024 09:55:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXs4e4iuC+x2gGJOYyoDp75jAhv95i36gphLzjxpFxDsUeo8VYmxq4J6lTVkqHv56jJoL1ZhujqM65uFsxSKu395q0bAyA+EVfe+R1ImA== X-Google-Smtp-Source: AGHT+IHT3euOiEdMwvJgDmI+dT8eNTfuxeb8FpOLkz4B7ztwPZ2Kch6MoVVpiTAApzLISnH6ludc X-Received: by 2002:a17:906:3551:b0:a53:ed1b:f3ba with SMTP id a640c23a62f3a-a5a2d572c03mr3006581266b.28.1716310557141; Tue, 21 May 2024 09:55:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716310557; cv=pass; d=google.com; s=arc-20160816; b=W4duHoYz/30EzbYbBPdKahhfltmcFOA9EESxrBITO7fZ4tfR4D8okL614aRUJ1AjXI PPfd6M5F0doDxVjUM28QTIp8YgF0uHnj1DQ0XP078PqLulVHH4YskIkzEJg9pNPpOTt1 OSfFTFhTwqZG0uUG1SjdtpzEnt0KDdmJuzC0aNsQK3cP6JUS0mh0i1d6Jff+ohQ4RQ/h wTTLHjDSd3rcspH/G59tSNePvymLcLXZ2OGYn2WVWvGrc170Hj59aZLQxc6v8oHVM1Va +vEX99d+fHLCuc0YXnhGQbn02f5sghYG/C9j0j473qWT+9dVfcuPyAmXvnvTo3IxxBFB dIng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=H+WOIyoRkBFayEEwR1EeFv+13Px+tyGmBKyKL4lnBng=; fh=aJEhQgU5s8/ux4m5dckyou2nOkvKHy1ZucaThCkqSMU=; b=xwuqQlk5SpeuhBjeIkKc38Njg2b0Hl+2GFytoOpqPvfrY/OdHBRW6xBu4MBXKum77r ORFgoAVk1gCmMRORffwn6Gp2Azhh+12NjlTisfuqzZuhjY9wO1UNt0JAjepv7/goCjn7 8/udsQJ+zSLyV4KGr3xhjB+7nW73zLY7nSG7NRxBrnsCjIvj9PeDjH/gF+qwwh1lB2wd mesjTUzNmeOdmX5bWUyZWFWx5pgbORQtiACDVFlb75T/MssR9J9IWbJ5iwK1zhBy9CmF +c57Ws8rcE+eYe+IMzIv3bmwxXgUXbjnMcC73nwjSxuOi8WxTzJXloVMREDsniu9MkcQ TI+Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tb46SCg4; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-185240-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185240-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b21952si1351090766b.334.2024.05.21.09.55.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 09:55:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185240-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tb46SCg4; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-185240-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185240-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 am.mirrors.kernel.org (Postfix) with ESMTPS id D61421F21336 for ; Tue, 21 May 2024 16:55:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29BBE147C92; Tue, 21 May 2024 16:55:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Tb46SCg4" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77A0B3B1A1 for ; Tue, 21 May 2024 16:55:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716310545; cv=none; b=qmFizRN3mU3nN1bK0a5hdQQy3D5/Y3qGlab1PRWv7dUfzAYS06B3abXMt/F5i7rQG93X28epzf6bHud4VJalbKQmXfegwhbQY6M2SKCG6g26vwkcE3ezEWrvn1BKUajWU9eNkzjfs2u6RyeFkfMNDaYx0EsweCqw/+9GGRMHf1k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716310545; c=relaxed/simple; bh=/wuAJC1w5yftMI0o8cg7kslpgnu8UCvser+y8SmYrCw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=gq3MtWNJ1Ee4A/YgnhUplx1u8lxWQJA/I73lIJ753fmc9jspiOKHO5IAazmn8yBLJnVqSiikkYMb8y263RlM2Ow5t7m11qHk5zg33dl3HwHxzkYedMS06yx4rs1XUDYliseLHhqajL/vhkC3mucr2Sq/s+Tk8UyyqQR1AvIflZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Tb46SCg4; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716310541; 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=H+WOIyoRkBFayEEwR1EeFv+13Px+tyGmBKyKL4lnBng=; b=Tb46SCg4N3nbE1eqA6l5Elku4KTd077O5Pk3QlKuba6a2ulJ/k4xUfqCPE7PxHUHd4rYcR riSmem2MVC8cQiRXNVP04FtHzdD8JdHI7tSoVSwkmu1Lx2cCzfTPq2fvvHlhOEEfVcolfO n5h9YXaNj+rgpROh8yqkQBFzC+/pEnM= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-447-2481PuhxPEynbk4nNELqHQ-1; Tue, 21 May 2024 12:55:39 -0400 X-MC-Unique: 2481PuhxPEynbk4nNELqHQ-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-351bf7f7f73so5498024f8f.0 for ; Tue, 21 May 2024 09:55:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716310538; x=1716915338; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H+WOIyoRkBFayEEwR1EeFv+13Px+tyGmBKyKL4lnBng=; b=YocSpxvJKOv7avTupVypZrElvb06fNcNkgVIr6JztQu7rcDimmTn8ul8UQe3v5z54l blIoj0IDhfAgoix6dddf6u8qhYX9uIkSsoSqbST59OUFb5FAGs+nCxjfbrSGiyLbvbKD imRlIUOevo6a+3TwGXSvmLsHiz5rP2tKrXo1aKVLw769T68g+SeGD2EmXYQKP9GBsvgE 2YlXHu9465SrKwIY2EjaLkoTiuHZJb8Q0ULjy4eKN7dLcEnKZXzOidtrmYPs66apnosC x3ryxONIIiDEv2g2gQMHBwv8Dxk/sVyZiIs7+47ENibMylH9ZqUomIyyB/iNYzPnyA0Y aHxg== X-Forwarded-Encrypted: i=1; AJvYcCV1h/CYQ/DHR0Xx6NGXlL3qY+PV4nb+JuQbIRzrqsJLhed6Y9Q8IPAMV6loYY6IyiOez0Uq4lHUtENuvgLHCemjgoL4rQCXZtHpTW0E X-Gm-Message-State: AOJu0YxyNY3wdHfWOZOjBvLnWojbBWtZYRLqtPvJI8+J4Bb0ZbewATx1 3FNPXyXnA5C0+OvyfycqRd0BKqgauy+nbcLXGxGgYrM2XfuibbxxoAhPO/EPiGJ9++cBI3kwWx/ 6lNWp5VOvOYN/Gh8jgTt9wjh3+pfZzF7YQj4UD/13P+/TjzEmVSUp0IL+c2XekkT8TBkn5WVKKW gvS5RES34lBUu9JjbdwMADoXezqN+ym5kzx0fS X-Received: by 2002:adf:f508:0:b0:351:c960:b5af with SMTP id ffacd0b85a97d-351c960b862mr22459233f8f.17.1716310538541; Tue, 21 May 2024 09:55:38 -0700 (PDT) X-Received: by 2002:adf:f508:0:b0:351:c960:b5af with SMTP id ffacd0b85a97d-351c960b862mr22459212f8f.17.1716310538132; Tue, 21 May 2024 09:55:38 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240510211024.556136-1-michael.roth@amd.com> <20240510211024.556136-14-michael.roth@amd.com> <20240516031155.meola5hmlk24qv52@amd.com> In-Reply-To: <20240516031155.meola5hmlk24qv52@amd.com> From: Paolo Bonzini Date: Tue, 21 May 2024 18:55:25 +0200 Message-ID: Subject: Re: [PULL 13/19] KVM: SEV: Implement gmem hook for invalidating private pages To: Michael Roth Cc: Sean Christopherson , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 16, 2024 at 5:12=E2=80=AFAM Michael Roth = wrote: > Longer term if we need something more robust would be to modify the > .free_folio callback path to pass along folio->mapping, or switch to > something else that provides similar functionality. Another approach > might be to set .free_folio dynamically based on the vm_type of the > gmem user when creating the gmem instance. You need to not warn. Testing CC_ATTR_HOST_SEV_SNP is just an optimization. Paolo diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index dc00b89404a2..1c57b4535f15 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -4676,8 +4676,7 @@ void sev_gmem_invalidate(kvm_pfn_t start, kvm_pfn_t e= nd) bool assigned; rc =3D snp_lookup_rmpentry(pfn, &assigned, &rmp_level); - if (WARN_ONCE(rc, "SEV: Failed to retrieve RMP entry for PFN 0x%llx error %d\n", - pfn, rc)) + if (rc) goto next_pfn; if (!assigned) Paolo