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 X-Spam-Level: X-Spam-Status: No, score=-9.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E5CCC11F66 for ; Tue, 29 Jun 2021 10:52:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DBBE161D95 for ; Tue, 29 Jun 2021 10:52:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBBE161D95 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DTyulJTz+3DQ8qWOhr+84tCmEGE2JezuIIgazLK23NI=; b=3CgGEiKojzDS/D LGORRDTgCyL8So4Qq2saJSDCyhYDpFNRq9BD+D5rn2hjECiJjpz1i16gspZxylAudxQwpSALTDe+c yoAlblLVHrP3KjqhqWRP/rXkGBiF8t/Rx20Eas//0rKiw+43YEW5g/fJSQVCltpTjpZZ2FqVgY+i5 97m5HqB1TWiXEZ+o6ggR6yG0R5qaBwB8PHyOq5C1k4ew9I0sIJITphwq9Ngph/JWFsZpoReo2HOug ESzfMs235BSqkw9SH2zOiOmbPdYu4I1A4OBNnJ9x6HtyJSy9OkKMaI3v1awbFdp1fxfxVpKr/dBsr u/QHxR51M3giOscssl4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyBKU-00AaDS-0b; Tue, 29 Jun 2021 10:50:58 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyBKP-00AaCg-Vn for linux-arm-kernel@lists.infradead.org; Tue, 29 Jun 2021 10:50:55 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15TAWvFt141358; Tue, 29 Jun 2021 06:50:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=pp1; bh=SQfXTniabRx7JvrPtUkKA0VCpbGXJvaVPkvvggAk3Vc=; b=JE9iWQsn4vjyTs1TBvZV4Y0DbIMEXmViMNRJxWdV0oL2Iw8yeoZbzzZBsBCLa/3ZHbuv qqO3jg/toSPX+orD3O9TG0wyXNcmlQlDkkuK+lbjvPcccFvlKYslsGUBMWqld8RGvU8k 9Ekts/ORb85I9jxwX1VQQo/JveEJaILgJ161c6Z+GwtVt+7Bo1A4TEE5tAkbLjfEJqnD /opQnIuec6HLxGV7C49HR0fogDlH2NhQm8ELAKviziIPUpzAmcWmuM9TIxeKpFPglU2k oXIozUxzKD3SnRdOU/Dowe6CAll2Y6eSQtedvUaYFvN/QM17+G0hl3HwaUPKYyNpB2PI 6A== Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 39fyxhbs2k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Jun 2021 06:50:43 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15TAgqaU011202; Tue, 29 Jun 2021 10:50:40 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 39duv8h7qk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Jun 2021 10:50:40 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15TAn2X036569494 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Jun 2021 10:49:02 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7435952051; Tue, 29 Jun 2021 10:50:38 +0000 (GMT) Received: from linux.ibm.com (unknown [9.145.56.105]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 60A5152052; Tue, 29 Jun 2021 10:50:37 +0000 (GMT) Date: Tue, 29 Jun 2021 13:50:35 +0300 From: Mike Rapoport To: Tony Lindgren Cc: Mike Rapoport , linux-arm-kernel@lists.infradead.org, Andrew Morton , Kefeng Wang , Russell King , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-omap@vger.kernel.org, regressions@lists.linux.dev Subject: Re: [PATCH v2 3/3] arm: extend pfn_valid to take into accound freed memory map alignment Message-ID: References: <20210519141436.11961-1-rppt@kernel.org> <20210519141436.11961-4-rppt@kernel.org> Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: qkx0DHBvkomsnZfbaZrMAmj29AlaLN37 X-Proofpoint-ORIG-GUID: qkx0DHBvkomsnZfbaZrMAmj29AlaLN37 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-29_05:2021-06-28, 2021-06-29 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 spamscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 bulkscore=0 phishscore=0 mlxscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106290072 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210629_035054_275504_D80865C7 X-CRM114-Status: GOOD ( 32.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Tue, Jun 29, 2021 at 11:54:02AM +0300, Tony Lindgren wrote: > Hi, > > * Mike Rapoport [210629 05:33]: > > On Mon, Jun 28, 2021 at 06:26:26PM +0300, Tony Lindgren wrote: > > > * Mike Rapoport [210628 14:07]: > > > > Can you please send log with 'memblock=debug' added to the command line? > > > > > > Sure, log now available at: > > > > > > http://muru.com/beagle-x15.txt > > > > Hmm, no clues yet :( > > > > Do you have CONFIG_DEBUG_VM, CONFIG_DEBUG_VM_PGFLAGS and > > CONFIG_PAGE_POISONING enabled in your config? > > If not, can you please enable them and see if any of VM_BUG_* triggers? > > OK enabled, and no errors or warnings are triggered. > > > Do you use FLATMEM or SPARSEMEM in your config? > > Looks like make omap2plus_defconfig enables FLATMEM: > > $ grep -e SPARSEMEM -e FLATMEM .config > CONFIG_ARCH_FLATMEM_ENABLE=y > CONFIG_ARCH_SPARSEMEM_ENABLE=y > CONFIG_FLATMEM_MANUAL=y > # CONFIG_SPARSEMEM_MANUAL is not set > CONFIG_FLATMEM=y > > > Let's try seeing what PFNs get false results from pfn_valid, maybe this > > will give a better lead. > > With your patch below, system boots with lots of the following: > > [ 13.058654] Freeing unused kernel image (initmem) memory: 1024K > ... > [ 13.129211] pfn_valid(__sync_icache_dcache+0x2c/0x138): pfn: fffb6: is_map: 1 overlaps: 0 > [ 13.137481] pfn_valid(__sync_icache_dcache+0x2c/0x138): pfn: fffb7: is_map: 1 overlaps: 0 ... > Then changing console loglevel to 0 boots system to login prompt. But I'm > seeing some init processes segfaulting during start-up. As it seems, the new version of pfn_valid() decides that last pages are not valid because of the overflow in memblock_overlaps_region(). As the result, __sync_icache_dcache() skips flushing these pages. The patch below should fix this. I've left the prints for now, hopefully they will not appear anymore. diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 6162a070a410..7ba22d23eca4 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -126,10 +126,16 @@ int pfn_valid(unsigned long pfn) { phys_addr_t addr = __pfn_to_phys(pfn); unsigned long pageblock_size = PAGE_SIZE * pageblock_nr_pages; + bool overlaps = memblock_overlaps_region(&memblock.memory, + ALIGN_DOWN(addr, pageblock_size), + pageblock_size - 1); if (__phys_to_pfn(addr) != pfn) return 0; + if (memblock_is_map_memory(addr) != overlaps) + pr_info("%s(%pS): pfn: %lx: is_map: %d overlaps: %d\n", __func__, (void *)_RET_IP_, pfn, memblock_is_map_memory(addr), overlaps); + /* * If address less than pageblock_size bytes away from a present * memory chunk there still will be a memory map entry for it @@ -137,7 +143,7 @@ int pfn_valid(unsigned long pfn) */ if (memblock_overlaps_region(&memblock.memory, ALIGN_DOWN(addr, pageblock_size), - pageblock_size)) + pageblock_size - 1)) return 1; return 0; -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel