From patchwork Wed Nov 22 18:23:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13465349 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 8B62EC61DA7 for ; Wed, 22 Nov 2023 18:24:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15CFB6B0629; Wed, 22 Nov 2023 13:24:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E6E56B062B; Wed, 22 Nov 2023 13:24:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC8D06B062C; Wed, 22 Nov 2023 13:24:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D6F216B0629 for ; Wed, 22 Nov 2023 13:24:26 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8CAAEA138A for ; Wed, 22 Nov 2023 18:24:26 +0000 (UTC) X-FDA: 81486415332.03.38BA3A6 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by imf16.hostedemail.com (Postfix) with ESMTP id B4531180019 for ; Wed, 22 Nov 2023 18:24:24 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=U01DCosD; spf=pass (imf16.hostedemail.com: domain of fancer.lancer@gmail.com designates 209.85.208.176 as permitted sender) smtp.mailfrom=fancer.lancer@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700677464; a=rsa-sha256; cv=none; b=IQpd/K9Juvt+eJBgFqG1AsNjrQq2AMdGqtKD+IJTq/sQfToSeuleodAO/jWsNfJmHqF+kw dENrmiVfGj44QlkVllSKM43TItgub+TrJFFovX9FXf64clJ4oDKn+CHJbkoQVe3FHvfjct J52vok4RZFvcYKKH0ycvdQzVietSnxI= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=U01DCosD; spf=pass (imf16.hostedemail.com: domain of fancer.lancer@gmail.com designates 209.85.208.176 as permitted sender) smtp.mailfrom=fancer.lancer@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700677464; 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:references:dkim-signature; bh=pZqSoai9pFK0GqresiQ3Tq3Y3O3t4JmiFmz/3QD+TGg=; b=pwoh6AAnaxG1ts4oEdfFAlXjEPpzw63tdoLg4wpsvjEVEKMGlFNCSaTVsrpxdMheditMnl oOZgCwKuUEH07pT72+wGdr9enIGRX5jwkdask40hldEuVL0e6ZdBP50AEDA+5o+WCvBkDW PhIr0ZLJbP+6O4xdkzx5m97H5WcAIhc= Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2c875207626so994311fa.1 for ; Wed, 22 Nov 2023 10:24:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700677463; x=1701282263; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pZqSoai9pFK0GqresiQ3Tq3Y3O3t4JmiFmz/3QD+TGg=; b=U01DCosDbO9NDUCyHqH4E10agrliWbdxNv6Ys+JKu7WB/iWPW4WKN1uAVuIFfgToJP MIvRYTsVHINNzAFaOka92DfA9Ce0JkT/Tph1to9CYDwoGzplJ+ENZmeXPKnbgcxMsUWB eiNdvK+Pe7N9yTgUw8he6/c4vm00lkrjYoYkXPf6Ipk7+ViuNzOYNB6XhebuGLge/YNN cxGHNmq/t/UmUEyGTSsZmrNRORVoxkGQEK3u07fwQcMJDI82I6sXrjpPL+dTeKYl/tgY 1oaHFpgVtosU462aFdpRFks6FqK73oiA46Wmx6FJm81y9wZV/xAa14fVJq8SZQbFYV1T plUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700677463; x=1701282263; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pZqSoai9pFK0GqresiQ3Tq3Y3O3t4JmiFmz/3QD+TGg=; b=LdEbUFjEGmrchu3xrYiqrLxuzVK47JVx7LGfnf58OLz1Q1uC5fdIHjEqwmGB9kRNBP 1QNu0maTVVnGsu/MVKSmMgmv76KYvXX3HvBOrqSpeaOGWtV1FIrOFbXoqSl0/K5sG01O zv6Pm2rArqVa/ZVfQ/paqmY+2M4i7z9naiPSd2LMgaJfefmauTCuJP1UlEx4CgxiiUGQ f06PcfvRfQ1Sdy8eMknAqw5kewQqUh9xVwJZtcsxyexZQLGHqCrkcfWqv3qjUdPfxu0Z wkRCDAqZs0F64EFt5EUF0UmpLI8C6jfBUISwGicXJTkhhyecITGf37vecEHi27BvFLLk 8+DQ== X-Gm-Message-State: AOJu0YzBEHnZsW/V1HL011ZX7nM2RAkG01TJP7aW+rD71kVX/FecubNu cUEY5MBgTtwdEmSr/Si1hQY= X-Google-Smtp-Source: AGHT+IEdXztrfEOfr2tODY/5p4eV//O7lSRUCCr4vRo1zq1D8sIg0ukQ4XcMXDtJo1WCQTaJ0w3pkQ== X-Received: by 2002:a2e:a9a6:0:b0:2c5:8a4:9e6f with SMTP id x38-20020a2ea9a6000000b002c508a49e6fmr2531940ljq.37.1700677462609; Wed, 22 Nov 2023 10:24:22 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id f16-20020a2e9510000000b002bc3fbe9fd5sm11819ljh.55.2023.11.22.10.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 10:24:21 -0800 (PST) From: Serge Semin To: Thomas Bogendoerfer , Andrew Morton , Mike Rapoport , Matthew Wilcox Cc: Serge Semin , Alexey Malahov , Arnd Bergmann , Aleksandar Rikalo , Aleksandar Rikalo , Dragan Mladjenovic , Chao-ying Fu , Jiaxun Yang , Yinglu Yang , Tiezhu Yang , Marc Zyngier , linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/7] MIPS: mm: Fix some memory-related issues Date: Wed, 22 Nov 2023 21:23:58 +0300 Message-ID: <20231122182419.30633-1-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.42.1 MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: B4531180019 X-Stat-Signature: cdmygem386zno3rttoquo7h3z5eimwq9 X-Rspam-User: X-HE-Tag: 1700677464-538396 X-HE-Meta: U2FsdGVkX19Sqke/7uOImVu4NR1o0tsR4AiHPnFRt/hNsZKg7cH26TEWCbxyqIv6/yfaX10OXk21ZLuQwZp5VDAjLhx1SiKSbRLArQ31fagPJlqGNJFgSPBRtvY6yJfiW1XjYXdCXMn7+jco3uIj3NXf2bCUEBe7Rcehh1Xrq/BIgLHRakC+1XTDrrNfF8VCVc5SiQO1Nb3S+e162X/9SZOhTE+E8etT0zGJH0aKByV2rXmNYC+YmzxB67J8FvNBrWwZI6JuAj08QMJDVqb1qoafWYrKVMcW5pOvHrlA5cWK9T1FKTzdpdHiAw9OiAkahhODwE02YZCCbm9idi2/5O5ZYkVEDOTfB2dtW0aAPE2AhscTY0yL0QrlXV8sgaFxdL/j4pFMxq4W/mbb7jVGd8MbFGm5xT+b5jrx3h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m3r/8wESsvhndcVxKn5upqb/ba/P4bPHjfY/ld2pDXaw8nCvNCHmQyV2ZyNaxResgYgJeBXET9IWwb8N/M/M6rY9D8+kx8XrkmCkq6a0mca1NusY0WcVPFOD4duvzEsW6KFRBYdKL4JolGxmFYixqkSvhm6MNbGJl3rvRE/pL834y643yKJ7HMhLBt0MspO20hX32G6cgk6LwPb5EDAFqoilUarvcgY9YI8skcQntjOuBTzgi8lxBUwadbL520I6xxkkhCBnfT13rOdK/zaiJRkEfbOsxnrN2TTIk1l9RzaxtCKzmEXojPxBW+yylUyKW9cG13k4MITcURFBn2Sfu9bfVAdTw/bo5P1471bwZoaRWxTqj9f9ev9Ldo5CI2QpQqNPTHzHbys9DFUzKCXnimM82s8md+6vAD3CjyNbLqqMqWmPalD4sXvHK7HTFL3yuI3jB0EsAj5vPecRg== 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: Just recently I've rebased my MIPS32-related work from kernel 6.5-rc4 onto the latest kernel 6.7-rc1 and immediately got into a bootup-time mm-related bug (see patches 3-5 in this series). After fixing it I decided it was time to submit for review the generic MIPS code fixes which I have been collecting in my local repo for the last year. I was going to submit them a bit later after I finished working on a patchset with my SoC arch-specific changes, but since it was getting bigger and bigger, it turned to be reasonable to spill out the generic part of series right away especially seeing it might get to be useful in the most recent kernel. So this series starts with the MIPS-specific dmi_early_remap() implementation fix. It is utilized by the DMI driver in the framework of the dmi_setup() method, which is called at the very early boot stage - in setup_arch((). No VM available at that stage which is required for the ioremap_cache() to properly work. Thus it was a mistake to have the dmi_early_remap() macro-function defined as ioremap_cache(). It should have been ioremap_uc() in first place. After that goes a fix for the high-memory zone PFNs calculation procedure on MIPS. It turned out that after some not that recent commit the IO-memory PFNs got to the high-memory even though they were directly reachable, thus should have been left in the normal zone. Then a series of fixes for the recently discovered mm-bug is presented. Any attempt to re-map the IO-memory with the cached attribute caused the bootup procedure to crash with the "Unhandled kernel unaligned access" message. After some digging I found out that the problem was in the uninitialized IO-memory pages. Please see the patch "mips: Fix max_mapnr being uninitialized on early stages" description for the detailed explanation of the problem and suggested fix. Afterwards I submitted several cleanup patches for the MIPS/mm and generic mm code. The patchset is closed with a small improvement which sets the MIPS board/machine name to the dump-stack module in order to print arch-personalized oopses in the same way as it's done on ARM, ARM64, RISC-V, etc. That's it for today.) Thanks for review in advance. Any tests are very welcome. Signed-off-by: Serge Semin Cc: Alexey Malahov Cc: Arnd Bergmann Cc: Aleksandar Rikalo Cc: Aleksandar Rikalo Cc: Dragan Mladjenovic Cc: Chao-ying Fu Cc: Jiaxun Yang Cc: Yinglu Yang , Cc: Tiezhu Yang Cc: Marc Zyngier Cc: linux-mips@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Serge Semin (7): mips: dmi: Fix early remap on MIPS32 mips: Fix incorrect max_low_pfn adjustment mips: Fix max_mapnr being uninitialized on early stages mips: Optimize max_mapnr init procedure mm/mm_init.c: Extend init unavailable range doc info mm/mm_init.c: Append '\n' to the unavailable ranges log-message mips: Set dump-stack arch description arch/mips/include/asm/dmi.h | 2 +- arch/mips/kernel/prom.c | 2 ++ arch/mips/kernel/setup.c | 4 ++-- arch/mips/mm/init.c | 16 +++++++++------- mm/mm_init.c | 3 ++- 5 files changed, 16 insertions(+), 11 deletions(-) Reviewed-by: Mike Rapoport (IBM)