Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3677296pxk; Tue, 29 Sep 2020 03:28:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTclleM+VswIC6NEYikmqhde21x4NlIFY3CzZmcmmy3qbo/is1qzcmI1yF5zo2PD/YfHwY X-Received: by 2002:a17:906:9712:: with SMTP id k18mr3098647ejx.76.1601375328233; Tue, 29 Sep 2020 03:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601375328; cv=none; d=google.com; s=arc-20160816; b=lY4K8U1TSantZIaYfe9JkhhAPW7Da6SQesGnK1jESqvVQgVHf2ZGQ3UUPkXhxrcAUH XFGNuLhbCzcLaDgeN023amG4/v4M4T0ApN9R6RsI94jmmuA5/bOLbpsqfouYYahBAVMY i7h7zPXWJKDbGEehEYVoUy3BlTer4t2g4Yb7kDReV/oXs63d0adAhFnhnqlLHaUmhPOe MJM/NjX2BBOgI3y2s+jqTAfhdM+w9niKg1fmtZ1vMU2d69reP1YVbq4qFhBdQcC5W3uF PrIH36ic8A4gWJTtuu68RuRKjPxz0E+1sOMHUL06EhKlvc3UmMs0IM1wC4pcWrSrAKpe l+ZA== 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=vD3s6odY/cyE9Bx1q0oRZfhly7bcVfpKxNIBv+AD3wk=; b=JzhGy5Ok1fT8iMlT864ZGWwGu6/x7sVxR5EiUYEKORS4NfvvAh7LkuWPKpF7og51hP Bnxbuu5sfGDUDdEAqHU7sdtSnGbeV/+GTPlOL+f8FrBs2gR5h2pXHY7bcfFSnOc6OeOo fictf1VUtYAcL04Ccjdjl4A+yuHJVldSXDin9l4g+4pmI3gdUWua5SNb1lVPMH01VcEm XfB/ki9fxp7t8LwquZ4HkAbHeGGy4gJFpj5Rt9+Pg/j5Lsb8hIAnSlBXLCu8MmqGkb13 vqbICUyP24xpJEkZ/fxXFPW8zGJJ1ItFO5BUQm3MwNX5mUfGOsqf9UezNkqp1mFgt7mp 0ENA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ShLtAJ1+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w24si2324207ejq.224.2020.09.29.03.28.25; Tue, 29 Sep 2020 03:28:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ShLtAJ1+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727698AbgI2KZY (ORCPT + 99 others); Tue, 29 Sep 2020 06:25:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbgI2KZY (ORCPT ); Tue, 29 Sep 2020 06:25:24 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76740C061755; Tue, 29 Sep 2020 03:25:24 -0700 (PDT) Received: from zn.tnic (p200300ec2f0ead0084926be0aaf8b723.dip0.t-ipconnect.de [IPv6:2003:ec:2f0e:ad00:8492:6be0:aaf8:b723]) (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 753C21EC034B; Tue, 29 Sep 2020 12:25:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1601375121; 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=vD3s6odY/cyE9Bx1q0oRZfhly7bcVfpKxNIBv+AD3wk=; b=ShLtAJ1+ONETkeLGQIFpUr5YpYO4Y8avI/Jwm/uh7pk67leh6pvbESMFqfa71vUJRYBzXL Utw8bgAfPDECvMhnh48UTxadK4tT9xzoHIe9xly+7QEHld/P6HTUArNTnmwb8000XJnLXZ noscDle3MKpVzFNcmkIiIUTBqk1oOjk= Date: Tue, 29 Sep 2020 12:25:12 +0200 From: Borislav Petkov To: Dan Williams Cc: mingo@redhat.com, x86@kernel.org, stable@vger.kernel.org, "H. Peter Anvin" , Paul Mackerras , Thomas Gleixner , Peter Zijlstra , Mikulas Patocka , Alexander Viro , Arnaldo Carvalho de Melo , Linus Torvalds , Benjamin Herrenschmidt , Tony Luck , Michael Ellerman , linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, jack@suse.cz Subject: Re: [PATCH v9 1/2] x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() Message-ID: <20200929102512.GB21110@zn.tnic> References: <160087928642.3520.17063139768910633998.stgit@dwillia2-desk3.amr.corp.intel.com> <160087929294.3520.12013578778066801369.stgit@dwillia2-desk3.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <160087929294.3520.12013578778066801369.stgit@dwillia2-desk3.amr.corp.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 09:41:33AM -0700, Dan Williams wrote: > The rename replaces a single top-level memcpy_mcsafe() with either > copy_mc_to_user(), or copy_mc_to_kernel(). What is "copy_mc" supposed to mean? Especially if it is called that on two arches... > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index 7101ac64bb20..e876b3a087f9 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -75,7 +75,7 @@ config X86 > select ARCH_HAS_PTE_DEVMAP if X86_64 > select ARCH_HAS_PTE_SPECIAL > select ARCH_HAS_UACCESS_FLUSHCACHE if X86_64 > - select ARCH_HAS_UACCESS_MCSAFE if X86_64 && X86_MCE > + select ARCH_HAS_COPY_MC if X86_64 X86_MCE is dropped here. So if I have a build which has # CONFIG_X86_MCE is not set One of those quirks like: /* * CAPID0{7:6} indicate whether this is an advanced RAS SKU * CAPID5{8:5} indicate that various NVDIMM usage modes are * enabled, so memory machine check recovery is also enabled. */ if ((capid0 & 0xc0) == 0xc0 || (capid5 & 0x1e0)) enable_copy_mc_fragile(); will still call enable_copy_mc_fragile() and none of those platforms need MCE functionality? But there's a hunk in here which sets it in the MCE code: if (mca_cfg.recovery) enable_copy_mc_fragile(); So which is it? They need it or they don't? The comment over copy_mc_to_kernel() says: * Call into the 'fragile' version on systems that have trouble * actually do machine check recovery If CONFIG_X86_MCE is not set, I'll say. :) > +++ b/arch/x86/lib/copy_mc.c > @@ -0,0 +1,66 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* Copyright(c) 2016-2020 Intel Corporation. All rights reserved. */ > + > +#include > +#include > +#include > +#include > +#include > + > +static DEFINE_STATIC_KEY_FALSE(copy_mc_fragile_key); > + > +void enable_copy_mc_fragile(void) > +{ > + static_branch_inc(©_mc_fragile_key); > +} > + > +/** > + * copy_mc_to_kernel - memory copy that that handles source exceptions One "that" is enough. ... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette