Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1187405rwb; Tue, 29 Nov 2022 10:02:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf6t/ARqK+xEAN0nJoi9O9UaTZVLyOxZNhynPKYuUOE2MQebG418GS+P2swjokOG5xSZprLL X-Received: by 2002:aa7:8054:0:b0:56c:4303:a93d with SMTP id y20-20020aa78054000000b0056c4303a93dmr42435119pfm.73.1669744975538; Tue, 29 Nov 2022 10:02:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669744975; cv=none; d=google.com; s=arc-20160816; b=JyN5tsq4Y20Gkv9FdQrFlXKSH76gNIUlPJnBxiTUFIXWawt5YqkHVvA62BkQ3WQ1q2 O+EvVsq90EJVcNflqpqeqw/+3n7Gacr9bSkrUpu9bNPf1AUkLMJ3Xi4YT9WiYg+JrueD ClKafDP1eoItUtnm0dg6l1UtnRzxMs1/lobVnqLZCNRoTXg8pbNgBgDxKfg/qM66HFyN uGFh/WMuosSyB+N/yIBpEwd9ATeM0ELXFORGrQJMxLwSqy7YmLHn423CkhxBHFRA8+7d 4qFuW7QBmKI8krNfI2fatwY/vQBMJs7ZfS0bkMSCd4timI41Kj6u7AIKOm5pJFULY3mp ChTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=KhytdaBC2sPixvORWwPF2tvwHCP7gHgGggPJZT7LX6s=; b=fPvRlnACPx17v8XWMJxBMndJUaR+Llm6mivWlZR0v9K+CJgllV4MF/75rRsl1I6ggb CzBhIFn6omJOh0gPdvcL/itAaZ7x3do5m6tjX0NtW85dfKJnIQ2otaQQtzLTXDSvlr+3 3wLSO29S5DBRszXY1gnM1w7AFZHVgI6nwcUtCB4P5BbUf7UFDE7N6kxsoxYCyyvethw1 KLI4G6Sw5Inz2+i+TWsgu8poC8gZmCpkFhmr9dbdLu+8Xi1bt8XUCBgL14o+MDoS7xHe 39fmopvl+7oLh0ycudrf7axcb67jhlrxf9f/MxnXfP4x3OI7MG0srVibGAOvI8BccUc9 JTVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fMz6jko+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n1-20020a170902e54100b001869cf73143si16818941plf.314.2022.11.29.10.02.34; Tue, 29 Nov 2022 10:02:55 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fMz6jko+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235977AbiK2Qdx (ORCPT + 84 others); Tue, 29 Nov 2022 11:33:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234465AbiK2Qdu (ORCPT ); Tue, 29 Nov 2022 11:33:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E2A25F855; Tue, 29 Nov 2022 08:33:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3179AB8167C; Tue, 29 Nov 2022 16:33:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 621DEC433C1; Tue, 29 Nov 2022 16:33:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669739626; bh=1eCnX9wv/YcnjFLvGFP9MR+rIFG900hL1gZWW6akEu0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=fMz6jko+ubzb9ARnJH5NgEb0RBLex8Jk5ZeQKa2R2VPbTqFtDKqV0MW4SrR7vDEZ3 DXK4aUOQEzBZY2DNjx38EtgqK0KCPaESNevMwjbwGxf6eT24Sv1g0bIWyEy9ngSZkp zGd+g3qAVuTTRRBYZBord8yGmOJYy0XdleBpkQlSqRVL24d4RkMzbGh9MWbWfKk2Ah LA+ltdQafptIbVf0gaBx8MVNQWC3c2SVvvaEcUldq2sgRh+hTVrzrLapNb/EY7Ctb+ Z1jQUanCvcsqFePjllcxBCXw/LkeUeezqvLw1b9C7WOoAPu6WyaqqBR6tOrULzEMh9 HeqAwxY3QGRlQ== Message-ID: Date: Tue, 29 Nov 2022 09:33:45 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH net] net: Add a gfp_t parameter in ip_fib_metrics_init to support atomic context Content-Language: en-US To: Duoming Zhou , linux-kernel@vger.kernel.org Cc: davem@davemloft.net, yoshfuji@linux-ipv6.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org References: <20221129055317.53788-1-duoming@zju.edu.cn> From: David Ahern In-Reply-To: <20221129055317.53788-1-duoming@zju.edu.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,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 On 11/28/22 10:53 PM, Duoming Zhou wrote: > The ip_fib_metrics_init() do not support atomic context, because it > calls "kzalloc(..., GFP_KERNEL)". When ip_fib_metrics_init() is used > in atomic context, the sleep-in-atomic-context bug will happen. Did you actually hit this sleep-in-atomic-context bug or is it theory based on code analysis? > > For example, the neigh_proxy_process() is a timer handler that is > used to process the proxy request that is timeout. But it could call > ip_fib_metrics_init(). As a result, the can_block flag in ipv6_add_addr() > and the gfp_flags in addrconf_f6i_alloc() and ip6_route_info_create() > are useless. The process is shown below. > > (atomic context) > neigh_proxy_process() > pndisc_redo() > ndisc_recv_ns() > addrconf_dad_failure() > ipv6_add_addr(..., bool can_block) > addrconf_f6i_alloc(..., gfp_t gfp_flags) cfg has fc_mx == NULL. > ip6_route_info_create(..., gfp_t gfp_flags) rt->fib6_metrics = ip_fib_metrics_init(net, cfg->fc_mx, cfg->fc_mx_len, extack); > ip_fib_metrics_init() if (!fc_mx) return (struct dst_metrics *)&dst_default_metrics; > kzalloc(..., GFP_KERNEL) //may sleep >