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: 379864 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, URIBL_BLOCKED autolearn=unavailable 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 45772C433DB for ; Tue, 9 Feb 2021 08:27:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB43064E92 for ; Tue, 9 Feb 2021 08:27:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229760AbhBII11 (ORCPT ); Tue, 9 Feb 2021 03:27:27 -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?Tk9NVVJB?= =?iso-2022-jp?b?IEpVTklDSEkoGyRCTG5CPCEhPV8wbBsoQik=?= , "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?NWVTN1JXZElEVWxsWFpC?= =?iso-2022-jp?b?T2VlU3o2OTRpUE9ZSmd4eHVjZGRsMEFDRm8yYmQxTXRRMlNw?= =?iso-2022-jp?b?S0xJd2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QWI0anlySVQwVFZRLzFnTnV1clRISnl3UjF3eGorOVJs?= =?iso-2022-jp?b?bXIwUTkxZXkzSkNyRVJUY21iR3pHY2lDZ2kvSVNJOFc1WmxR?= =?iso-2022-jp?b?Tk51SERzcE9WeFZCaU05ZVZEdkUyRjg0L1hWZ20ralZtQUxW?= =?iso-2022-jp?b?eHFKZ2hIY1YyMC8xOEl1WXJwdz09?= 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: netdev@vger.kernel.org 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;