Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp157594pxx; Wed, 28 Oct 2020 01:02:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqaxBiNmIHUNIBtorq2Yw1e2v2OT3HCv61tvJhbgSUrHdziKl5UFN4fqmWQMYll3lwg49Q X-Received: by 2002:a17:907:2084:: with SMTP id pv4mr6655423ejb.315.1603872148054; Wed, 28 Oct 2020 01:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603872148; cv=none; d=google.com; s=arc-20160816; b=p2l75cRu898Ok7c8idOYcPbqYasEZ4pGYNNsuqM1mZ5+TlmsRhOqZzunHTMHF1ZKNv nlxBdo30r/y9+eLhDiweK6+cF/i1s9VgB/z1ZgpLZXdxdqkpxcYNn7zV6lakj2+RKC62 U/Z+ky16YBx8gMVKfhW4t4WryG9b2OJwe/UrP8iLhn4JOz8CSY4tJGq377bKyX0/io9f 7xngpUJHfb7IhTEPHZbQxfotr0YKSL+g5vNbRcuBfU4l4w/FkXF1QIeMZjNjLlM2JxE+ 3Q29vqpvoldRgfSSp+DpDGQ0MCvJFRSXA04PLbo64HGiuMh0uVyYIE3CM363hFBNKeEU dmCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YX4b10vWEmVqyZR39DPV45pHKCt8XOyLx0j80WJU58Y=; b=qkZGkazbckx0EDt9TFFZSbk7LjyPbBoTTuoS0Zqojt1kX+uXlfUmnVP+WhkjiW/60H 1fzpN3I8p8DQTThdisGzPoNkoMyXoSlbaI8hCEmRlLg1LP0o4WkCDPWScJUu9txGfokx m9NAqeuSQfPwVC1TpsyteoEekFNzOJiMt9cAxgw0PcgjsZmIVEi8Qe0GWb0Q8TDBXUF9 Wq63f+TD6CSYH23x5XzV5r/AOmFfty6DYmHzzBDv37lwud0LWsYyFICaPiEbXrYXh0m0 KP/fhE9KpMJaFOeYwhrVHDZaHJNBaP2ZoKVdwu/Zh+l93uiRvmEjOteGCwkbpGzL7UsA BGLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uNXAfI3u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si2705925ejr.482.2020.10.28.01.02.06; Wed, 28 Oct 2020 01:02:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uNXAfI3u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S368095AbgJ0N4z (ORCPT + 99 others); Tue, 27 Oct 2020 09:56:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:43294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S368092AbgJ0N4y (ORCPT ); Tue, 27 Oct 2020 09:56:54 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B488F2074B; Tue, 27 Oct 2020 13:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807013; bh=vYqHa6lv0tcd1MlRaQ+jJjgy7UFuZEKXGYbCMNvfk1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uNXAfI3u+ce9dZPVwJP/PwrbNLH7wCt+nkC2Jh4YaXpR67ZBH5oTdTurA7KXHXJk0 /3god1EIQc9SpvYhvrbzvpZ/Bjm1Hra7cCrpNJajmsh/hRg0g/WxSMt0KCy+QUBuHq FTL/990ZcMg4xgQVoxSCHWDlAdSiit6lOBzytmho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tobias Regnery , Andrey Ryabinin , kasan-dev@googlegroups.com, Alexander Potapenko , "Paul E . McKenney" , Dmitry Vyukov , Thomas Gleixner , Ben Hutchings Subject: [PATCH 4.4 011/112] x86/mm/ptdump: Fix soft lockup in page table walker Date: Tue, 27 Oct 2020 14:48:41 +0100 Message-Id: <20201027134901.090009773@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Ryabinin commit 146fbb766934dc003fcbf755b519acef683576bf upstream. CONFIG_KASAN=y needs a lot of virtual memory mapped for its shadow. In that case ptdump_walk_pgd_level_core() takes a lot of time to walk across all page tables and doing this without a rescheduling causes soft lockups: NMI watchdog: BUG: soft lockup - CPU#3 stuck for 23s! [swapper/0:1] ... Call Trace: ptdump_walk_pgd_level_core+0x40c/0x550 ptdump_walk_pgd_level_checkwx+0x17/0x20 mark_rodata_ro+0x13b/0x150 kernel_init+0x2f/0x120 ret_from_fork+0x2c/0x40 I guess that this issue might arise even without KASAN on huge machines with several terabytes of RAM. Stick cond_resched() in pgd loop to fix this. Reported-by: Tobias Regnery Signed-off-by: Andrey Ryabinin Cc: kasan-dev@googlegroups.com Cc: Alexander Potapenko Cc: "Paul E . McKenney" Cc: Dmitry Vyukov Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20170210095405.31802-1-aryabinin@virtuozzo.com Signed-off-by: Thomas Gleixner [bwh: Backported to 4.4: adjust context] Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- arch/x86/mm/dump_pagetables.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -407,6 +408,7 @@ static void ptdump_walk_pgd_level_core(s } else note_page(m, &st, __pgprot(0), 1); + cond_resched(); start++; }