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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 76A03C433EF for ; Fri, 24 Sep 2021 08:27:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4FB6961241 for ; Fri, 24 Sep 2021 08:27:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244655AbhIXI2g (ORCPT ); Fri, 24 Sep 2021 04:28:36 -0400 Received: from mail.skyhub.de ([5.9.137.197]:52902 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244692AbhIXI2f (ORCPT ); Fri, 24 Sep 2021 04:28:35 -0400 Received: from zn.tnic (p200300ec2f0dd600c2485b7778a62ff5.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:d600:c248:5b77:78a6:2ff5]) (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 5679F1EC0301; Fri, 24 Sep 2021 10:26:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1632472017; 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=bHMJS/aYXU9qw9zIv9pZZwDh/cCLOLB5X5GoNoeX9vo=; b=W4yJdlgqBzi5H0z5kuAc7jGN3hOJFaAm3WA1VGMNO5mXT1u6rQbb3Y6o7vKGhHYy+DlBWc 1z+DDpJme5HKDHBaqCfOW6De4mvGO74oqOiF9aKiel8SKG2+az6tV6r1TtJFI8h7V1dYTv WCCAQe23QdWh9+yzlMEAbnCg1loyf70= Date: Fri, 24 Sep 2021 10:26:55 +0200 From: Borislav Petkov To: Smita Koralahalli Cc: x86@kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Tony Luck , "H . Peter Anvin" , yazen.ghannam@amd.com Subject: Re: [PATCH 5/5] x86/mce/mce-inject: Return error code to userspace from mce-inject module Message-ID: References: <20210915232739.6367-1-Smita.KoralahalliChannabasappa@amd.com> <20210915232739.6367-6-Smita.KoralahalliChannabasappa@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210915232739.6367-6-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org On Wed, Sep 15, 2021 at 06:27:39PM -0500, Smita Koralahalli wrote: > Currently, the mce-inject module fails silently and user must look for > kernel logs to determine if the injection has succeeded. > > Save time for the user and return error code from the module if error > injection fails. > > Signed-off-by: Smita Koralahalli > --- > arch/x86/kernel/cpu/mce/inject.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c > index c7d1564f244b..0ef9ff921c6a 100644 > --- a/arch/x86/kernel/cpu/mce/inject.c > +++ b/arch/x86/kernel/cpu/mce/inject.c > @@ -549,8 +549,10 @@ static void do_inject(void) > } > > cpus_read_lock(); > - if (!cpu_online(cpu)) > + if (!cpu_online(cpu)) { > + mce_err.err = -ENODEV; You could issue a pr_err() here too. That ENODEV probably turns into "write failed" but that doesn't say why. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette