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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AD14C4338F for ; Tue, 17 Aug 2021 18:17:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D583D61051 for ; Tue, 17 Aug 2021 18:17:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D583D61051 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5BAAC6B0071; Tue, 17 Aug 2021 14:17:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5436A6B0072; Tue, 17 Aug 2021 14:17:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E4938D0001; Tue, 17 Aug 2021 14:17:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0113.hostedemail.com [216.40.44.113]) by kanga.kvack.org (Postfix) with ESMTP id 20C4E6B0071 for ; Tue, 17 Aug 2021 14:17:08 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C8D231854E for ; Tue, 17 Aug 2021 18:17:07 +0000 (UTC) X-FDA: 78485379294.23.A82862F Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf02.hostedemail.com (Postfix) with ESMTP id BBE537002BA7 for ; Tue, 17 Aug 2021 18:17:06 +0000 (UTC) Received: from zn.tnic (p200300ec2f1175006a73053df3c19379.dip0.t-ipconnect.de [IPv6:2003:ec:2f11:7500:6a73:53d:f3c1:9379]) (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 5AA421EC0556; Tue, 17 Aug 2021 20:17:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1629224221; 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=XxZOJFQ4/UtYMMPE2hte00+BJM98D2VDLNtyNZE78CM=; b=BsBVJFBSgu8Iv+F/GHrHfxj/N39ok4iLAd9NnK//E2y4h0hIzNsuRbvYJV5enGEYZ+ladi EEOmWDLqlrqST8OrYcF6YjXH7HODiN1sGhL6u9ylqdwKxjmjnHWbnQyWax69Htj3T+/Osz CFyip7AO9eYqt6jCKmskrU3WvMimYlk= Date: Tue, 17 Aug 2021 20:17:40 +0200 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Michael Roth , Vlastimil Babka , tony.luck@intel.com, npmccallum@redhat.com, brijesh.ksingh@gmail.com Subject: Re: [PATCH Part1 RFC v4 15/36] x86/mm: Add support to validate memory when changing C-bit Message-ID: References: <20210707181506.30489-1-brijesh.singh@amd.com> <20210707181506.30489-16-brijesh.singh@amd.com> <162d75ca-f0ec-bb7e-bb47-70060772a52c@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <162d75ca-f0ec-bb7e-bb47-70060772a52c@amd.com> Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=alien8.de header.s=dkim header.b=BsBVJFBS; dmarc=pass (policy=none) header.from=alien8.de; spf=pass (imf02.hostedemail.com: domain of bp@alien8.de designates 5.9.137.197 as permitted sender) smtp.mailfrom=bp@alien8.de X-Stat-Signature: d96ojoe5utgujobsub8bayy4snuqjn84 X-Rspamd-Queue-Id: BBE537002BA7 X-Rspamd-Server: rspam05 X-HE-Tag: 1629224226-71431 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 Tue, Aug 17, 2021 at 01:07:40PM -0500, Brijesh Singh wrote: > > > + if (!desc) > > > + panic("failed to allocate memory"); > > > > Make that error message more distinctive so that *if* it happens, one > > can pinpoint the place in the code where the panic comes from. > > > > Now I am running checkpatch and notice that it complain about the message > too. I can add a BUG() or WARN() to get the stack trace before the crashing. checkpatch complains because there's a kmalloc before it and if it fails, the mm core will issue a warning so there's no need for a warning here. But in this case, you want to panic and checkpatch doesn't see that so you can ignore it here and leave the panic message but make it more distinctive so one can find it by grepping. IOW, something like if (!desc) panic("SEV-SNP: Failed to allocame memory for PSC descriptor"); Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette