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 10EC3CD4853 for ; Wed, 4 Sep 2024 17:07:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 98E928D025D; Wed, 4 Sep 2024 13:07:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 913D98D0253; Wed, 4 Sep 2024 13:07:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78E938D025D; Wed, 4 Sep 2024 13:07:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 578FA8D0253 for ; Wed, 4 Sep 2024 13:07:34 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0E378121796 for ; Wed, 4 Sep 2024 17:07:34 +0000 (UTC) X-FDA: 82527687228.18.ABA0744 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by imf18.hostedemail.com (Postfix) with ESMTP id 24B441C0008 for ; Wed, 4 Sep 2024 17:07:31 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=onTbsIcQ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of jiaqiyan@google.com designates 209.85.128.54 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=1725469545; 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=Xlgw2GMMp/03ibSeh6HYCn+WWH+tFS60FEPDSbg/2pU=; b=VwKs77XzwtviRgxVt6uyBpQFoaoewIb/HJu8g1JdD3oqIaIj+nFpaF/H620T9V3IkE3a0B srrzxDFdWvylc8qTYM6Dw4Va+2HjToqWqShPG49zoTzV5Ypbje0XEtVM7/adKcaNXkQpjr G+gWA2YE2k+c6pHYTiZjwgutfa9KBWU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725469545; a=rsa-sha256; cv=none; b=OELRtJIY9HSumqqnzOHOoSEa4GsbeDvHvkFxihqlFD+ukZuKpgOEtDEfcM9nh4PMqm1xOc 1fXPQ0VAr1tqHA/QxkDFHPxLONtJECZj/GY8+FFQsnV1QCbuBBVnRh9iJxSv19TjMuOz9C 4GHZgF4cdkyZSe7NHV85MHZTVlqZqlg= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=onTbsIcQ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of jiaqiyan@google.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=jiaqiyan@google.com Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-42bba6a003bso2925e9.0 for ; Wed, 04 Sep 2024 10:07:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1725469651; x=1726074451; 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=Xlgw2GMMp/03ibSeh6HYCn+WWH+tFS60FEPDSbg/2pU=; b=onTbsIcQD8BUZjdO9klJ8h+oPoI7e8igEDwx+d10d0m9wBHmQNbUsI59fmTtokXSMG xUWSqrDJYlZpFMk8s9VNnEQ5hLtG1chUNZNZrNSrSgqfgwca0SGxp36TwrISqLslzErD Uh98yXJgMFxqLf/Pt2d8qo+4XWWavzaUpmcM2zOJiz3UZ3PmXCjbqgO3gD7qNnjdUgBh arPhGq4ICXwTNSLWafGRyBkAbXYBXQ/9KIFvSv26heAbLRnTKwKPfG+p/NRP7tcgVsK4 0kN9WfvSTm8QWBD7QU37dKd456afDAJGSygd+KRnoWqfXFmA2k9eNKByy0M/ud2NwPfZ 9KMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725469651; x=1726074451; 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=Xlgw2GMMp/03ibSeh6HYCn+WWH+tFS60FEPDSbg/2pU=; b=S1SzCZHhGSQ64asEZsmu4QIl4jVwOyJRzU86AktwI4NrpFOlo2MimZDvMWX52XByR5 clpkBfnqgAd94D4uZ2SWtb1bpClylPi6M1fR2oS824fXrlf0rFnPwRcWRRBmc7O7h2Yv EoyBd7T3/VYxAAjJAvMReJbf3XhQpZdbKi4B1rnlltzUd14GGStqXzWMN4ZuJQ44SPg5 xziuSo8NPbUHhiGFHqQvZkhddCf7aXVOd41ILOngqQc8JSPcYkngJbWofcBog3pGjRHx MM/6n+yh9JXAtFzPkc7A3Qv46q3i/S9bkg1UWm2uwAcW41Q+Any8yRHHAZ/CTXeCNhif dInA== X-Forwarded-Encrypted: i=1; AJvYcCXTKH/d2sbEORU+EHHV5oZ9bRfOXlYZU8HJKrPOM/tt0xlXC3HjJjl7ScRJvZWJaUgSXyVVGtCYyg==@kvack.org X-Gm-Message-State: AOJu0YxobLqWZWIpI+slOSj96o+z2v+BDATDmpmIFo7AS0K/1kAv5lno phw1foYqwco9ku8mK1tBgZIXQdm1NuaecZotG1SYA8JjXjr5au29vxWWYmDvax+RyXKpKaL6cD5 K9DbCSTgFrN7Vv3FU+5a3y8/y3nL5Yzxnt6dE X-Google-Smtp-Source: AGHT+IGDPmKBCRMKvig2+wSno2hrrMerXw5gQJsXdFfViNnACMu5y6zs3h8saPjc7a+y+FozaMvEKkcpnkLIwPGgoyM= X-Received: by 2002:a05:600c:4e4e:b0:426:6edd:61a7 with SMTP id 5b1f17b1804b1-42c95599759mr1450555e9.7.1725469650395; Wed, 04 Sep 2024 10:07:30 -0700 (PDT) MIME-Version: 1.0 References: <20240828142422.GU3773488@nvidia.com> <20240828234958.GE3773488@nvidia.com> <20240904155203.GJ3915968@nvidia.com> <20240904164324.GO3915968@nvidia.com> <20240904170041.GR3915968@nvidia.com> In-Reply-To: <20240904170041.GR3915968@nvidia.com> From: Jiaqi Yan Date: Wed, 4 Sep 2024 10:07:19 -0700 Message-ID: Subject: Re: [PATCH v2 00/19] mm: Support huge pfnmaps To: Jason Gunthorpe Cc: Peter Xu , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Gavin Shan , Catalin Marinas , x86@kernel.org, Ingo Molnar , Andrew Morton , Paolo Bonzini , Dave Hansen , Thomas Gleixner , Alistair Popple , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sean Christopherson , Oscar Salvador , Borislav Petkov , Zi Yan , Axel Rasmussen , David Hildenbrand , Yan Zhao , Will Deacon , Kefeng Wang , Alex Williamson , ankita@nvidia.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 24B441C0008 X-Stat-Signature: whizwqdomssgtkd3gpf9mr6cgpcbf4co X-Rspam-User: X-HE-Tag: 1725469651-913616 X-HE-Meta: U2FsdGVkX1/MZLTVd6NY6/GF4LTXco7et+EiSVGHxIWDxcKjn3VPXcqn2DRu/NKPgrkaL+qLyIrWgZgY3ooL2FTPwFjrKhGHoJKt7Mhfut00JrTFLUhp8jJHR6Boq5BPvv14AO0e6uf5MhpsYppPRRaBBiPXxwQtWASIy5feNCKUZ9NRVYit7m0TqhJ8C/0SaKwyKvrB9FTXwWwj4/fL7MZtRZ7irs+2y8RwY0RhlGd1K82jI8ub74XORPzaCDex5VjumXJJrW4n4nOp9kIyIQ9y1cz5N5c1uykkv/11jucleAE3AkkTpV3qSOY/9BP1x7ZaW5UZmQkOr3eQrMnUMrjP/P82omAinJ1nP0jq2HLYEBxdObbkbqWwvbvi0suoMydAW2csZ8xhs+iKjrB3EdxpBWbIiwQ6vMXdKh5TfVHW+YcO4wRbHtUfsZHZLyg7eWlnrin/tuutRiijzq2MfGQxpbqEdO2RFogKghKiMdP1WH/l3NVrMozP/ZCczY6sZF+188LxCqt+bo54NJWh4XvrMraAIggIhCNyIBkcfNmLx7K7j9RbfDmGtvY4xitdaGVOxbnWb+LByTwaWg/99nb8ntHiE94EbXEBsctKEAu2X/Vxkty8+4Gr9roJFhlInsKOvq3GNfxk/drg5OroUy/0seTmVI3xipcmC8c47OL3ohxe1BoHkcfDckm8rVYDCfIluUL5dusjdaSAtYql8ldJ9YyfE6OY+G7o+K80C5VEHRnxvvG1wIqfQA/DRzz00sZRN+zOi1cyAmBh3WRc0ZClrD5UHnrYzdqbyAWpzQZn1+WbTOsVder3fj4z8oXUDY9ZUoi/vg7ft5ptHOe6s6ZssFLHH8YkIBEHflMAohD1tvhMzQM89ZILdOsgea87htlqW6EUHsERdEf7+vU1NiXA8Us+pKu4e/uxWQ7HXdyJ4Gr3Wo+r58ddvUK6anziBuinjuyKjCtMAfBvBtN yvzX9Es+ JEeqt3bQsS6q8ZuEGS7eqzv0n/n3PSdsP0WUfBrJUlGBCo1TLXZLgYv+gnz7vKZi+KPJwjO3Mn37hEA33d8REAcTXr9aamYmDP6TLCdP8SSs6NOsl/32F/1kGOMksB4v6+sQI8BVXKglIcVD22fjiI40KBNY4w2gryYdIGGnVUcmNNrE5Y9u0tKeOZrvKLXw7alGW2GAkAao+dxIcH9QSygEtzbRYeWbqSwDl 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 Wed, Sep 4, 2024 at 10:00=E2=80=AFAM Jason Gunthorpe wr= ote: > > On Wed, Sep 04, 2024 at 09:58:54AM -0700, Jiaqi Yan wrote: > > On Wed, Sep 4, 2024 at 9:43=E2=80=AFAM Jason Gunthorpe = wrote: > > > > > > On Wed, Sep 04, 2024 at 09:38:22AM -0700, Jiaqi Yan wrote: > > > > On Wed, Sep 4, 2024 at 8:52=E2=80=AFAM Jason Gunthorpe wrote: > > > > > > > > > > On Thu, Aug 29, 2024 at 12:21:39PM -0700, Jiaqi Yan wrote: > > > > > > > > > > > I think we still want to attempt to SIGBUS userspace, regardles= s of > > > > > > doing unmap_mapping_range or not. > > > > > > > > > > IMHO we need to eliminate this path if we actually want to keep t= hings > > > > > mapped. > > > > > > > > > > There is no way to generate the SIGBUS without poking a 4k hole i= n the > > > > > 1G page, as only that 4k should get SIGBUS, every other byte of t= he 1G > > > > > is clean. > > > > > > > > Ah, sorry I wasn't clear. The SIGBUS will be only for poisoned PFN; > > > > clean PFNs under the same PUD/PMD for sure don't need any SIGBUS, > > > > which is the whole purpose of not unmapping. > > > > > > You can't get a SIGBUS if the things are still mapped. This is why th= e > > > SIGBUS flow requires poking a non-present hole around the poisoned > > > memory. > > > > > > So keeping things mapped at 1G also means giving up on SIGBUS. > > > > SIGBUS during page fault is definitely impossible when memory is still > > mapped, but the platform still MCE or SEA in case of poison > > consumption, right? So I wanted to propose new code to SIGBUS (either > > BUS_MCEERR_AR or BUS_OBJERR) as long as the platform notifies the > > kernel in the synchronous poison consumption context, e.g. MCE on X86 > > and SEA on ARM64. > > So you want a SIGBUS that is delivered asynchronously instead of via > the page fault handler? Something like that is sort of what I ment by > "eliminate this path", though I didn't think keeping an async SIGBUS > was an option? Not really, I don't think an SIGBUS *async* to the poison consuming thread is critical, at least not as useful as SIGBUS *sync* to the poison consuming thread. > > Jason