Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1658479pxf; Fri, 12 Mar 2021 15:50:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+FUKUMULNotNI/Vbp1NX0ExY2j8cf3G2MsNcRgw/Omu/21BDrNDPG++tmD4fjNOJROMIR X-Received: by 2002:a50:cdd1:: with SMTP id h17mr17102688edj.178.1615593013177; Fri, 12 Mar 2021 15:50:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615593013; cv=none; d=google.com; s=arc-20160816; b=QNeSwJOyx1fSO4z52tIJMQCuYOEwMQBW5G908cUnSVoWFKaY3gWr0oH5JktNorDvY8 zEkuJV2Bp6AqjkY93w0vEI/MVtlGCAqCwmH2QRp1OzSYlNa9XR56b98Zt3+Nap7OR8QP lUZ5qAorWRRYKbsQUCsVMJgQGXxQgLIVZI76vD7AErccpDJyZxBzrX5Z8A/qoLEK0Y3z pE9OqA0rbzczel4SJ2NS5aCWf4p3nVkuzSl0cxFFAId8KPrULLcK/NG5mOpWbub79/Um NAr9EhDsSoImmDNUOTFvVmPvlVKZjlnVvymNexpNfSH+5F5JPN24LCl2i3qQHiRiBXYJ 1V4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :dlp-version:dlp-reaction:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=xZA/2jT5Sj8C+EMI2hcg3xywtc3ZLqQLU9nQMsn8H3E=; b=nY/c1crA4RFZirutXAlsVRgp77z0RiEY0GDW2+0RlKTy3AyQDyFfDbE2QQA62M0bB8 q03N0X33nCxjim7Zu7NMSInZArEH0FyvHZ7bzAL3GC7rLQGBPh+NGId7dJu/JfZCUVoD xvxYgdwDeimdfAnE/U+O7mANMBLDgH1KoO96SxjNm5wlorvqNqXE8kfCnGzyHzJ1uiC5 QDz/MR9vwSZI+uWh0eBAAltM12ppjL4YcusD7zCvFv2670JUuZ5PCFijQtRsRf2u0Gz+ afy/8DjU29mr8QMPcbmwLRBWHr9MM4vpTrOK772+dMp1mZW1yVouVitHfxX6BU53xqDz qGZQ== 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 q17si5220015ejy.390.2021.03.12.15.49.50; Fri, 12 Mar 2021 15:50:13 -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 S235858AbhCLXsz convert rfc822-to-8bit (ORCPT + 99 others); Fri, 12 Mar 2021 18:48:55 -0500 Received: from mga17.intel.com ([192.55.52.151]:60337 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235917AbhCLXsf (ORCPT ); Fri, 12 Mar 2021 18:48:35 -0500 IronPort-SDR: zvGsp/lYoTNcTDolUZlvQVsfiOCLUMS8A+jXMjg+uvIqQ3BSHnF9M5pBvzn5JTw1M/je1/krZm 18+d1eYA/l/Q== X-IronPort-AV: E=McAfee;i="6000,8403,9921"; a="168822009" X-IronPort-AV: E=Sophos;i="5.81,244,1610438400"; d="scan'208";a="168822009" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2021 15:48:32 -0800 IronPort-SDR: eU82mLSqcCkLWvqZYcSZQVkkNBFocFGN+1m26nc2uVQbSnZahEsgExEJmQGe4pwUfLdTG/q96a RMCoALwfuXig== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,244,1610438400"; d="scan'208";a="604110535" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga005.fm.intel.com with ESMTP; 12 Mar 2021 15:48:32 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 12 Mar 2021 15:48:32 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 12 Mar 2021 15:48:31 -0800 Received: from fmsmsx610.amr.corp.intel.com ([10.18.126.90]) by fmsmsx610.amr.corp.intel.com ([10.18.126.90]) with mapi id 15.01.2106.013; Fri, 12 Mar 2021 15:48:31 -0800 From: "Luck, Tony" To: Aili Yao CC: =?iso-2022-jp?B?SE9SSUdVQ0hJIE5BT1lBKBskQktZOH0hIUQ+TGkbKEIp?= , Oscar Salvador , "david@redhat.com" , "akpm@linux-foundation.org" , "bp@alien8.de" , "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "yangfeng1@kingsoft.com" , "sunhao2@kingsoft.com" Subject: RE: [PATCH] mm,hwpoison: return -EBUSY when page already poisoned Thread-Topic: [PATCH] mm,hwpoison: return -EBUSY when page already poisoned Thread-Index: AQHXCnz5ja9ELypBUEatGW66U99st6pnoa2AgAEgN4CAAIHfAIAAAyEAgAAQXwD//9g7gIABDSmAgAALNoCAB2DqAIAAiu0AgABOzQD//+3L0IABObiAgAAiT4CAACi3AIAAmjmAgACgEACAAGnOwIAHwDQAgAHAYACAAADA4IABX0yAgAAnh8CAAHr7MA== Date: Fri, 12 Mar 2021 23:48:31 +0000 Message-ID: References: <20210303115710.2e9f8e23@alex-virtual-machine> <20210303163912.3d508e0f@alex-virtual-machine> <1a78e9abdc134e35a5efcbf6b2fd2263@intel.com> <20210304101653.546a9da1@alex-virtual-machine> <20210304121941.667047c3@alex-virtual-machine> <20210304144524.795872d7@alex-virtual-machine> <20210304235720.GA215567@agluck-desk2.amr.corp.intel.com> <20210305093016.40c87375@alex-virtual-machine> <20210310141042.4db9ea29@alex-virtual-machine> <20210311085529.GA22268@hori.linux.bs1.fc.nec.co.jp> <20210312135531.72e33b35@alex-virtual-machine> <3900f518d1324c388be52cf81f5220e4@intel.com> In-Reply-To: <3900f518d1324c388be52cf81f5220e4@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 x-originating-ip: [10.1.200.100] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> will memory_failure() find it and unmap it? if succeed, then the current will be >> signaled with correct vaddr and shift? > > That's a very good question. I didn't see a SIGBUS when I first wrote this code, > hence all the p->mce_vaddr. But now I'm > a) not sure why there wasn't a signal > b) if we are to fix the problems noted by AndyL, need to make sure that there isn't a SIGBUS Tests on upstream kernel today show that memory_failure() is both unmapping the page and sending a SIGBUS. My biggest issue with the KERNEL_COPYIN recovery path is that we don't have code to mark the page not present while we are still in do_machine_check(). That's resulted in recovery working for simple cases where there is a single get_user() call followed by an error return if that failed. But more complex cases require more machine checks and a touching faith that the kernel will eventually give up trying (spoiler: it sometimes doesn't). Thanks to the decode of the instruction we do have the virtual address. So we just need a safe walk of pgd->p4d->pud->pmd->pte (truncated if we hit a huge page) with a write of a "not-present" value. Maybe a different poison type from the one we get from memory_failure() so that the #PF code can recognize this as a special case and do any other work that we avoided because we were in #MC context. -Tony