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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3CC6D20686 for ; Tue, 15 Oct 2024 23:59:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 352396B0083; Tue, 15 Oct 2024 19:59:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 302876B0088; Tue, 15 Oct 2024 19:59:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C9A46B0089; Tue, 15 Oct 2024 19:59:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F40226B0083 for ; Tue, 15 Oct 2024 19:59:06 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CC9B41619DA for ; Tue, 15 Oct 2024 23:58:55 +0000 (UTC) X-FDA: 82677504924.04.34CBEF4 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by imf28.hostedemail.com (Postfix) with ESMTP id 983B2C0010 for ; Tue, 15 Oct 2024 23:58:56 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=hOR97Ifc; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf28.hostedemail.com: domain of jiaqiyan@google.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=jiaqiyan@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729036697; a=rsa-sha256; cv=none; b=ChN8si1cPg8syL/6rt0fStd/qM6Ptr/GGZmjAXGM4aV9gFgTcMb5omVabNq+m5Lz+hEFgT r3d9Z0MeewNU+j73LOUJltW/xegk6yhYX9OYVpnCW1W+zws3u+KD/7IscFyWf0Cz3tCPlL C4srSLL7dpQZhTsycdVRHn3mtxdno7s= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=hOR97Ifc; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf28.hostedemail.com: domain of jiaqiyan@google.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=jiaqiyan@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729036697; h=from:from:sender: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:dkim-signature; bh=jyyI8i2e4AOTyjY5fv2qzjrBysiDH5rGH74OWVCuAkM=; b=TWyGZ0eYnJTk/VPcdLKEu6LU4XZStzQ6Fbpp7t1rju1r0vbruyb5c1HQVxX2q4WGTdgVcP nq3+wrSHNbLsFA+JgC6BKFzQEJWCA5JoqLs81DBKKDiKzTpdsoF9Dwz/q/Xp2470hsXLSb qq/YI0GF0iJm5QHUXUtQEu60FUoBh8k= Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5c93e9e701fso103a12.1 for ; Tue, 15 Oct 2024 16:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729036743; x=1729641543; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jyyI8i2e4AOTyjY5fv2qzjrBysiDH5rGH74OWVCuAkM=; b=hOR97IfcbjJC10OXa8/SnHPnOT6OXfLtB6KaJwVCKJjfbI/pItE903PS42SIj/m6dw iTBCJjMLBVpgFisRPkqh6TL4O2IltVWjY5oifGf3JotE/ZHq8/GnpKOsvN1tznHWFduq II2KqriX5zl3ZJXEM7p6RtMxlGLfr8usag0X6UxvrONdKAD/1D5sKWlsUwGqmw+4E1sU Ih1w6XVa28+AE9j9zZ568vRKeo6pJQJ+etPNKXn7ba2i212uBlmdJnxKwxGZs6DPFl/m VIjMhjZRrRuMLOO73VzDtc7yP7bvz2xnh/Nqah5EpFNwp5MGEiryQQpOAckMO2XNzIXu M+oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729036743; x=1729641543; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jyyI8i2e4AOTyjY5fv2qzjrBysiDH5rGH74OWVCuAkM=; b=RtcKpZS8pnOc9GYvzlJyZ8b+G/R43Q1h9+fq+vC2PgBFq91FkK/ADm/c9ZN4E7v2+f U7f7OR+gdcdJDrmrHnSuIV/3ysnA13TT5HznhNCfKIOh7VAqkOUAoPtBzjn+g2y8AQx5 USUCGMALaKHfaA3A10K0eyQ4AbktOJtbrfaS8XHhDcmzGIXTAdh+yNRPpqv/cm6lOAuS FzrVXYgYrglDAQq+nGbEcm1cgGG30EIc85gwfOAQ3wdspv0QFFiXc3QzP50Z7jHSvqd6 oL1Ziu319AF3EdriC7B5X1+BXSVQMj6FuJ+BrQEx3iLcjshI9VRK3l5v6sWSPSmjX+IZ PBew== X-Forwarded-Encrypted: i=1; AJvYcCUe7Ca8GZP9Y8FGfoKX0D0f/9K1Y+WgyCv0M9wlB72qpkD+/IUJPKXMQGTGNcXAJLXM0E0gwi9Ezg==@kvack.org X-Gm-Message-State: AOJu0YwxS3QhF2Y0ovT4VTxKQijlfTEaY0c/dx4Wh8hdadEJ5fjTdT4s NPsN1Y9tYT54bplCvx2K+/yVoFCGrPdXROswOfe8pqE7JQ5TIDfEar3WbSTzLfyU1LlYTv4RK7A pDFZVPZYGOZWyTIaiFWdKtOBCUa2/AOFf4WYx X-Google-Smtp-Source: AGHT+IHcDFuQwedNZZzdjTE9EBNfFwL2Mrrm5R9EbwxjWWKpEQSIJbemRYUqBNuC3no9lHXSPUCZVWpLu0rx1sT9IvA= X-Received: by 2002:a05:6402:234a:b0:5c8:a0fd:64f0 with SMTP id 4fb4d7f45d1cf-5c9979d0b81mr218996a12.2.1729036742382; Tue, 15 Oct 2024 16:59:02 -0700 (PDT) MIME-Version: 1.0 References: <20240924043924.3562257-1-jiaqiyan@google.com> <20240924043924.3562257-2-jiaqiyan@google.com> In-Reply-To: From: Jiaqi Yan Date: Tue, 15 Oct 2024 16:58:51 -0700 Message-ID: Subject: Re: [RFC PATCH v1 1/2] mm/memory-failure: introduce global MFR policy To: Miaohe Lin Cc: jane.chu@oracle.com, nao.horiguchi@gmail.com, tony.luck@intel.com, wangkefeng.wang@huawei.com, akpm@linux-foundation.org, osalvador@suse.de, rientjes@google.com, duenwen@google.com, jthoughton@google.com, jgg@nvidia.com, ankita@nvidia.com, peterx@redhat.com, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: 983B2C0010 X-Rspamd-Server: rspam01 X-Stat-Signature: a79czwng719ernw1igo11esteobw5463 X-HE-Tag: 1729036736-9936 X-HE-Meta: U2FsdGVkX18f/2bDdt0/MXfoQEFQpgJPieIb/k4t0BC+FRQRADuqXriRSLy6tTS5u9+wN3dwgh1WW/UrjYK2767r/QGWr5F6oApCv29AoRsxK6LxE1hHr1p9jojw7tDWlTJzxnQHIcFZkbSIMbmVy82Q2MRECCQ4yYxJXDKMPFWMSGgH5/FK8G8xlc14qGRguNPLpzrNBZ8z/+7dZKxioNoa66n/gL6d/1ng9pqyIs5zkm78u36JWcViYE1aaXGq6FI7Ll+IMPpk0T/VrTIL7VvKNnKRzOYXwi0No9JIAxA6lYyQYn80IPb/ygPa2z0qhirGK2c4yL63VjFD/0CTjdxBU4vht0ujRQgLBt11Knch9z5I+CQ4EO14pxAlJh6QkKiffovIFz9byOiYZc/Rr4unOq1DBtBR4p9aZSPbWe+fRy44lxvJqAatv5gO7dnn2elKPbMtgV4gONTc77s5lKwAIsD4Hl0UMTXrmUQwuWqj8ySB4XwybcTaNle3+1xGq2ew6g+9nPmyoda/iWcLuSAaaFpgT8v4Q568b46/quEZGeP5Aw6Sv2azuleKnsXKAflSlXOpG6lSiAqw8+8m0uiC03crS2BG1NnFZPIqgs5BuCYKCgkUybGBoVmWZMfFsV7VzpdcvOgQ7SZv8JgV1gAgooNMzUpznQsk2gfJshcr2acjCCs6wsHkbVMRYUZTn+pwopj2aI+Cn1+ADyrFzJwaSFmOy+vdHQaASbtAxWpCiu25A3FD9wJBAgs6dxs8Tu9/klD5Z2Y3hK5OubcbGcipzhbR/76K3JwliOxR9cRJxS2Q/VRUijtn7Zj7l1R3QFvk0nFeCYE29SmlPzalwraTc1pQ/wLsQMz3s/3NkX1vTORoSNk8eC2au3FkQvX2g7slPCivKn5XIIZ6FROjjdPv7vUUYpbDjhkJiDRGrJMvEzhn62FSPNO+fpKELZJdFV+DgOFeqXwldVzemUS gUv3RjsA kC4AaYhmi/jLqm+Eu0AAo9hSqHir05HQe0I20nn06xgDWSxTJETXAsGpSkFKYy/HGWRwa+WOqA9Sr2FJ5KV53KHuWd9PP8pbIE/uggJa7LL/fNYX1gQ35uRiW02p5KoFx6xt4r6WOoxecq7di5ukSYW+eWfcHTVihWievlEONefeVykDqNGyvwH3xMp/fCqbQUKFXknhy4sN2UIeAdev0g1Bfjj3t7l4A+7PCD2m1Z/0xxw9TGk+ay3aWK2dc2v9Ig1EfesoW2CklyIL9BueIt1QZnyyzQiDFiEnzsx40h5HWPepVUPKWTHV3wGjiIdbVc0Tl 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: List-Subscribe: List-Unsubscribe: On Fri, Oct 11, 2024 at 12:05=E2=80=AFAM Miaohe Lin = wrote: > > On 2024/10/4 7:51, Jiaqi Yan wrote: > > Hi Jane, > > > > On Wed, Oct 2, 2024 at 4:50=E2=80=AFPM wrote: > >> > >> Hi, > >> > >> On 9/23/2024 9:39 PM, Jiaqi Yan wrote: > >>> > >>> + /* > >>> + * On ARM64, if APEI failed to claims SEA, (e.g. GHES driver do= esn't > >>> + * register to SEA notifications from firmware), memory_failure= will > >>> + * never be synchrounous to the error consumption thread. Notif= ying > >>> + * it via SIGBUS synchrnously has to be done by either core ker= nel in > >>> + * do_mem_abort, or KVM in kvm_handle_guest_abort. > >>> + */ > >>> + if (!sysctl_enable_hard_offline) { > >>> + pr_info_once("%#lx: disabled by /proc/sys/vm/enable_har= d_offline\n", pfn); > >>> + kill_procs_now(p, pfn, flags, page_folio(p)); > >>> + res =3D -EOPNOTSUPP; > >>> + goto unlock_mutex; > >>> + } > >>> + > >> > >> I am curious why the SIGBUS is sent without setting PG_hwpoison in the > >> page. In 0/2 there seems to be indication about threads coordinate > >> with each other such that clean subpages in a poisoned hugetlb page > >> continue to be accessible, and at some point, (or perhaps I misread), > >> the poisoned page (sub- or huge-) will eventually be isolated, because= , > > > > The code here is "global policy". The "per-VMA policy", proposed in > > 0/2 but code not sent, should be able to support isolation + offline > > at some point (all VMAs are gone and page becomes free). > > > >> it's unthinkable to let a poisoned page laying around and kernel treat= s > >> it like a clean page ? But I'm not sure how do you plan to handle it > >> without PG_hwpoison while hard_offline is disabled globally. > > > > It will become the responsibility of a control plan running in > > userspace. For example, the control plan immediately prevents starting > > of any new workload/VM, but chooses to wait until memory errors exceed > > a certain threshold, or hold on to the hosts until all workloads/VMs > > are migrated and then repair the machine. Not setting PG_hwpoison is > > indeed a big difference and risk, so it needs to be carefully handled > > by userspace. > > > > Could you explain why PG_hwpoison cannot be set in this case? It seems a = control plan running in > userspace can work with PG_hwpoison set. PG_hwpoison makes sure hwpoisone= d pages won't be re-used > by kernel while the control plan prevent them from re-accessed from users= pace. Or am I miss something? > [Resend to include more people and linux-mm] Sorry I almost missed your comment/question. I think for hugetlb and transparent hugepages, say we keep them mapped but set HWPoison flag, the flag will be set at compound head and future userspace page fault on **any** part of the hugepage will result in SIGBUS, meaning the hugepage is lost to the userspace, making "keep them mapped" a meaningless action. > Thanks. > . >