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 76CCFC4332F for ; Tue, 8 Nov 2022 01:36:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F27A66B0074; Mon, 7 Nov 2022 20:36:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ED7DE8E0002; Mon, 7 Nov 2022 20:36:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA00E8E0001; Mon, 7 Nov 2022 20:36:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id CA17A6B0074 for ; Mon, 7 Nov 2022 20:36:36 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A01DF141032 for ; Tue, 8 Nov 2022 01:36:36 +0000 (UTC) X-FDA: 80108560392.17.4CB7595 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf18.hostedemail.com (Postfix) with ESMTP id 8BDD61C0008 for ; Tue, 8 Nov 2022 01:36:33 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4N5rKY40SMz15MKV; Tue, 8 Nov 2022 09:36:17 +0800 (CST) Received: from [10.174.151.185] (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 8 Nov 2022 09:36:27 +0800 Subject: Re: [PATCH v1] arch/x86/mm/hugetlbpage.c: pud_huge() returns 0 when using 2-level paging To: Naoya Horiguchi , CC: =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Andrew Morton , David Hildenbrand , Mike Kravetz , Liu Shixin , Yang Shi , Oscar Salvador , Muchun Song , Naoya Horiguchi , References: <20221107021010.2449306-1-naoya.horiguchi@linux.dev> From: Miaohe Lin Message-ID: <60d8bdb2-4d51-7b67-1b0d-df54d9403062@huawei.com> Date: Tue, 8 Nov 2022 09:36:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20221107021010.2449306-1-naoya.horiguchi@linux.dev> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667871395; a=rsa-sha256; cv=none; b=l5Gxbe+cCgA/ZZ3UEVi2e6BlQ3y9QR1taYqdmpRctvo9gD0P5FhZFgyjNukkgLelJy03B1 4VaNRlNYkE3DwRf0hFc8NtYvoIaA0dKsrhBQZh824qXADWzrvLPBLlykyu5WotwBnfs+/m kVxyXTtgfYZXB2x5F4/j4yAD+WRwtzU= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; spf=pass (imf18.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667871395; 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; bh=zonP1kLoMbobC6KN4JMz6NUWv86oDSymaUQJkp521+M=; b=8WFE6p02/gAC1aiC7Hds8jG7wS3mfjX/fdfEaqAV+5Gc1X8jI/heBQoL+ci0diZHzBWdx0 nLUH7gxt4TH/zDd2lab2a4er+o7gLIgCc6eBTwFvQruO0tECRwuSiuu1F7tryTXK2QpsvN yc7wcSTrQVn9PJSmlt4bdL8eVMHcX+0= Authentication-Results: imf18.hostedemail.com; dkim=none; spf=pass (imf18.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam12 X-Rspam-User: X-Stat-Signature: 78nt83ziozi3d7mcod6ffc7hksz3ud45 X-Rspamd-Queue-Id: 8BDD61C0008 X-HE-Tag: 1667871393-440979 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 2022/11/7 10:10, Naoya Horiguchi wrote: > From: Naoya Horiguchi > > The following bug is reported to be triggered when starting X on x86-32 > system with i915: > > [ 225.777375] kernel BUG at mm/memory.c:2664! > [ 225.777391] invalid opcode: 0000 [#1] PREEMPT SMP > [ 225.777405] CPU: 0 PID: 2402 Comm: Xorg Not tainted 6.1.0-rc3-bdg+ #86 > [ 225.777415] Hardware name: /8I865G775-G, BIOS F1 08/29/2006 > [ 225.777421] EIP: __apply_to_page_range+0x24d/0x31c > [ 225.777437] Code: ff ff 8b 55 e8 8b 45 cc e8 0a 11 ec ff 89 d8 83 c4 28 5b 5e 5f 5d c3 81 7d e0 a0 ef 96 c1 74 ad 8b 45 d0 e8 2d 83 49 00 eb a3 <0f> 0b 25 00 f0 ff ff 81 eb 00 00 00 40 01 c3 8b 45 ec 8b 00 e8 76 > [ 225.777446] EAX: 00000001 EBX: c53a3b58 ECX: b5c00000 EDX: c258aa00 > [ 225.777454] ESI: b5c00000 EDI: b5900000 EBP: c4b0fdb4 ESP: c4b0fd80 > [ 225.777462] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 EFLAGS: 00010202 > [ 225.777470] CR0: 80050033 CR2: b5900000 CR3: 053a3000 CR4: 000006d0 > [ 225.777479] Call Trace: > [ 225.777486] ? i915_memcpy_init_early+0x63/0x63 [i915] > [ 225.777684] apply_to_page_range+0x21/0x27 > [ 225.777694] ? i915_memcpy_init_early+0x63/0x63 [i915] > [ 225.777870] remap_io_mapping+0x49/0x75 [i915] > [ 225.778046] ? i915_memcpy_init_early+0x63/0x63 [i915] > [ 225.778220] ? mutex_unlock+0xb/0xd > [ 225.778231] ? i915_vma_pin_fence+0x6d/0xf7 [i915] > [ 225.778420] vm_fault_gtt+0x2a9/0x8f1 [i915] > [ 225.778644] ? lock_is_held_type+0x56/0xe7 > [ 225.778655] ? lock_is_held_type+0x7a/0xe7 > [ 225.778663] ? 0xc1000000 > [ 225.778670] __do_fault+0x21/0x6a > [ 225.778679] handle_mm_fault+0x708/0xb21 > [ 225.778686] ? mt_find+0x21e/0x5ae > [ 225.778696] exc_page_fault+0x185/0x705 > [ 225.778704] ? doublefault_shim+0x127/0x127 > [ 225.778715] handle_exception+0x130/0x130 > [ 225.778723] EIP: 0xb700468a > > Recently pud_huge() got aware of non-present entry by commit 3a194f3f8ad0 > ("mm/hugetlb: make pud_huge() and follow_huge_pud() aware of non-present > pud entry") to handle some special states of gigantic page. However, it's > overlooked that pud_none() always returns false when running with 2-level > paging, and as a result pmd_huge() can return true pointlessly. LGTM. Thanks for your fixing. Reviewed-by: Miaohe Lin Thanks, Miaohe Lin