From patchwork Wed Oct 19 11:55:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Tao X-Patchwork-Id: 13011665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7997EC433FE for ; Wed, 19 Oct 2022 12:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232552AbiJSMMC (ORCPT ); Wed, 19 Oct 2022 08:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232812AbiJSMLi (ORCPT ); Wed, 19 Oct 2022 08:11:38 -0400 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B6831781C9 for ; Wed, 19 Oct 2022 04:46:43 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4MspNy6Cq6z6R5KM for ; Wed, 19 Oct 2022 19:27:30 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAXCzKu309jwb9lAA--.56298S4; Wed, 19 Oct 2022 19:29:52 +0800 (CST) From: Hou Tao To: bpf@vger.kernel.org, Alexei Starovoitov Cc: Martin KaFai Lau , Andrii Nakryiko , Song Liu , Hao Luo , Yonghong Song , Daniel Borkmann , KP Singh , Stanislav Fomichev , Jiri Olsa , John Fastabend , houtao1@huawei.com Subject: [PATCH bpf 0/2] Wait for busy refill_work when destorying bpf memory allocator Date: Wed, 19 Oct 2022 19:55:37 +0800 Message-Id: <20221019115539.983394-1-houtao@huaweicloud.com>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xVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07UWE__UUUUU= X-CM-SenderInfo: xkrx3t3r6k3tpzhluzxrxghudrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net From: Hou Tao Hi, The patchset aims to fix the problem of bpf memory allocator destruction when there is PREEMPT_RT kernel or kernel with arch_irq_work_has_interrupt() being false (e.g. 1-cpu arm32 host). The root cause is that there may be busy refill_work when the allocator is destorying and it may incur oops or other problems as shown in patch #1. Patch #1 fixes the problem by waiting for the completion of irq work during destorying and patch #2 is just a clean-up patch based on patch #1. Please see individual patches for more details. Comments are always welcome. Hou Tao (2): bpf: Wait for busy refill_work when destorying bpf memory allocator bpf: Use __llist_del_all() whenever possbile during memory draining kernel/bpf/memalloc.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)