Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1106085pxb; Wed, 6 Apr 2022 08:52:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnnnm+Vpz67KsiazxAEXE1UwuBypHhhnn2MidyqNcU7Xq//mB1Yh1tNwdcW7hOYJ1lLFW7 X-Received: by 2002:a63:eb0b:0:b0:382:a08a:8809 with SMTP id t11-20020a63eb0b000000b00382a08a8809mr7700090pgh.47.1649260357510; Wed, 06 Apr 2022 08:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649260357; cv=none; d=google.com; s=arc-20160816; b=EqQZBlbdvITpYhplIZI+TuvFJgpUgJUqOLaBAnqZJRjEhppSUxly9IHhlCAsz0qnjR urpdSMKKzp6qQGjf55GOLONrUgjbTdmGb+24+D+5o3KSdAqBXYp1IQx5c3+nBC6a7HHs Axm2hD4792LKe/u2vqi4ug9zsmLKxr1dH1T77eh8I5Xu07daigPoQxayJBRXW2ItV9v+ GQZouEaO1ykt0V9FK/ENncOjzgS4Kl6EsDIwurOQvDQU/uZnhk/wGmfU//3RVAQx9+wK mDlCIc2gvlpenBraUEtRid5KomV0rJlShFwmdJ+JhaOQhiLZr1zaO2BoDitvPIip52gq 5scw== 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; bh=gvQ2hZfZrjecfvrJ67a+IAiRNNxpVofL+wlxZf0ZSQU=; b=IFMelrEuwMHtFJWpkwobiCFT7xbEndfORWm02JzfUvWu7OIutiwXWcBo5a1WCMFQJT /PxqxTdLXLP8ZRETGzAeIPb+cncatDE8zIuDAy5ikBmC362C6c2DCiqaVx5hQ0rIgcMW s8XOa4vBs79i6pnEzMz1BPbHh4cdw1JheLuOAtJPBJDwMERL/+346DZeV+ViIi6rNpym hH+DjyGLXhT3qHd/MTamzeMli9N0zNCmU+KJhAyCPv98fGeV+fwI6EOH9Ptpd17atCZr ze/bDfBEFpwueqHjXC+MR+Q3j06OTFRUFdfZcP895nUnewz+I4PfbbJlKgTnd4Rnqdc6 nWDA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u9-20020a170903124900b00153ee8b0c91si16670761plh.172.2022.04.06.08.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 08:52:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9B5E14A0C97; Wed, 6 Apr 2022 07:12:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234513AbiDFONr (ORCPT + 99 others); Wed, 6 Apr 2022 10:13:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234613AbiDFOMe (ORCPT ); Wed, 6 Apr 2022 10:12:34 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 981896381A2 for ; Wed, 6 Apr 2022 03:10:55 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3A1AC23A; Wed, 6 Apr 2022 03:04:53 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.10.98]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C67DC3F718; Wed, 6 Apr 2022 03:04:50 -0700 (PDT) Date: Wed, 6 Apr 2022 11:04:41 +0100 From: Mark Rutland To: Tong Tiangen Cc: Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Catalin Marinas , Will Deacon , Alexander Viro , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, james.morse@arm.com Subject: Re: [RFC PATCH -next V2 0/7]arm64: add machine check safe support Message-ID: References: <20220406091311.3354723-1-tongtiangen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220406091311.3354723-1-tongtiangen@huawei.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi, In future, for the arm64 uaccess stuff, could you please CC me, and for the arm64 RAS bits (e.g. the SEA handling), could you please CC James Morse? On Wed, Apr 06, 2022 at 09:13:04AM +0000, Tong Tiangen wrote: > This patchset is based on[1]. That link below appears to be a single patch. Sending that separately makes this harder to review, so in future could you please send this as a combined series? > With the increase of memory capacity and density, the probability of > memory error increases. The increasing size and density of server RAM > in the data center and cloud have shown increased uncorrectable memory > errors. > > Currently, the kernel has a mechanism to recover from hardware memory > errors. This patchset provides an new recovery mechanism. > > For ARM64, the hardware error handling is do_sea() which divided into > two cases: > 1. The user state consumed the memory errors, the solution is kill th > user process and isolate the error page. > 2. The kernel state consumed the memory errors, the solution is panic. > > For kernelspace, Undifferentiated panic maybe not the optimal choice, > it can be handled better. > > This patchset deals with four sscenarios of hardware memory error consumed > in kernelspace: > 1. copy_from_user. > 2. get_user. What about atomics to user memory? e.g. futexes, or the armv8_deprecated emulations? It seems the assumption is that writing to user memory (e.g. copy_to_user() and put_user()) don't matter? Could you please mention why? e.g. do we never take an exception for writes to memory with errors? > 3. cow(copy on write). > 4. pagecache reading. There are a bunch of other places where we'll access user memory via the linear map, so I assume this is just a best-effort "try not to die" rather than "never die" ? Are there other places we might need/want to expand this to in future? Thanks, Mark. > These four scenarios have similarities. Although the error is consumed in > the kernel state, but the consumed data belongs to the user state. > > The processing scheme is based on CONFIG_ARCH_HAS_COPY_MC and uses the > process killing plus isolate error page to replace kernel panic. > > [1]https://lore.kernel.org/lkml/20220323033705.3966643-1-tongtiangen@huawei.com/ > > Since V2: > 1.Consistent with PPC/x86, Using CONFIG_ARCH_HAS_COPY_MC instead of > ARM64_UCE_KERNEL_RECOVERY. > 2.Add two new scenarios, cow and pagecache reading. > 3.Fix two small bug(the first two patch). > > Tong Tiangen (7): > x86: fix copy_mc_to_user compile error > arm64: fix page_address return value in copy_highpage > arm64: add support for machine check error safe > arm64: add copy_from_user to machine check safe > arm64: add get_user to machine check safe > arm64: add cow to machine check safe > arm64: add pagecache reading to machine check safe > > arch/arm64/Kconfig | 1 + > arch/arm64/include/asm/asm-extable.h | 25 +++++++ > arch/arm64/include/asm/asm-uaccess.h | 16 +++++ > arch/arm64/include/asm/esr.h | 5 ++ > arch/arm64/include/asm/extable.h | 2 +- > arch/arm64/include/asm/page.h | 10 +++ > arch/arm64/include/asm/uaccess.h | 17 ++++- > arch/arm64/kernel/probes/kprobes.c | 2 +- > arch/arm64/lib/Makefile | 2 + > arch/arm64/lib/copy_from_user.S | 11 ++-- > arch/arm64/lib/copy_page_mc.S | 98 ++++++++++++++++++++++++++++ > arch/arm64/lib/copy_to_user_mc.S | 78 ++++++++++++++++++++++ > arch/arm64/mm/copypage.c | 36 ++++++++-- > arch/arm64/mm/extable.c | 21 +++++- > arch/arm64/mm/fault.c | 30 ++++++++- > arch/x86/include/asm/uaccess.h | 1 + > include/linux/highmem.h | 8 +++ > include/linux/uaccess.h | 8 +++ > include/linux/uio.h | 9 ++- > lib/iov_iter.c | 85 +++++++++++++++++++----- > mm/memory.c | 2 +- > 21 files changed, 432 insertions(+), 35 deletions(-) > create mode 100644 arch/arm64/lib/copy_page_mc.S > create mode 100644 arch/arm64/lib/copy_to_user_mc.S > > -- > 2.18.0.huawei.25 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel