Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5634617rwb; Tue, 22 Nov 2022 02:49:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf56TGZ37w1lfB60+SxCsRIJzFbx4lNBC+ywemnqrJ+WXaLVWmv26fHOo6cWQvAf5usrgpoL X-Received: by 2002:a17:906:a8a:b0:7ae:6cdd:9bc9 with SMTP id y10-20020a1709060a8a00b007ae6cdd9bc9mr18776514ejf.619.1669114177694; Tue, 22 Nov 2022 02:49:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669114177; cv=pass; d=google.com; s=arc-20160816; b=i65lL6SDVrLFRdpiN1ZSdpPjspvA/C2FfEHN5XPuhwsoBmTcfr6UjFUE2bGcCooo/Y cl7PjcCYok1yMxVJvnSI1bmtTed273pcIj4WvjhAgWfpO1b39H2XZ6mgr9O8COBiuT81 gv/6fOTXjiZK+olpW+qodjtjjlGYXFd5xwpw34llySDScOJSGsuaFm9Fgtei/3N408gq hu4kCRff1VP3Xw+4vjzABAo93fi3LrReD+swhUk7c3CvHYLpfi8btWMpSKW9t8bVvAEB 52LPZPKVxBfeK9CagSingHQw+mG6FNkApITLgJSAcpy9FJOrJt6lRuKfc0700uAUSN9w v/dg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=Mg9mPeOJcg7cGmxCIr5JV4h6tv6Y2NZLTzpGlig5vjM=; b=rPL2FLcTF5wUCKQ3JCi8YC4zf7st6cjmpG6v3CZF7givOTFi4ieBucDtxPMOoSUDBc MLY94F725UUJ05r+UPmY3mv6nnEyDAE6DK7YHbxyAi7HqeKjJ9HQPadhnzO2j2bkw3C0 d2b2VtYuK4Q/m29/+j0BDp8j9JxmJbH47kF2ohi6ZdZYsLAH1tv0TrlJ12+jukynuGRZ L6Ujj6NLkvchj/tAVGF+3fbjBvqKPs2gxfWmFdcH5lTgpDgDe6qufBenHsFQMKL/JE56 MItaSnKp5dI/RNhF+7Z6NOd8HLemH3+HVtjCvD/W6ZCmLv/uUIoOdvHr4o5dzcn+VgXS 5aUA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4YAPl4Wj; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d12-20020a170906640c00b00780328a0868si10021689ejm.110.2022.11.22.02.49.08; Tue, 22 Nov 2022 02:49:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4YAPl4Wj; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233056AbiKVKh2 (ORCPT + 99 others); Tue, 22 Nov 2022 05:37:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbiKVKgf (ORCPT ); Tue, 22 Nov 2022 05:36:35 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2045.outbound.protection.outlook.com [40.107.94.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7F7510BE; Tue, 22 Nov 2022 02:32:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BA1OcEdTimeMFM+RPAbpBITkz8Ssx8KwEl83Oqb9i8Z0BTVSAjF3OB74RIAEfBcHQb9+8S8brU791kclY23LYRaXHi4xQfHD40XD0C70v17mhzRK2+8WoDifHmKOaWkbc+cqKM/s/NwPiTS/Z4UEwaOQ7ylNc+CjhBNum0Su66a7u2wOdaFBvDPK43OcE/6fHB7VMKT7zlpSu0DOhsiabntbOLNq4tU3RCWDkYIy/60911N4mvMx28zPLSZqJiSCxVIcVsrOyJmMHYvgogJ0kX4qSOgJRcWxfZFmHPpkYxhucP4gvIqUmMvEF3RGPWdTrr7E+/jrIXOUdu1XMQw7Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Mg9mPeOJcg7cGmxCIr5JV4h6tv6Y2NZLTzpGlig5vjM=; b=dIGsnQ+4RVzeBLt0GCNyGJjWLr+h61zSuPeYoUULVW9dxEnYW4tcImcc1JWpbJok2vB6dx/p43QQ7sIl9QUpQK17hvXG3GP+rMMGOSIstojcAKUSbSUO2n3tCCkbzwlCX5cTYO5qso021picEGMTKXtXaxEnjAsrIRS6X8FN8aFcXp0qfmzZi0MlvtAbzvW1dQ8xz37OV+H5RjnTxVXl98VQJ21WfGOZUbivVwTsneJEw8y11dovCRdjXsm57NUgFOWEsH7Gend+QLWd/XBODMZi9XViYxu3n/PTE3Ce90gvUSx8FLfs/bX/Thk3hhTizg8qS8O0CiNiUqwZChUEog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mg9mPeOJcg7cGmxCIr5JV4h6tv6Y2NZLTzpGlig5vjM=; b=4YAPl4Wjp+PFGVvkdsaKThKoXjPH3ewRmw2ax69t0ESuJdsooAW12Vk7rj3CAKx21Wzfy/q2mFP1WMmXi0JAKHS6lnJbqDLxTXHfcJap6bgriKNTjUopkbadWGVO7tEXhfz865pNRUujTMVWmGwy9oB6AmHHUWCNOwbIov7wgQs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by DS0PR12MB6608.namprd12.prod.outlook.com (2603:10b6:8:d0::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Tue, 22 Nov 2022 10:32:24 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::395:21e6:abfd:7894]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::395:21e6:abfd:7894%6]) with mapi id 15.20.5834.015; Tue, 22 Nov 2022 10:32:24 +0000 Message-ID: Date: Tue, 22 Nov 2022 04:32:18 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: [PATCH Part2 v6 14/49] crypto: ccp: Handle the legacy TMR allocation when SNP is enabled Content-Language: en-US To: Borislav Petkov Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, jroedel@suse.de, thomas.lendacky@amd.com, hpa@zytor.com, ardb@kernel.org, pbonzini@redhat.com, seanjc@google.com, vkuznets@redhat.com, jmattson@google.com, luto@kernel.org, dave.hansen@linux.intel.com, slp@redhat.com, pgonda@google.com, peterz@infradead.org, srinivas.pandruvada@linux.intel.com, rientjes@google.com, dovmurik@linux.ibm.com, tobin@ibm.com, michael.roth@amd.com, vbabka@suse.cz, kirill@shutemov.name, ak@linux.intel.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, alpergun@google.com, dgilbert@redhat.com, jarkko@kernel.org References: <3a51840f6a80c87b39632dc728dbd9b5dd444cd7.1655761627.git.ashish.kalra@amd.com> <380c9748-1c86-4763-ea18-b884280a3b60@amd.com> From: "Kalra, Ashish" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: CH2PR03CA0025.namprd03.prod.outlook.com (2603:10b6:610:59::35) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR12MB2767:EE_|DS0PR12MB6608:EE_ X-MS-Office365-Filtering-Correlation-Id: 43a9754d-ed0a-4099-68e3-08dacc74d7e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lzafT4tKWzI7WTfM3ivuUGLh5utCUwpFzaYAHJ/073NPX6GTbYKqZMCaIWL/fGTEG1ludhgxLY/LhL6WXmQOYQS+WbBJrtrgmOlLJ7qCrIwFO7C2+jIp+YIgvqccYIQZjD3maoImgSY53wg01q9LnxoKUikk7kreToEvUv9g4LvNOF0JOzV18fH5CQEu1AJzTWPd/1RfS9l1OJLHIUZVwqSuZwBV0MgFEt3HS/PgEJ/uPM7vnbYm7EtfFzddBZ+TmWj40lx6gR0Ey7xYj43UQh2vl1q8IGoGow/2Ww5iSqWa9bKk75yP++xQ8TOJYU3i76/nLDVuqznNp8FPAbafwzdIja/IfC1JmIVIT9tfvFk0eZOGX0bcm/c+iTPBlTe84sF01FKCRjvsXqW0Bc4y5NdHBLWtiRnWQw/hK+D/ceVeBvGSRpRcmnawM5TbW+QI0t2jv+7E1we6ygxE4hpCnJeLNS5IQQi9hSvQeyPCaE/lvVZnQdmzuxhbSQc0VGayovRzh8vGCHY7QPLd9e6lhiD2iSmZCo3vBGL2o4Sf01+VI/2GE3jQWJ5BvuCy/GFkY6NqYg/iAUsLqOtSsT9oiV2tV1MMult0cUgb+i3DKWkYabANa4CMCBNe1fGlHUvudBu2MjSQlYAv4aFuGX6tI51TSy9v2v+L3nmDurx9trP7/wDV8YQKgBAsa6J4D86uFlbP9L84iXJvqnlWQdTWju+t3wr8F9d6exsoj5t7H+I= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(136003)(39860400002)(366004)(376002)(396003)(451199015)(31686004)(2906002)(7416002)(7406005)(8936002)(41300700001)(316002)(6916009)(5660300002)(6486002)(478600001)(66556008)(66946007)(66476007)(4326008)(8676002)(36756003)(31696002)(86362001)(186003)(6506007)(26005)(53546011)(6512007)(6666004)(2616005)(83380400001)(38100700002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Q3d4WDlGZytIbVk0MjRnNWhweWV1OFZOUm5ic0xMakN1NXczRkJmZlRBL2h1?= =?utf-8?B?MW84QTZacjAyN3krc3FUMlpEa0ZVTmxzMmdtM2pSaDFkczVPVzV5aWxpRnla?= =?utf-8?B?NTlTWFFBOXNqZ1ducnBkSWVvSi9XRUczN0V6QWE0YlAxQ0lTekhDL1JVdENR?= =?utf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Uza0FJL2xmUEVrUnVteVArRXpSb0k3?= =?utf-8?B?bW15b1FoZ2w3VytTLzNkYkdtSzBGeUp2elo1VVBJZWNBWGpWSlozdXhiTHhr?= =?utf-8?B?azlPN3FWRmE0U2NtWHlnRGZVREQvMys2QTFGTUh4SThJVkt1S0VJV3ZFdWpS?= =?utf-8?Q?CFZDG2VQyIzmwBmC1gERFjwfA?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43a9754d-ed0a-4099-68e3-08dacc74d7e5 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2022 10:32:23.8630 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: g6wsz+cqesjPX2+zjOogOrd728GDzpdJ5Lw00TJ7jzC0XuzyBwpoGpqOAIDiAbH1qFRjeSLOjCmreySotHtimg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6608 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hello Boris, On 11/22/2022 4:17 AM, Borislav Petkov wrote: > On Mon, Nov 21, 2022 at 06:37:18PM -0600, Kalra, Ashish wrote: >> I agree, but these pages are not in the right state to be released back to > > Which pages exactly? > > Some pages' state has really changed underneath or you've given the > wrong range? > >> It might be a user/sev-guest error, but these pages are now unsafe to use. >> So is a kernel panic justified here, instead of not releasing the pages back >> to host and logging errors for the same. > > Ok, there are two cases: > > * kernel error: I guess a big fat warning is the least we can issue > here. Not sure about panic considering this should almost never happen > and a warning would allow for people to catch dumps and debug the issue. > > * firmware error: I don't think you can know that that is really > the case on a production system without additional fw debugging > capabilities. Dumping a warning would be the least we can do here too, > to signal that something's out of the ordinary and so people can look > into it further. Please note that in both cases, these non-reclaimed pages cannot be freed/returned back to the page allocator. Anytime the kernel accesses these pages it will cause a panic or host process crash. So along with warning, the pages will be added to a leaked pages list, but there is no poisoning or anything, only need to ensure that these pages are not touched/accessed again. Thanks, Ashish > > So yeah, a big fat warning is a good start. And then you don't need any > memory poisoning etc gunk. >