Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp738590rdb; Mon, 29 Jan 2024 17:41:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIMTcylLJiVjVOHdHJ79iE7G3m4uSyTE107n1W4r+/zTL1VuNxaXl3NQ2aqPxyjpvyfh9P X-Received: by 2002:a37:e107:0:b0:783:e148:bdfa with SMTP id c7-20020a37e107000000b00783e148bdfamr5416217qkm.1.1706578866121; Mon, 29 Jan 2024 17:41:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706578866; cv=pass; d=google.com; s=arc-20160816; b=QDG4SxoW5s8N/TEW/OTXpcDt5/iqK74tJO59LgjgIZAe2Q69pWGhiOiZg3RTi7GOZQ kcvvkteInKmZA+iJsCQ3AqNHuYQzvlXjEDu18za/yZROClBZ6fvyBjalM07ZWXUbyxVi e6JgWbEnsLHjsUxFy9kRvs+4s+ip6/R3xProZ1MJ1L6vtWIkQ9MZ58ph2s7nbjStWkZt vzIOoqLchRPDeuE/MRHlP3Wz5AfhmEIkkqBGirgZr3v7Pe3/Bz7TnRJ9CW3uzOkY3Y8H IUknMsg+jQfYbHCfs2lciotehl4H2GeURuYqy9CWtLA1xg43g6IwoezSykDcrb2qwtn6 JjYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=OLBTFx0G8kqfUq/X8UH5jQ6RBP8CCT6RUfnU2vVV0vc=; fh=ZHl4RTbSVsq1vLUACYJofLuO/7kCamvfwco71ymgMZg=; b=z6uTR9jsdGbntxL/gPWgdH575B9cjiEFTGVi79FmrENf0SEdbaEXcvvwwpCHrB0z1I UWhWiHbzU0WgU55NYFeB9J0x5yi5rGE2u7bxIl5HvxEWpNETfsJSPcDwQmRMwWVTuQrJ Ai8BbpmfLSFaiWuFbmLAhqndlV6Zujpar57h15l9mA5yamo65WDjhZqxyMwE3Za4+PVE wiQQ253E+H5aarI1CnW5/xCTtZXvlG1cBVA/AK5qCnF8jn3/NlXm1Drku6imTMPjFGtd xVpwOdhucTDPEUfHhO2PMyh2DVpegUAGWbSKatJAEF29RIPspJxQxrMC8G+zei+R49Mw 3IQQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-43737-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43737-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k4-20020a05620a0b8400b007819e1e4697si5188666qkh.646.2024.01.29.17.41.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 17:41:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43737-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-43737-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43737-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D9E501C22242 for ; Tue, 30 Jan 2024 01:41:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BD9A364AA; Tue, 30 Jan 2024 01:40:52 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 871892E40E; Tue, 30 Jan 2024 01:40:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706578852; cv=none; b=XTVP1Re82e3HKlO+ws3k5BtnqsNIxw7a8I9PBMa6jT3+N4qdglbDfnozs2n3VP6zPrJZix+lax/L4GYz9H/4YasmlERcy5CnpOBQ/jtAG96omgMHUZ0IdnX8fflrjAYOJlDCpQI8mSRLPUS8GLeMYNEzq8HKbD7aA+PyGkunXSk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706578852; c=relaxed/simple; bh=VbobI8i12wfdDT/0sDMvAjQ9Fb1PGwZp0fZRrbe0AJc=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=A2v1H6XURlUJrMDrVVrMT8jO8qk5yfZ1vUgMBygOk6KBra6S+jcU2xQQvkeV/ju5wzy4TAfmv5pUJsMaAlyHeEHwNKKz4EWGyERsbGpJrOeA89Vwi32XlV7+FLBgjp0Q82ESMXJwAl6H7Xk5sHYU6pcQJLnipqkoWtxkSEStvLo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4TP7BQ19ygzXgty; Tue, 30 Jan 2024 09:39:26 +0800 (CST) Received: from kwepemd100002.china.huawei.com (unknown [7.221.188.184]) by mail.maildlp.com (Postfix) with ESMTPS id E29BF140132; Tue, 30 Jan 2024 09:40:46 +0800 (CST) Received: from M910t (10.110.54.157) by kwepemd100002.china.huawei.com (7.221.188.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.28; Tue, 30 Jan 2024 09:40:46 +0800 Date: Tue, 30 Jan 2024 09:40:38 +0800 From: Changbin Du To: Luis Chamberlain CC: Changbin Du , Andrew Morton , , , Xiaoyi Su Subject: Re: [RESEND PATCH v2] modules: wait do_free_init correctly Message-ID: <20240130014038.mawqxwoc34v6hztb@M910t> References: <20240129020304.1981372-1-changbin.du@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemd100002.china.huawei.com (7.221.188.184) On Mon, Jan 29, 2024 at 09:53:58AM -0800, Luis Chamberlain wrote: > On Mon, Jan 29, 2024 at 10:03:04AM +0800, Changbin Du wrote: > > The commit 1a7b7d922081 ("modules: Use vmalloc special flag") moves > > do_free_init() into a global workqueue instead of call_rcu(). So now > > rcu_barrier() can not ensure that do_free_init has completed. We should > > wait it via flush_work(). > > > > Without this fix, we still could encounter false positive reports in > > W+X checking, and rcu synchronization is unnecessary. > > You didn't answer my question, which should be documented in the commit log. > > Does this mean we never freed modules init because of this? If so then > your commit log should clearly explain that. It should also explain that > if true (you have to verify) then it means we were no longer saving > the memory we wished to save, and that is important for distributions > which do want to save anything on memory. You may want to do a general > estimate on how much that means these days on any desktop / server. > Actually, I have explained it in commit msg. It's not about saving memory. The synchronization here is just to ensure the module init's been freed before doing W+X checking. The problem is that the current implementation is wrong, rcu_barrier() cannot guarantee that. So we can encounter false positive reports. But anyway, the module init will be freed, and it's just a timing related issue. > Luis -- Cheers, Changbin Du