Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2153161pxb; Fri, 29 Jan 2021 14:59:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBqBWwwfyVbSf21Ka2EBPfUgMOnFi0PT1AmEnUIdK3uIEi/hm4j7BVs+DqePD243BT893b X-Received: by 2002:a05:6402:3552:: with SMTP id f18mr7648883edd.111.1611961162072; Fri, 29 Jan 2021 14:59:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611961162; cv=none; d=google.com; s=arc-20160816; b=yP1jra0N0lWt+hs6ToPqkuVO6rddFpZr4jHEYnCybBAAVOmrwbDlAjGGZPivOPkSnt KJNEz229jG0WuFayJNG9kNyMn2opOs8Ra9nTxTuqij40JFDjHTFW5Dks3PhGOldg0/2v T9IlgxlrcqH4AFiR4s5Mw5N1MSULJCgdcgtpkBKth5kCkm1ggzSQuRvJLoT2TjWbZZ7z /KksJVsHQmGKzrHMKOUpX0YaUzPeN13m93Dxb8JwWJUw16wUcL+Jh7U0DXhI4TDNYoOy zd7V6p/kGG2ieWoPELhLMTuZ7NQ69MuByTfMv31K3smMo5Bdq2WdJqxZKujxQNJrfmBH JlaQ== 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:ironport-sdr :ironport-sdr; bh=5pLNplPZ6MJXh1gjgjpdCLB4mtaCl/R1023zao5rmh8=; b=VfTvr0BSnSy311e7bIwKnaRA0QHo0O58AdzdoB9aSbRTGowPM+aUUaOdLZwJG2xez3 T11n0MuKk/iHnULbJpg35K4BXtwQnijgiKB70Y1iTSzGOiRWUR2V7lSwLsiTZA2cwA6D Wuy9Ustbe5LybMXDewDbDm/c7/0UAWpdTX+hCVAIHhBzGb0SMUgaH0mKZKZMg31cV17E hebr2bFn1nXOJLThG4lHn+54mMx36uvNUnNItSR+4nUbjOzgvCCW0XW7Oifajq+bXMYH KVNi3/veAYrBWPXSIdPCYeyLvY9BWuwLlEAXPbu0iNsv58A9Gp8zQ+B2Q1iZ2CiVf3ok s8kQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si5783582eje.173.2021.01.29.14.58.57; Fri, 29 Jan 2021 14:59:22 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbhA2W4P (ORCPT + 99 others); Fri, 29 Jan 2021 17:56:15 -0500 Received: from mga14.intel.com ([192.55.52.115]:28781 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231388AbhA2W4M (ORCPT ); Fri, 29 Jan 2021 17:56:12 -0500 IronPort-SDR: bWyRo2SOqlmdvVNRaWOFJd0jOYAWKR/5UgMJyhWaEWbv1Rrdwv/sp14cJN+RZuCCn6CpdKIP3t l6BizDPZORkw== X-IronPort-AV: E=McAfee;i="6000,8403,9879"; a="179715426" X-IronPort-AV: E=Sophos;i="5.79,386,1602572400"; d="scan'208";a="179715426" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2021 14:55:31 -0800 IronPort-SDR: oWkJrKyr8/3tj4MBmSXFZ09RJd1uiVPCtGphBHHP6lK7WrTAe42T199htzu1bomke11bMLkDaa BwZn8fYtORpQ== X-IronPort-AV: E=Sophos;i="5.79,386,1602572400"; d="scan'208";a="370568754" Received: from agluck-desk2.sc.intel.com (HELO agluck-desk2.amr.corp.intel.com) ([10.3.52.146]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2021 14:55:30 -0800 Date: Fri, 29 Jan 2021 14:55:29 -0800 From: "Luck, Tony" To: Aili Yao Cc: x86@kernel.org, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org, yangfeng1@kingsoft.com Subject: Re: [PATCH] x86/fault: Send SIGBUS to user process always for hwpoison page access. Message-ID: <20210129225529.GA42172@agluck-desk2.amr.corp.intel.com> References: <20210128194326.71895e92.yaoaili@kingsoft.com> <20210128174352.GA33283@agluck-desk2.amr.corp.intel.com> <20210129113334.344377ac.yaoaili@kingsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210129113334.344377ac.yaoaili@kingsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for the explanation and test code. I think I see better what is going on here. [I took your idea for using madvise(...MADV_HWPOISON) and added a new "-S" option to my einj_mem_uc test program to use madvise instead of ACPI/EINJ for injections. Update pushed here: git://git.kernel.org/pub/scm/linux/kernel/git/aegl/ras-tools.git ] There have been some small changes to arch/x86/mm/fault.c since you wrote the patch. Can you rebase to v5.11-rc5? Also maybe this might be a case to use IS_ENABLED() instead of #ifdef to make the code a little less ugly. At least for the 2nd hunk in your patch this would work well: if (IS_ENABLED(CONFIG_MEMORY_FAILURE) && (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE))) no_context(regs, error_code, address, SIGBUS, BUS_MCEERR_AR); else no_context(regs, error_code, address, SIGBUS, BUS_ADRERR); The first hunk might need a bit more thought. -Tony