Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6759485iob; Wed, 11 May 2022 04:56:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/gsnaAP03ebFaQH67Ooqkw6Luzo7OJh2UdmGPlmwSkeOqjEE8YSzjEjvaKuU2eFDnY/lX X-Received: by 2002:a05:6402:3456:b0:425:ab60:1b00 with SMTP id l22-20020a056402345600b00425ab601b00mr28812185edc.71.1652270175451; Wed, 11 May 2022 04:56:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652270175; cv=none; d=google.com; s=arc-20160816; b=gcO04qEbSPaReLYyq81Pke1ledN+mborMnOH/r0GeJO4wnSagMUsF0ABtPYKdH19d1 Rq1hhjOzGD9UmCiftypWtH++UKd7icIzcU1h2HLxQzluHAAoERUxlREQI3ZU1JH5+AwC cTTgtshKrkJ5K3hZIcKTKsYIlQK7V5X3WEdbOtRbXp2udckHq97pDJmy81LTl8RkQzfQ 5Ge+kATO/On6Ccc7+8WTwRbbJYVrTXPv/tI5zDnN5hFddtPMePZtz22J8kgXxYNhAQBz tSfN7ubE0BeUDsc+ruiAmer4UsNCsbFSq4e8yDMmKFX17dsEHqN+ezIyGqgcZM2clYyY ctRg== 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=L16i6BF0FXuXjMhQ9rYFWCKSc1fETQHwnQIemH2KAqE=; b=Q8ZeQrEUIrJaGe/0cwzEXAZzYEQEARasOlrCIFs6qorTw5Yom2tv9Gt5BxxfGhEDSa EUdBra5IyUpKT+vgwkRzYwAbsFH8xhijHsVG8nkGAshr2rRKKF14NbMozSy7IgjLD0db LvEOEZ9U/H+S45dYUtOB144wioC0Q73dyZ0KndpgdW8wUiUXDHSPUgfOxrThY5FjBYuN +Cv5lUuJU298mq/v9DiwkBiobiRQ8wwNJMdCR2mYjQV3y310r+fMaphwVPQl4YAB/SiR RK2FxKeXq4KHC7NEYdMvswwT6N5GJ4hgzPeTK/OfOlSE4tsuo1/lRe+4j4qz1lfBRhMU K48w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=rAaK1zqf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r17-20020a05640251d100b0041df73164e1si2530277edd.508.2022.05.11.04.55.47; Wed, 11 May 2022 04:56:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@alien8.de header.s=dkim header.b=rAaK1zqf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234152AbiEKJHU (ORCPT + 99 others); Wed, 11 May 2022 05:07:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240296AbiEKJHM (ORCPT ); Wed, 11 May 2022 05:07:12 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB622CC88; Wed, 11 May 2022 02:07:10 -0700 (PDT) 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-kernel@vger.kernel.org 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