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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6157BC4332F for ; Wed, 11 May 2022 09:07:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D8406B0073; Wed, 11 May 2022 05:07:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 786966B0075; Wed, 11 May 2022 05:07:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64E446B0078; Wed, 11 May 2022 05:07:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 561D56B0073 for ; Wed, 11 May 2022 05:07:20 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 284C3203F for ; Wed, 11 May 2022 09:07:20 +0000 (UTC) X-FDA: 79452883440.06.AB96090 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf02.hostedemail.com (Postfix) with ESMTP id 24105800AE for ; Wed, 11 May 2022 09:07:05 +0000 (UTC) Received: from zn.tnic (p5de8eeb4.dip0.t-ipconnect.de [93.232.238.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 34D2C1EC053F; Wed, 11 May 2022 11:07:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1652260025; 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:in-reply-to:in-reply-to: references:references; bh=L16i6BF0FXuXjMhQ9rYFWCKSc1fETQHwnQIemH2KAqE=; b=rAaK1zqfEck/5icveUj2Kh7QRdsXXRN8aV1/Cia8BRr8YqrY4hzYFaUyQX7oM6KII2VXom 1fD0b5W1NSwWtaxJyhh76lABcEHPDCic2ga6FZ+pEK/6wQ7TTKNMBvYZBvI457v8gj4CGI Ey6/R6Af0dbOKhS8N/wYlrD1OGi55uI= Date: Wed, 11 May 2022 11:07:08 +0200 From: Borislav Petkov To: "Kirill A. Shutemov" Cc: "Kirill A. Shutemov" , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Dave Hansen , Brijesh Singh , Mike Rapoport , David Hildenbrand , x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv5 08/12] x86/mm: Provide helpers for unaccepted memory Message-ID: References: <20220425033934.68551-1-kirill.shutemov@linux.intel.com> <20220425033934.68551-9-kirill.shutemov@linux.intel.com> <20220506161359.4j5j5fxrw53fdbyr@box.shutemov.name> <20220511011535.or73rm6oviwa5niy@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220511011535.or73rm6oviwa5niy@box.shutemov.name> X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 24105800AE X-Stat-Signature: mfp49sjxciz438nkhduxija4q1n74bja X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=alien8.de header.s=dkim header.b=rAaK1zqf; spf=pass (imf02.hostedemail.com: domain of bp@alien8.de designates 5.9.137.197 as permitted sender) smtp.mailfrom=bp@alien8.de; dmarc=temperror reason="query timed out" header.from=alien8.de (policy=temperror) X-HE-Tag: 1652260025-127062 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, May 11, 2022 at 04:15:35AM +0300, Kirill A. Shutemov wrote: > Okay. Fair enough. I will change it to > > panic("Cannot accept memory: unknown platform."); So I haven't went all the way in the patchset but what I see is: /* Platform-specific memory-acceptance call goes here */ if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) { tdx_accept_memory(range_start * PMD_SIZE, range_end * PMD_SIZE); } else { panic("Cannot accept memory"); } so how would you decide for some other platform that it should panic? TDX should panic, that I get. But you can just as well WARN_ONCE() here so that it gets fixed. Panicking is counterproductive. > It checks if the range of memory requires accept_memory() call before it > can be accessed. > > If any part of the range is not accepted, the call is required. > accept_memory() knows what exactly has to be done. Note that > accept_memory() call is harmless for any valid memory range. > It can be called on already accepted memory. Aaah, so that's what I was missing. So this function definitely needs a comment ontop of it. And a name change to something like range_contains_unaccepted_memory() or so to actually state what it does. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette