Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp190605rwb; Mon, 26 Sep 2022 10:58:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wsBsCebcfO9jGiST8sfI8+9oxgSlK9c3HXgawEtmvNWrz44YzCXD79XFhBsuO2JAXQ5mD X-Received: by 2002:a17:90b:38c5:b0:202:67d9:7337 with SMTP id nn5-20020a17090b38c500b0020267d97337mr26611992pjb.158.1664215105279; Mon, 26 Sep 2022 10:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664215105; cv=none; d=google.com; s=arc-20160816; b=Fwzm/KH5E/sp+n02Dg9iJ6qR6jjEXHdx+VlcXzGOq6IlJca3WQCTLv8KKoRHU6AAnp 9ThIDx3FUE5iNbotH77Q2z7Tg4auhp3xDVCspKnDcHKfWXJc+jlsbeAS61eP+W3mJ/2S ejeqnwhVtDWwVkVFwMPjN+NcMxcRDNM0HQjmHQO9dz25D72QFzMnawKkwl0BWnDZhoRg O6EvPBNJd/gRMcvsn9JcPz8CkQ8oZnh1DjlCjdKhr/ba7pzANw2nieLtCSlojcF6rpoV 671xOs9b5/C3P4PRc1noxUCdEDoafRSqDg+YiUUJXYaVq0dWtqB5hfMDwgUYkJ05Yj+z TWWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=E+46GYYTGN9AHws4SONyVEtwpV8wYTn72IYXqTZynsQ=; b=u+w3ICRl7DLCu9CaBPPp86oK091pTQb0QM/Z9YgE0FYbygnqmyx0BkyRvd0HKB8X1m 8lGqoNBiJz873uk0Y2cC8fYkpzVcZrym0EVKkr67bojovfXG6kklo63E2UKfX5MtGNZk T3BoONtgWY0/DqLL/06YeIcxRaRpKZFVEHnJeyFYFjuo/ChV4c2f7n8AU3tpfDnp2RD9 +XLuKQ63vQpRe2WadjkNoca3IKHRQqhP2XNu5eGoRIntn+XCZEydvP9JYDsCI4oT1HWa DNh7hf6QKG5Kin4kog4+YfMFO94c19WtjIh3nzgAQL12P9Hroo8p+WA5e5UWVSIiE04x kzWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a170902d4c300b001768b832a41si15658406plg.584.2022.09.26.10.58.13; Mon, 26 Sep 2022 10:58:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229946AbiIZQax convert rfc822-to-8bit (ORCPT + 99 others); Mon, 26 Sep 2022 12:30:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbiIZQaS (ORCPT ); Mon, 26 Sep 2022 12:30:18 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C24FBE1C; Mon, 26 Sep 2022 08:19:49 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1ocptT-0006F9-1V; Mon, 26 Sep 2022 17:19:39 +0200 Date: Mon, 26 Sep 2022 17:19:39 +0200 From: Florian Westphal To: Michal Hocko Cc: Florian Westphal , netdev@vger.kernel.org, tgraf@suug.ch, urezki@gmail.com, Paolo Abeni , "David S. Miller" , Eric Dumazet , Jakub Kicinski , herbert@gondor.apana.org.au, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, Martin Zaharinov , Paolo Bonzini , kvm@vger.kernel.org Subject: Re: [PATCH net] rhashtable: fix crash due to mm api change Message-ID: <20220926151939.GG12777@breakpoint.cc> References: <20220926083139.48069-1-fw@strlen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michal Hocko wrote: > On Mon 26-09-22 10:31:39, Florian Westphal wrote: > > Martin Zaharinov reports BUG() in mm land for 5.19.10 kernel: > > kernel BUG at mm/vmalloc.c:2437! > > invalid opcode: 0000 [#1] SMP > > CPU: 28 PID: 0 Comm: swapper/28 Tainted: G W O 5.19.9 #1 > > [..] > > RIP: 0010:__get_vm_area_node+0x120/0x130 > > __vmalloc_node_range+0x96/0x1e0 > > kvmalloc_node+0x92/0xb0 > > bucket_table_alloc.isra.0+0x47/0x140 > > rhashtable_try_insert+0x3a4/0x440 > > rhashtable_insert_slow+0x1b/0x30 > > [..] > > > > bucket_table_alloc uses kvzalloc(GPF_ATOMIC). If kmalloc fails, this now > > falls through to vmalloc and hits code paths that assume GFP_KERNEL. > > > > I sent a patch to restore GFP_ATOMIC support in kvmalloc but mm > > maintainers rejected it. > > > > This patch is partial revert of > > commit 93f976b5190d ("lib/rhashtable: simplify bucket_table_alloc()"), > > to avoid kvmalloc for ATOMIC case. > > > > As kvmalloc doesn't warn when used with ATOMIC, kernel will only crash > > once vmalloc fallback occurs, so we may see more crashes in other areas > > in the future. > > > > Most other callers seem ok but kvm_mmu_topup_memory_cache looks like it > > might be affected by the same breakage, so Cc kvm@. > > > > Reported-by: Martin Zaharinov > > Fixes: a421ef303008 ("mm: allow !GFP_KERNEL allocations for kvmalloc") > > Link: https://lore.kernel.org/linux-mm/Yy3MS2uhSgjF47dy@pc636/T/#t > > Cc: Michal Hocko > > Cc: Paolo Bonzini > > Cc: kvm@vger.kernel.org > > Signed-off-by: Florian Westphal > > Please continue in the original email thread until we sort out the most > reasonable solution for this. I've submitted a v2 using Michals proposed fix for kvmalloc api, if thats merged no fixes are required in the callers, so this rhashtable patch can be discarded.