From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B026C433F5 for ; Mon, 4 Oct 2021 11:55:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C1546139F for ; Mon, 4 Oct 2021 11:55:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0C1546139F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 973E56B0082; Mon, 4 Oct 2021 07:55:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9233D6B0083; Mon, 4 Oct 2021 07:55:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C39394000B; Mon, 4 Oct 2021 07:55:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id 68B606B0082 for ; Mon, 4 Oct 2021 07:55:35 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2EE38181D75BF for ; Mon, 4 Oct 2021 11:55:35 +0000 (UTC) X-FDA: 78658600230.28.A069C1A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf21.hostedemail.com (Postfix) with ESMTP id B66FAD037B9D for ; Mon, 4 Oct 2021 11:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633348534; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FYvmPpboOM7KrIZ0kaweRjUAITlvVV/bdELrT4OcyGE=; b=F2fswxyLEaJpYreR+gr2l4uYN6se6i5dfnE8Kl/yJ1FUa98OVgOr4Nom6rrNWzZPLpqEBM FSQg7Y3DeJhTV1vnj4f32Tpd1CzXgLpTlH34lfiUcZdvIqwv5FGiYmRpNmyXd8a/24fUO0 B0ucQ2MIraDljX3DBn/LwW1GoPuhXTU= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-17-HSAvxZzQOBKGdRUxbQZCSA-1; Mon, 04 Oct 2021 07:55:33 -0400 X-MC-Unique: HSAvxZzQOBKGdRUxbQZCSA-1 Received: by mail-wr1-f72.google.com with SMTP id x2-20020a5d54c2000000b0015dfd2b4e34so4564101wrv.6 for ; Mon, 04 Oct 2021 04:55:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=FYvmPpboOM7KrIZ0kaweRjUAITlvVV/bdELrT4OcyGE=; b=yXwnAVxVPXNVWajK449Qv0O+kirKUSJ6g6mBOS0euYcQCxa7LA7E9tpQ/pIvBA6m5s 5qbbcf7QY/WctwQfQ1mVcz1S2dIIIcDngrUvSsegXrRsAUOaPHREML0AArCfLifm2zMQ LR55evMU6K8pNcgkKhg8lFTAeGrLPg4lTUGnukneUUGiC6mNYJnG8G0swhcGAiMZIwQ9 8cVnIlnec52g8u4ZjQpfVffpTVpgR4ybR/SD/bJNF379cKdfY94SVhMfJOOlOODWaXQh grGm3GP4Q/gEUzO6hNA4HJ0El2W+8A6QJqXMHtFwjbj8Q4WbZ++MFLxXRVUW9MXLwrlu FD3A== X-Gm-Message-State: AOAM531NUutd4g0fmkdj5g8YnnrPsvEXCFgD+I9IOKlbaFAFCrWOaqfT ILC3Ag+Y3YpXtKdz+yS/+Vkf7Kb41tesIfkB7e9ZLvuu+2rEANya6P5SWwQxC24Euh6G/JTwMk+ lliYhr+XzPOU= X-Received: by 2002:a7b:cb4b:: with SMTP id v11mr18004217wmj.155.1633348531871; Mon, 04 Oct 2021 04:55:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfI2fCei/9E7lxXC+jT5l62/0J801YNEfv/IycvTbzfCPjD2wf6uOJ0pHuuq4EoD/1yC9YHg== X-Received: by 2002:a7b:cb4b:: with SMTP id v11mr18004195wmj.155.1633348531590; Mon, 04 Oct 2021 04:55:31 -0700 (PDT) Received: from [192.168.3.132] (p5b0c6672.dip0.t-ipconnect.de. [91.12.102.114]) by smtp.gmail.com with ESMTPSA id o15sm14062814wmc.21.2021.10.04.04.55.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Oct 2021 04:55:31 -0700 (PDT) Subject: Re: [PATCH v1] mm, pagemap: expose hwpoison entry To: Naoya Horiguchi , linux-mm@kvack.org Cc: Andrew Morton , Alistair Popple , Peter Xu , Mike Kravetz , Konstantin Khlebnikov , Bin Wang , Naoya Horiguchi , linux-kernel@vger.kernel.org References: <20211004115001.1544259-1-naoya.horiguchi@linux.dev> From: David Hildenbrand Organization: Red Hat Message-ID: <258d0ddb-6c82-0c95-a15e-b085b59d2142@redhat.com> Date: Mon, 4 Oct 2021 13:55:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20211004115001.1544259-1-naoya.horiguchi@linux.dev> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B66FAD037B9D X-Stat-Signature: r9eehe55xe967ip3d46mbyo77ui75reb Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=F2fswxyL; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf21.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1633348534-625084 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 04.10.21 13:50, Naoya Horiguchi wrote: > From: Naoya Horiguchi > > A hwpoison entry is a non-present page table entry to report > memory error events to userspace. If we have an easy way to know > which processes have hwpoison entries, that might be useful for > user processes to take proper actions. But we don't have it now. > So make pagemap interface expose hwpoison entries to userspace. Noting that this is only a way to inspect hwpoison set for private anonymous memory. You cannot really identify anything related to shared memory. Do you also handle private hugetlb pages? > > Hwpoison entry for hugepage is also exposed by this patch. The below > example shows how pagemap is visible in the case where a memory error > hit a hugepage mapped to a process. > > $ ./page-types --no-summary --pid $PID --raw --list --addr 0x700000000+0x400 > voffset offset len flags > 700000000 12fa00 1 ___U_______Ma__H_G_________________f_______1 > 700000001 12fa01 1ff ___________Ma___TG_________________f_______1 > 700000200 12f800 1 __________B________X_______________f______w_ > 700000201 12f801 1 ___________________X_______________f______w_ // memory failure hit this page > 700000202 12f802 1fe __________B________X_______________f______w_ > > The entries with both of "X" flag (hwpoison flag) and "w" flag (swap > flag) are considered as hwpoison entries. So all pages in 2MB range > are inaccessible from the process. We can get actual error location > by page-types in physical address mode. > > $ ./page-types --no-summary --addr 0x12f800+0x200 --raw --list > offset len flags > 12f800 1 __________B_________________________________ > 12f801 1 ___________________X________________________ > 12f802 1fe __________B_________________________________ > > Signed-off-by: Naoya Horiguchi > --- > fs/proc/task_mmu.c | 41 ++++++++++++++++++++++++++++++++--------- > include/linux/swapops.h | 13 +++++++++++++ > tools/vm/page-types.c | 7 ++++++- > 3 files changed, 51 insertions(+), 10 deletions(-) Please also update the documentation located at Documentation/admin-guide/mm/pagemap.rst -- Thanks, David / dhildenb