Received: by 10.192.165.148 with SMTP id m20csp556384imm; Wed, 9 May 2018 18:28:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp5Ao50JReuykSYcKw/+DtemCgF0HDyooWfRy13zEhuKO41XzP13MfWUm5TKKXCoAgOuqCF X-Received: by 2002:a63:7250:: with SMTP id c16-v6mr36708792pgn.385.1525915717561; Wed, 09 May 2018 18:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525915717; cv=none; d=google.com; s=arc-20160816; b=La6d4nolR8HnvpB9xPIiVJqPMZ2TTl53/Y02KkZiL8C1g/T/LPqimwWIeBXRRFG65u yNDGJ2sn+M7cffkObVY+wVFycW1G1I37cAzSkmgELImBqQeiebqk54/4doMfsnlHYDcW uFS2gMCTaMdC9OJU+KwCUhSl3VLgmOi79sjyeFGn91Z1oAd4ua2Q9Tof+VxzOIEbtwC6 S8bwRX+d5R25B2GV5Idxt9HOH4+M1q5CSXuMk+HnrR7HGgIE9rOx1ZN7EjTjQQcJ1ghG Gf7MaxMfRERNVk3Zh5aiLwD+4JsPddsk24Q1KEWoX+/Sko467LadqNIM/iVsOGijKaB9 /+AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature:arc-authentication-results; bh=VIs/oprIURNf8M/PCmAkTKtzTQQaJgZvE3zRWVasDW0=; b=qvsNuzTcbEr93vB5xvN9CEFehVYP20Bx8AodNceBBFspdfkcZvCqCAsQ5zY2UGydXa z2EXoo/8d7aHLFSe5MRqioOehU1mJpBbJ+mvn8CDHJejHHswtilQrC9IQ3wuxNlxKRCd 9yvhSjp1KlsZDFvwmMP+9+yTU8GYMsJpQnJB4bsZv7Na8LsASfmnqnt9U2UStqXj4vLg Z1X2I4hEBIEmwq9rNAZHtssDCaRdf3AsWWIsN3bMtjPQjEk1S6BUHQNeMzLlklwGKT4k EP+b6YWX38qpZ9Nnj4xj+2tupzfFSASsgyQhPI1IYUftmupwHzsnrVaC6/KQNQdE+5iZ 1Y6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M4cEMUD9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5-v6si19704016pgn.339.2018.05.09.18.28.23; Wed, 09 May 2018 18:28:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M4cEMUD9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756452AbeEJB0h (ORCPT + 99 others); Wed, 9 May 2018 21:26:37 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:41456 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756088AbeEJB0f (ORCPT ); Wed, 9 May 2018 21:26:35 -0400 Received: by mail-pf0-f195.google.com with SMTP id v63-v6so238407pfk.8 for ; Wed, 09 May 2018 18:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=VIs/oprIURNf8M/PCmAkTKtzTQQaJgZvE3zRWVasDW0=; b=M4cEMUD9vGW4pSMjUeDmrn0JW2nHJk1+ADSdyTPYDGgvCUeJvegjRPOvVo+vzA35jy 0soU/kBoPAVcbae8bDqcWYFP1AjSIsJ752ZBKJnULO+eocB/NREr9nGBFdJlcSpoALMM IhCGuo/3isxt5mH+Rf1Ok69VpwO/Tfn+S9wFmiBUOeRyLbHnFk8GVK5nKRuV1So3A89+ MxdgUixxJP0SeJiQZCemsh4f1i2iioScRbb+EMWddiX6SqomcqjfMllfiFPSSngPW3+T ohIJ4OEpE8sSx67Dt4s8j1pON1G7YROsDZ+vAnp4B71ZFpCiekEhDGqeV3sLxx+jbrlm LTiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=VIs/oprIURNf8M/PCmAkTKtzTQQaJgZvE3zRWVasDW0=; b=M07MEOE2NTg6uwBedMwiiWjUrXUNyFZDGshI634we478mczqgY+0Rs4bxr6Ajiqvtv VlIYaBC7/x5qEI6NeXZx3K9/EIrqJpsjnJWyjwG4ijfK9EKP3QjAe6xoCNUxmeC3n0lM F137vl2HMQC/XjUvU0o6UdMLgRqGOCTPrVp4oPZlFaB6MnMh0H/qLG36BGgD5BIoL3OP JNe02rYfjQMwi62LEPSpIAjVAnTxdSzVYRXd7eH3tlxGWuy1WD7Qf6NjvCgxYEkpnSRh s+66HptfD7Gl2HTR+V1d6V7swfr+bkGfZdv158to/dZmx/TWzsk9n7TefI2J7PPCO+ZP I22A== X-Gm-Message-State: ALQs6tB9MkNUKkYkb+fV/76OYOpXLwqpCEvuFVnnM7ZhW4w6o989xBNo YKuDUyImMQ4XixEyRjhZWFA= X-Received: by 10.167.133.15 with SMTP id v15mr31916924pfn.144.1525915594766; Wed, 09 May 2018 18:26:34 -0700 (PDT) Received: from [0.0.0.0] (67.216.217.169.16clouds.com. [67.216.217.169]) by smtp.gmail.com with ESMTPSA id n73sm22570164pfb.167.2018.05.09.18.26.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 18:26:33 -0700 (PDT) Subject: Re: [PATCH v2] mm/ksm: ignore STABLE_FLAG of rmap_item->address in rmap_walk_ksm To: Andrew Morton Cc: Andrea Arcangeli , Minchan Kim , Claudio Imbrenda , Arvind Yadav , Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org, jia.he@hxt-semitech.com, Hugh Dickins References: <20180503124415.3f9d38aa@p-imbrenda.boeblingen.de.ibm.com> <1525403506-6750-1-git-send-email-hejianet@gmail.com> <20180509163101.02f23de1842a822c61fc68ff@linux-foundation.org> From: Jia He Message-ID: <80070c0b-aecf-0dcf-2b36-fa6110ed8ad5@gmail.com> Date: Thu, 10 May 2018 09:26:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180509163101.02f23de1842a822c61fc68ff@linux-foundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrew On 5/10/2018 7:31 AM, Andrew Morton Wrote: > On Fri, 4 May 2018 11:11:46 +0800 Jia He wrote: > >> In our armv8a server(QDF2400), I noticed lots of WARN_ON caused by PAGE_SIZE >> unaligned for rmap_item->address under memory pressure tests(start 20 guests >> and run memhog in the host). >> >> ... >> >> In rmap_walk_ksm, the rmap_item->address might still have the STABLE_FLAG, >> then the start and end in handle_hva_to_gpa might not be PAGE_SIZE aligned. >> Thus it will cause exceptions in handle_hva_to_gpa on arm64. >> >> This patch fixes it by ignoring(not removing) the low bits of address when >> doing rmap_walk_ksm. >> >> Signed-off-by: jia.he@hxt-semitech.com > I assumed you wanted this patch to be committed as > From:jia.he@hxt-semitech.com rather than From:hejianet@gmail.com, so I > made that change. Please let me know if this was inappropriate. Thanks, because there is still some issues in our company's mail server. I have to use my gmail mailbox. > > You can do this yourself by adding an explicit From: line to the very > start of the patch's email text. > > Also, a storm of WARN_ONs is pretty poor behaviour. Is that the only > misbehaviour which this bug causes? Do you think the fix should be > backported into earlier kernels? IMO, it should be backported to stable tree, seems that I missed CC to stable tree ;-) the stom of WARN_ONs is very easy for me to reproduce. More than that, I watched a panic (not reproducible) as follows: [35380.805825] page:ffff7fe003742d80 count:-4871 mapcount:-2126053375 mapping:          (null) index:0x0 [35380.815024] flags: 0x1fffc00000000000() [35380.818845] raw: 1fffc00000000000 0000000000000000 0000000000000000 ffffecf981470000 [35380.826569] raw: dead000000000100 dead000000000200 ffff8017c001c000 0000000000000000 [35380.834294] page dumped because: nonzero _refcount [35380.839069] Modules linked in: vhost_net vhost tap ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter fcoe libfcoe libfc 8021q garp mrp stp llc scsi_transport_fc openvswitch nf_conntrack_ipv6 nf_nat_ipv6 nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_defrag_ipv6 nf_nat nf_conntrack vfat fat rpcrdma ib_isert iscsi_target_mod ib_iser libiscsi scsi_transport_iscsi ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm mlx5_ib ib_core crc32_ce ipmi_ssif tpm_tis tpm_tis_core sg nfsd auth_rpcgss nfs_acl lockd grace sunrpc dm_multipath ip_tables xfs libcrc32c mlx5_core mlxfw devlink ahci_platform libahci_platform libahci qcom_emac sdhci_acpi sdhci hdma mmc_core hdma_mgmt i2c_qup dm_mirror dm_region_hash dm_log dm_mod [35380.908341] CPU: 29 PID: 18323 Comm: qemu-kvm Tainted: G W       4.14.15-5.hxt.aarch64 #1 [35380.917107] Hardware name: [35380.930909] Call trace: [35380.933345] [] dump_backtrace+0x0/0x22c [35380.938723] [] show_stack+0x24/0x2c [35380.943759] [] dump_stack+0x8c/0xb0 [35380.948794] [] bad_page+0xf4/0x154 [35380.953740] [] free_pages_check_bad+0x90/0x9c [35380.959642] [] free_pcppages_bulk+0x464/0x518 [35380.965545] [] free_hot_cold_page+0x22c/0x300 [35380.971448] [] __put_page+0x54/0x60 [35380.976484] [] unmap_stage2_range+0x170/0x2b4 [35380.982385] [] kvm_unmap_hva_handler+0x30/0x40 [35380.988375] [] handle_hva_to_gpa+0xb0/0xec [35380.994016] [] kvm_unmap_hva_range+0x5c/0xd0 [35380.999833] [] kvm_mmu_notifier_invalidate_range_start+0x60/0xb0 [35381.007387] [] __mmu_notifier_invalidate_range_start+0x64/0x8c [35381.014765] [] try_to_unmap_one+0x78c/0x7a4 [35381.020493] [] rmap_walk_ksm+0x124/0x1a0 [35381.025961] [] rmap_walk+0x94/0x98 [35381.030909] [] try_to_unmap+0x100/0x124 [35381.036293] [] unmap_and_move+0x480/0x6fc [35381.041847] [] migrate_pages+0x10c/0x288 [35381.047318] [] compact_zone+0x238/0x954 [35381.052697] [] compact_zone_order+0xc4/0xe8 [35381.058427] [] try_to_compact_pages+0x160/0x294 [35381.064503] [] __alloc_pages_direct_compact+0x68/0x194 [35381.071187] [] __alloc_pages_nodemask+0xc20/0xf7c [35381.077437] [] alloc_pages_vma+0x1a4/0x1c0 [35381.083080] [] do_huge_pmd_anonymous_page+0x128/0x324 [35381.089677] [] __handle_mm_fault+0x71c/0x7e8 [35381.095492] [] handle_mm_fault+0xf8/0x194 [35381.101049] [] __get_user_pages+0x124/0x34c [35381.106777] [] populate_vma_page_range+0x90/0x9c [35381.112941] [] __mm_populate+0xc4/0x15c [35381.118322] [] SyS_mlockall+0x100/0x164 [35381.123705] Exception stack(0xffff800dce5f3ec0 to 0xffff800dce5f4000) [35381.130128] 3ec0: 0000000000000003 d6e6024cc9b87e00 0000aaaabe94f000 0000000000000000 [35381.137940] 3ee0: 0000000000000002 0000000000000000 0000000000000000 0000aaaacf6fc3c0 [35381.145753] 3f00: 00000000000000e6 0000aaaacf6fc490 0000ffffeeeab0f0 d6e6024cc9b87e00 [35381.153565] 3f20: 0000000000000000 0000aaaabe81b3c0 0000000000000020 00009e53eff806b5 [35381.161379] 3f40: 0000aaaabe94de48 0000ffffa7c269b0 0000000000000011 0000ffffeeeabf68 [35381.169190] 3f60: 0000aaaaceacfe60 0000aaaabe94f000 0000aaaabe9ba358 0000aaaabe7ffb80 [35381.177003] 3f80: 0000aaaabe9ba000 0000aaaabe959f64 0000000000000000 0000aaaabe94f000 [35381.184815] 3fa0: 0000000000000000 0000ffffeeeabdb0 0000aaaabe5f3bf8 0000ffffeeeabdb0 [35381.192628] 3fc0: 0000ffffa7c269b8 0000000060000000 0000000000000003 00000000000000e6 [35381.200440] 3fe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 [35381.208254] [] __sys_trace_return+0x0/0x4 [35381.213809] Disabling lock debugging due to kernel taint I ever injected a fault on purpose in kvm_unmap_hva_range by set size=size-0x200, the call trace is similar as above. Thus, I thought the panic is similarly caused by the root cause of WARN_ON -- Cheers, Jia