From patchwork Tue Feb 9 08:24:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Tk9NVVJBIEpVTklDSEko6YeO5p2RIOa3s+S4gCk=?= X-Patchwork-Id: 12077397 X-Patchwork-Delegate: bpf@iogearbox.net 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=-11.6 required=3.0 tests=BAYES_00, CHARSET_FARAWAY_HEADER,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,PDS_BAD_THREAD_QP_64,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 2B25AC433E0 for ; Tue, 9 Feb 2021 08:27:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD77264E92 for ; Tue, 9 Feb 2021 08:27:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229678AbhBII1T (ORCPT ); Tue, 9 Feb 2021 03:27:19 -0500 Received: from mail-eopbgr1400072.outbound.protection.outlook.com ([40.107.140.72]:27133 "EHLO JPN01-TY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229743AbhBII1J (ORCPT ); Tue, 9 Feb 2021 03:27:09 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bU1g0TuUvfIvaSfF3oyfirYltb55TXYUCq7epHxM4OEPTv+OgdxeL0C4Vpo+9CXDDlaUI0lhB3tqGsmlBt85kdpeIbTgtrpn8IsNnh85Md102mVluHmX1MADNvPQryhP0MOBAdO1CuFWcBEHnS5lyZGy450oofFEKNeABu/24+M+W41POoWquexH4U8QaOCCdEMKtqz00b0zKzucGfGGYjH8x5tpqkRp73gnIMhcsPxWUI9fWPy9I7ypixqBTxEhEnMVpw/tspf0xGFTkqwPOU+PS/8JhxjJtCCfaEGf6Db33kwHp1B+FimsifE0Nl9BfoxdBynVnVvpqyecW4H/yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yNUfV1UQmMsM5fsHWJfn2pSx7A0sFASAduk7Akup3p8=; b=MGpwPCstEtHmnp72z+IbiRx+Iimjlak3wILfJwm17WD8+UONZYvjYz266UH2WSP8b8Bu4n6RlTX/Js17K+8lLfawaYudu5UnzyO0zsX8BXYnzqjGr8TyYoWyJtX1X7TWKBYFLL36FU2Q82T+sGD/deEy4DEgwwpZJ7q3ikiWgy9fxkl6z1ecUaRTD/8ufPbwcXT2aF0/YgpGtlA3iR0x1apgp/a10nf2Prm77Twi0Mz3rbhE+tvH/aM7atTy5BKOBoD402+MWaPch81E+tRgqB4bXOKhSaFDcNjQ1UgO7MarAf7ONMfn/b80jBuuoO19HVuhFvAvaVeDQ32wkAYGMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nec.com; dmarc=pass action=none header.from=nec.com; dkim=pass header.d=nec.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nec.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yNUfV1UQmMsM5fsHWJfn2pSx7A0sFASAduk7Akup3p8=; b=jWcC2SxrpkVoOwPROUkhjtqLQIU18a8q0Bpj6Vd3eBqj8xnk9+7/JhgLEAaC9Vh4y1HxZmMgK3LNa3TZm1EQb8UG2XPnPncu0/33Q26VQeqnVayud0FEdftcNM9l4eIkMjfQxyzXMZqh95jqHxoMskUqupPYUAFgbKdl86OFZTY= Received: from OSBPR01MB2229.jpnprd01.prod.outlook.com (2603:1096:603:20::11) by OS3PR01MB6134.jpnprd01.prod.outlook.com (2603:1096:604:d0::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.20; Tue, 9 Feb 2021 08:24:52 +0000 Received: from OSBPR01MB2229.jpnprd01.prod.outlook.com ([fe80::9c64:96a9:41a5:98e4]) by OSBPR01MB2229.jpnprd01.prod.outlook.com ([fe80::9c64:96a9:41a5:98e4%5]) with mapi id 15.20.3825.030; Tue, 9 Feb 2021 08:24:52 +0000 From: =?iso-2022-jp?b?Tk9NVVJBIEpVTklDSEkoGyRCTG5CPCEhPV8wbBsoQik=?= To: "bpf@vger.kernel.org" , "netdev@vger.kernel.org" CC: "ast@kernel.org" , "daniel@iogearbox.net" , "toke@redhat.com" , =?iso-2022-jp?b?Tk9NVVJBIEpVTklDSEko?= =?iso-2022-jp?b?GyRCTG5CPCEhPV8wbBsoQik=?= , "linux-kernel@vger.kernel.org" Subject: [PATCH bpf] devmap: Use GFP_KERNEL for xdp bulk queue allocation Thread-Topic: [PATCH bpf] devmap: Use GFP_KERNEL for xdp bulk queue allocation Thread-Index: AQHW/r0Jwmd5e9huskOKvbv+Dh9u7w== Date: Tue, 9 Feb 2021 08:24:52 +0000 Message-ID: <20210209082451.GA44021@jeru.linux.bs1.fc.nec.co.jp> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=nec.com; x-originating-ip: [165.225.110.205] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0ab03ced-6651-493e-cb8d-08d8ccd42c4b x-ms-traffictypediagnostic: OS3PR01MB6134: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1169; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7+ABFw7bC3Qz7wZBOlUO4ylXYyNebcNpHMtGbvQgtckCd4Seg3ZaIxPvAwZvJgsPNpYSNxfxCzScS9aUyCaJXHMooiGANWdxGszZGfLCaXKOxrVusppjxhWl7Q00WXLDtt5Oxt7ba5/tVSQ0yoR5lDojowP8PVSJHIbIz6rZBGCOeRv71JOKAMEQAJlD9dDzg/5DNXIxvXUDlTspGViW1pWmiHUQjHs7sD/+CnKNZbZg8hF73p/L45gaifs0IzQyy1OFBB6/T1vuBRHfyUfp2JzbzL2ULBLwj537pOyzGrKdZrhlMvZFWxX+Q+dwejIDO5vNMvOzUqj3N/4iJsq/SufqL/2EcA4/rTwEVVVFSE1W3xvsiPOf1noaDB8AQAamFTYJf8H+kDy92bUbQFdqNfMlA4NkcK4tRvUAERM7jmrkUCuySKZCDXffQUNQ7aXu+x2aISPvCHkza7rBzmwhVJohenTAIPk9sN/MogTZB/BxxAWFFvkNOhS6kF9jHdBESfyFIz+Jpdn4kB2T/AxNSA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:OSBPR01MB2229.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(136003)(376002)(39860400002)(396003)(346002)(1076003)(8936002)(83380400001)(86362001)(55236004)(6486002)(6506007)(5660300002)(66556008)(9686003)(91956017)(316002)(4326008)(8676002)(26005)(54906003)(110136005)(76116006)(66946007)(71200400001)(478600001)(33656002)(186003)(2906002)(85182001)(66476007)(6512007)(64756008)(66446008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-2022-jp?b?NWVTN1JXZElEVWxsWFpCT2Vl?= =?iso-2022-jp?b?U3o2OTRpUE9ZSmd4eHVjZGRsMEFDRm8yYmQxTXRRMlNwS0xJd2J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kNyRVJUY21iR3pHY2lDZ2kvSVNJOFc1WmxRTk51SERzcE9W?= =?iso-2022-jp?b?eFZCaU05ZVZEdkUyRjg0L1hWZ20ralZtQUxWeHFKZ2hIY1YyMC8xOEl1?= =?iso-2022-jp?b?WXJwdz09?= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: nec.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: OSBPR01MB2229.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ab03ced-6651-493e-cb8d-08d8ccd42c4b X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Feb 2021 08:24:52.0603 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: e67df547-9d0d-4f4d-9161-51c6ed1f7d11 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 3kUG/zCkuwotszdTMdxQt/RWnNyVc6jcbY3RhYa+F0EJBKtkJbmJXkgSzE+gCMFYPQnJ6c+CXMQX7JtTZB/3lQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB6134 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net The devmap bulk queue is allocated with GFP_ATOMIC and the allocation may fail if there is no available space in existing percpu pool. Since commit 75ccae62cb8d42 ("xdp: Move devmap bulk queue into struct net_device") moved the bulk queue allocation to NETDEV_REGISTER callback, whose context is allowed to sleep, use GFP_KERNEL instead of GFP_ATOMIC to let percpu allocator extend the pool when needed and avoid possible failure of netdev registration. As the required alignment is natural, we can simply use alloc_percpu(). Signed-off-by: Jun'ichi Nomura diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index f6e9c68afdd4..f4d3fe8e0652 100644 --- a/kernel/bpf/devmap.c +++ b/kernel/bpf/devmap.c @@ -803,8 +803,7 @@ static int dev_map_notification(struct notifier_block *notifier, /* will be freed in free_netdev() */ netdev->xdp_bulkq = - __alloc_percpu_gfp(sizeof(struct xdp_dev_bulk_queue), - sizeof(void *), GFP_ATOMIC); + alloc_percpu(struct xdp_dev_bulk_queue); if (!netdev->xdp_bulkq) return NOTIFY_BAD;