Received: by 2002:a9a:4c47:0:b029:116:c383:538 with SMTP id u7csp846751lko; Tue, 13 Jul 2021 11:21:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCpIVghyYsSDKvJJ5z6Fn3Y39Ko+W9cpU4ZMVZqctzuZQX5LVuRccD4NzSTPeWylD1Kr1o X-Received: by 2002:a05:6402:35d4:: with SMTP id z20mr7713102edc.138.1626200504593; Tue, 13 Jul 2021 11:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626200504; cv=none; d=google.com; s=arc-20160816; b=K9F3y5kGO47Nja6UWpg9D1yaqlGwcmVTpBelAvlJyYoBriqT1pLQDIeY/xsrSnLPXi pF5MduZRhsAYBeehES0Xihh7gqndW0PlxAT2zg14gt4U9GsnQNXpd3djn7ksSbhKRrEx UlCX5UIeRnNcMaEl4HBvab9neSifYeX0xPwuInFv1H2g6lJgEwxuQr0ch/5vjCkM2jdd UGBRTuptEN29R2fHkMS4vs/DdIsuq4xODyuJxDQuTaLTqYhujpOYFnv8ZFPuSlCJOkOB S7s0IimEDNprocPKMQyGVcw7WXE+h4sFGzKWPOHA2V5vwYzeSsgMj1xmrO2PZsj3Ig5f FZQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=aRaC7OVMrz5Ujr3/sIQbWqu+KvqFyZ7N29CishV8qI8=; b=oSF3zROIkwagiuZu/fbyTNessM5UhTASSnZUgkN9G0oqvjbMqwcyRT1s6/PDmqEBWD MQ/B1hmbWaFzbAL8SKOxpRE6giR3ncmfIfavzuOyNQFQ23DKfLLzzok5IwlX05QUtIWG bidX8QD2z+tjc5l/VBilacImyorr91sEHojsdNWh5tZCwKUXIWdyy5Vqc6vKbjxfBCC4 FrBORykVOFCsif4toWzytud3gM+nctt6yCvE79B4OCJxjuWd+j5gQVyrBXdmCXX0k33v K3Df1xfYBIE/MAEXz1mx+o8uVWUEmU9jmTfnO+nG5jJiFDpq8dGfRiJ6egc6++hMZYEo m/4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=evshTzDp; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr12si2472677ejc.222.2021.07.13.11.21.20; Tue, 13 Jul 2021 11:21:44 -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=@linux-foundation.org header.s=google header.b=evshTzDp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234205AbhGMSWm (ORCPT + 99 others); Tue, 13 Jul 2021 14:22:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbhGMSWl (ORCPT ); Tue, 13 Jul 2021 14:22:41 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B283C0613DD for ; Tue, 13 Jul 2021 11:19:51 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id v6so14755615lfp.6 for ; Tue, 13 Jul 2021 11:19:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aRaC7OVMrz5Ujr3/sIQbWqu+KvqFyZ7N29CishV8qI8=; b=evshTzDppfeY9x3hYIsbNOMJ8CcauD5TsOYP9DkJvBeA9GufJE6DS7GF9hzIYdco2U Ce24pDdOo6a5tEYP7o2VdLLkKU9jN9UvzKHmb1+3Oxta5JNmheikWDE+Xa5MVUzr1vtD D3iaeVutWKvAF4A3+StWWM6f05LexN09eZlRo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aRaC7OVMrz5Ujr3/sIQbWqu+KvqFyZ7N29CishV8qI8=; b=uXkGsSYSdZS0X3rSFwlxzITnat8qlj+RnYtpTg+vpOo8Cust5EMYCzgL+fu2Kh0BsE GAj2cGwjcZZmlB6MUMq09I+FPBE9glcNlaaSkPBGDc15CgbMCvWeF7d4cnGsKHZVQGxy HyTaSF0ynkxfI/pe4EDFVKpBSKfRqEzReCIA0n9GS1CRGS9iXJQRWvC+LI7EGnEnOLT2 38/vExFNHNKLHC70axwfJGplKetDDJjbq6EyC3jgIuLVWsAbRoFZYmfhwFXMaRgatUDM 8wun+/HLLsAstH0s45gXWirOXKwDHQB5LYDFBOlPAGC+lbXmFyrwCCE7ZWnCmiXjAycZ frQw== X-Gm-Message-State: AOAM531BsO4ZJjcEY83tv6Cu3IWMaHlrcFCRw+cuKT86ectUoNG1sXUD TyqT8J5xBjVwlRMnjmFtZafNR0qHq/JenNTCGmE= X-Received: by 2002:ac2:4294:: with SMTP id m20mr4596666lfh.6.1626200389175; Tue, 13 Jul 2021 11:19:49 -0700 (PDT) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com. [209.85.208.174]) by smtp.gmail.com with ESMTPSA id c30sm198982lfv.19.2021.07.13.11.19.46 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jul 2021 11:19:46 -0700 (PDT) Received: by mail-lj1-f174.google.com with SMTP id b40so31321343ljf.12 for ; Tue, 13 Jul 2021 11:19:46 -0700 (PDT) X-Received: by 2002:a2e:81c4:: with SMTP id s4mr5223246ljg.251.1626200385898; Tue, 13 Jul 2021 11:19:45 -0700 (PDT) MIME-Version: 1.0 References: <20210713142414.GA28943@xsang-OptiPlex-9020> In-Reply-To: <20210713142414.GA28943@xsang-OptiPlex-9020> From: Linus Torvalds Date: Tue, 13 Jul 2021 11:19:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [mm/vmalloc] 5c1f4e690e: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c To: kernel test robot , Uladzislau Rezki , Mel Gorman Cc: Hillf Danton , Matthew Wilcox , Michal Hocko , Nicholas Piggin , Oleksiy Avramchenko , Steven Rostedt , Andrew Morton , LKML , lkp@lists.01.org, kernel test robot Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 13, 2021 at 7:06 AM kernel test robot wrote: > > [ 131.014885] BUG: sleeping function called from invalid context at mm/page_alloc.c:4992 Strange. The call chain doesn't actually seem to be anything off: it's writev -> sock_write_iter -> sock_sendmsg -> netlink_sendmsg -> vmalloc. All good to sleep as far as I can tell. The warning itself seems to be just might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM); in prepare_alloc_pages(). I don't see what's wrong with that commit, but it does seem to be very consistent, in that the parent doesn't have it: > +----------------------------------------------------------------------+------------+------------+ > | | a2afc59fb2 | 5c1f4e690e | > +----------------------------------------------------------------------+------------+------------+ > | BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c | 0 | 54 | > +----------------------------------------------------------------------+------------+------------+ Does anybody see what the problem is there? There's an odd report _after_ the warning: [ 131.345319] raw_local_irq_restore() called with IRQs enabled [ 131.366561] RIP: 0010:warn_bogus_irq_restore+0x1d/0x20 [ 131.433334] __alloc_pages_bulk+0xbb8/0xf20 but I think that's might be a result of the BUG(). Maybe. But it might also be indicative of some context confusion - do we end up nesting? Because the BUG() has [ 131.036625] hardirqs last disabled at (283042): [] __alloc_pages_bulk+0xae1/0xf20 which means that the might_sleep_if() happens _after_ __alloc_pages_bulk() has disabled interrupts. That would explain it, but the stack_depot_save() thing actually makes that call chain really hard to read because it duplicates the addresses on the stack. I don't see the nesting there, but that's what it kind of smells like to me. Anybody? Linus