Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1786434rwb; Fri, 5 Aug 2022 07:48:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR5eb5yyFrsOuWC8EnZydwvxjwFtZj2J45CQfYb31ZPQb2XooX0ZP+GKYr6hmrGZYV/DI+7l X-Received: by 2002:a05:6a00:ac5:b0:52b:bd67:c11 with SMTP id c5-20020a056a000ac500b0052bbd670c11mr7125690pfl.61.1659710911773; Fri, 05 Aug 2022 07:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659710911; cv=none; d=google.com; s=arc-20160816; b=xf33SJ2UGkQaDtoDYbYRSZ4T3czicDMj+7un5eJG7nUEgJYveFGUcqMLKipINa6zRM vwaX83mtGZDHwwYlh0JVedugIg/z3cRYRArzzJHazd9/8iDfriAF0uuD889qnm1ri6DV tN399BNbshEwcANJ1F18ef9zpm2IsKpYrsYnoZ9RNvBLEVk/468ANjiItO7mpm+uw6Ll M0rjGKVVMcB5a3iA5UGztOJ2AN6/FnG97dsyQgYjsubNiL3OVhE+eb9bX7fjtc3AIDC3 bAu8j34ZbPxEWMknDLq/tC9gzwaGULaRYktbgh0diwKmHfxAyeGir4s10qhVAvF5jUz7 Yrlw== 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=ECr7IjNcewMTtl4rJhJ+gDNquePCsr57H61O6zhbSgA=; b=Ztf01dALs3dEaur9JdWr4zJbizPQfgi7+xigo5N4aEWGlEEk/8e/dYRlA4ugj770eP SB9Nh22A6koll/8FEkyA2wV+8FzVuLfQ8/bTUilXRvH132VzCdwglpDvAXwrJhZKwy05 Zhp51zSWsj2jSh+fZelgXYHJDyXJ+7XhErzqpScZ+XDdgupFFsP3vRIoAeoy6GPZ8ly+ Q+Abt3g1Jdaq8CZ7J4Q0EjVCQI+KRWW/z/sgGFcUEnh/zp2f36+oyV3o37upv7cPFYtC gE40wC3svyi34lmnvgBUNR9g+f0BhuiEqg3m1GRwOGpSrERHWu3hzfq3sJNpFmrMZR6g 8Y4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=DnB3TGi5; 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 x4-20020a63f704000000b0041ce0452540si3490245pgh.330.2022.08.05.07.48.18; Fri, 05 Aug 2022 07:48:31 -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=DnB3TGi5; 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 S240948AbiHEO14 (ORCPT + 99 others); Fri, 5 Aug 2022 10:27:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238458AbiHEO1y (ORCPT ); Fri, 5 Aug 2022 10:27:54 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2675528718 for ; Fri, 5 Aug 2022 07:27:52 -0700 (PDT) Received: from zn.tnic (p200300ea971b986e329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:971b:986e:329c:23ff:fea6:a903]) (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 8FD721EC04E4; Fri, 5 Aug 2022 16:27:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1659709666; 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=ECr7IjNcewMTtl4rJhJ+gDNquePCsr57H61O6zhbSgA=; b=DnB3TGi5laEcx99MrvrLgWfsoJEOm6gndXW8fAMyFDXsVIdsFo/wTbodBIT2J8Aq1HDcHq RAX3v4dbzhQKi6MvJtxhEjgFil39UBq0DD5T9vE3kbRwelMPULrjC+Kr4s/UrOMZfGZbAu NDmsCvmu0wQKZvTKgv3XZsNHRpoeVHk= Date: Fri, 5 Aug 2022 16:27:40 +0200 From: Borislav Petkov To: Rik van Riel Cc: Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, Dave Hansen Subject: Re: [PATCH v3] x86,mm: print likely CPU at segfault time Message-ID: References: <20220805101644.2e674553@imladris.surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220805101644.2e674553@imladris.surriel.com> 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 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 Fri, Aug 05, 2022 at 10:16:44AM -0400, Rik van Riel wrote: > diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c > index fad8faa29d04..c7a5bbf40367 100644 > --- a/arch/x86/mm/fault.c > +++ b/arch/x86/mm/fault.c > @@ -769,6 +769,8 @@ show_signal_msg(struct pt_regs *regs, unsigned long error_code, > unsigned long address, struct task_struct *tsk) > { > const char *loglvl = task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG; > + /* This is a racy snapshot, but it's better than nothing. */ > + int cpu = raw_smp_processor_id(); Please read this in exc_page_fault() and hand it down to helpers. Alternatively, I'm being told there's a patchset in the works which will allow for any exception handler to pass in additional information downwards through an extended pt_regs. Then, saving the CPU number on which the handler is running would work generically everywhere. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette