From patchwork Thu May 9 10:01:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 13659613 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 97B9CC25B4F for ; Thu, 9 May 2024 10:02:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E2F1F6B008C; Thu, 9 May 2024 06:02:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB82E6B0092; Thu, 9 May 2024 06:02:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0B206B0093; Thu, 9 May 2024 06:02:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A4A5A6B008C for ; Thu, 9 May 2024 06:02:12 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 541871A1277 for ; Thu, 9 May 2024 10:02:12 +0000 (UTC) X-FDA: 82098416904.15.3D5DEBD Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf29.hostedemail.com (Postfix) with ESMTP id 27352120021 for ; Thu, 9 May 2024 10:02:09 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=iJNOMk0u; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=BJLLF2tH; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=iJNOMk0u; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=BJLLF2tH; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf29.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715248930; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KNxNDL8CliX5ScNdOouEVQHYdAYZp10dvdvoP0daPnA=; b=e9rhV2cKjlJF7Ou/icz2TS/eDuMfXmrhYoHSIqQQG35S7LiysJd6yaKgLr+TLU/r4XQu6F +yZC1XgugjMQHaLI54fpsgLCWmZyh7GY6nYzkE52OUrxrgJPy7VMDsY0XmVpFovDmltj1x L7ZfxRL94TASV+hu5no7iQ/2oaN/hSY= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=iJNOMk0u; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=BJLLF2tH; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=iJNOMk0u; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=BJLLF2tH; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf29.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715248930; a=rsa-sha256; cv=none; b=LrE0VtlX8cJ29HtQ5T7DwN0CxGTgwk29x0RA8toBI3kUSJZFOgW/Y4Sp6A3HnNZOBWRo+6 eSAFmZOq+RL3cxyJ/pEhnalciqjtl+Iw3Z50dKJzhyBoLN5R4nOy5F8dA9g9eRJIzsGGOH KmmGym8v/MNtx7Kydb6BTtTUEbkhnZ4= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B69B63822C; Thu, 9 May 2024 10:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715248928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KNxNDL8CliX5ScNdOouEVQHYdAYZp10dvdvoP0daPnA=; b=iJNOMk0uj9LwE54I1NK+1wuLoKmWR8NHqhes5O0I6nOw2c0mgraRXO0Jn5VZIuDLYGh8WS XcmF6vOUjsrojborzt5SKJXT59+bt3kWiKstg7jsjI3QWd4LXFKhG1LP46od9hRQLxmr7p yT7UKaS6mpNX7jmSgsKBmvAkwgfpFoI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715248928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KNxNDL8CliX5ScNdOouEVQHYdAYZp10dvdvoP0daPnA=; b=BJLLF2tHIR9ux5RHDbXoVxPGdfKBT9VErnyoHGNXwFuOttgPANSzh7bCOXm8+QpgRObb0/ hsyZrh8Mu80ggSCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715248928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KNxNDL8CliX5ScNdOouEVQHYdAYZp10dvdvoP0daPnA=; b=iJNOMk0uj9LwE54I1NK+1wuLoKmWR8NHqhes5O0I6nOw2c0mgraRXO0Jn5VZIuDLYGh8WS XcmF6vOUjsrojborzt5SKJXT59+bt3kWiKstg7jsjI3QWd4LXFKhG1LP46od9hRQLxmr7p yT7UKaS6mpNX7jmSgsKBmvAkwgfpFoI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715248928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KNxNDL8CliX5ScNdOouEVQHYdAYZp10dvdvoP0daPnA=; b=BJLLF2tHIR9ux5RHDbXoVxPGdfKBT9VErnyoHGNXwFuOttgPANSzh7bCOXm8+QpgRObb0/ hsyZrh8Mu80ggSCw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DC2DD13941; Thu, 9 May 2024 10:02:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id QOsjMx+fPGZbOAAAD6G6ig (envelope-from ); Thu, 09 May 2024 10:02:07 +0000 From: Oscar Salvador To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Muchun Song , Peter Xu , Axel Rasmussen , Liu Shixin , Oscar Salvador Subject: [PATCH 1/2] mm/hugetlb: Add missing VM_FAULT_SET_HINDEX in hugetlb_fault Date: Thu, 9 May 2024 12:01:47 +0200 Message-ID: <20240509100148.22384-2-osalvador@suse.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240509100148.22384-1-osalvador@suse.de> References: <20240509100148.22384-1-osalvador@suse.de> MIME-Version: 1.0 X-Rspamd-Action: no action X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 27352120021 X-Stat-Signature: m5c3yijq97k65uzd1r83m9aw8ck7p7j5 X-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RBhBw/XkZ2XpsiJp+GsDzvzjUirDOc8jUfqYnsttRz5d1If3EWZWM3GRgJCh3cw6tWLYDXDlXOU69zrxocCJaTGFEA7+FefIOm73jfIYjwTljvsZpFqDYeq6bSKZInx30p4Q5KBA9hoslJHkQR8LJHzTh4BGH1UJlu+oUPXfD7jWryKhpkt+2u7eTb86X79zwGwn5QZ0AT7zZ+/XRwT09Eokuw== 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: commit af19487f00f3 ("mm: make PTE_MARKER_SWAPIN_ERROR more general") added the code to handle pte_markers in hugetlb faulting path. In case of an UFFD_POISON event, a PTE_MARKER_POISONED will be created and we will return VM_FAULT_HWPOISON_LARGE upon detecting that in the fault path. Add the missing VM_FAULT_SET_HINDEX, so the right si_addr_lsb will be passed to userspace to report the extension of the faulty area. Signed-off-by: Oscar Salvador --- mm/hugetlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 33d175add044..262456daf327 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6485,7 +6485,8 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, pte_marker_get(pte_to_swp_entry(vmf.orig_pte)); if (marker & PTE_MARKER_POISONED) { - ret = VM_FAULT_HWPOISON_LARGE; + ret = VM_FAULT_HWPOISON_LARGE | + VM_FAULT_SET_HINDEX(hstate_index(h)); goto out_mutex; } }