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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=no 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 145DCC433E6 for ; Wed, 24 Feb 2021 00:52:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D69BA64E5C for ; Wed, 24 Feb 2021 00:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232476AbhBXAsx (ORCPT ); Tue, 23 Feb 2021 19:48:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:57598 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234679AbhBXAEj (ORCPT ); Tue, 23 Feb 2021 19:04:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 24ED164EBB; Tue, 23 Feb 2021 23:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1614124687; bh=bZ30MhhE5ZCrYTDGI5TcYFn+yUYa2L1/c+U8urUIaA4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kaapH1nbcdcQTJjVB/1rgD+6QVpXSAmgx1NeeiD1BMDUwFxjTECDcfPkS2nuKqSci 3iVmmRgvGAhyh4FfSYtP0YpF6Eq/Pe41wmPu02zccRS8joqNtZn5/kWDRXt1u9k2pc pju/+VdtnLSWiaetDQHxm/9ySwEzRQCLmsJy3PjQ= Date: Tue, 23 Feb 2021 15:58:06 -0800 From: Andrew Morton To: Mike Kravetz Cc: Gerald Schaefer , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Hocko , Heiko Carstens , Sven Schnelle Subject: Re: [RFC] linux-next panic in hugepage_subpool_put_pages() Message-Id: <20210223155806.8e2284682df5d08ce9b3da68@linux-foundation.org> In-Reply-To: <3c536d3c-a180-301b-5cb7-c737a178a9d7@oracle.com> References: <20210223155740.553df3ee@thinkpad> <3c536d3c-a180-301b-5cb7-c737a178a9d7@oracle.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Feb 2021 10:06:12 -0800 Mike Kravetz wrote: > On 2/23/21 6:57 AM, Gerald Schaefer wrote: > > Hi, > > > > LTP triggered a panic on s390 in hugepage_subpool_put_pages() with > > linux-next 5.12.0-20210222, see below. > > > > It crashes on the spin_lock(&spool->lock) at the beginning, because the > > passed-in *spool points to 0000004e00000000, which is not addressable > > memory. It rather looks like some flags and not a proper address. I suspect > > some relation to the recent rework in that area, e.g. commit f1280272ae4d > > ("hugetlb: use page.private for hugetlb specific page flags"). > > > > __free_huge_page() calls hugepage_subpool_put_pages() and takes *spool from > > hugetlb_page_subpool(page), which was changed by that commit to use > > page[1]->private now. > > > > Thanks Gerald, > > Yes, I believe f1280272ae4d is the root cause of this issue. In that > commit, the subpool pointer was moved from page->private of the head > page to page->private of the first subpage. The page allocator will > initialize (zero) the private field of the head page, but not that of > subpages. So, that bad subpool pointer is likely an old page->private > value for the page. > > That strange call path from set_max_huge_pages to __free_huge_page is > actually how the code puts newly allocated pages on it's interfal free > list. > > I will do a bit more verification and put together a patch (it should > be simple). There's also Michel's documentation request: https://lkml.kernel.org/r/20210127102645.GH827@dhcp22.suse.cz