Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp165302rdb; Tue, 31 Oct 2023 04:16:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHvdVxkt2MAa6SE1FvxPM6pLXQ2UbsklFVxmIxyKvyWtuYJsQ/ltOHbcWAeV1jVb5WIcjQ X-Received: by 2002:a17:903:41cc:b0:1cc:5dd4:7cf8 with SMTP id u12-20020a17090341cc00b001cc5dd47cf8mr3839089ple.27.1698750987466; Tue, 31 Oct 2023 04:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698750987; cv=none; d=google.com; s=arc-20160816; b=mGU0oRo5ZMZgMEyQA3nLd1LjPzAJzY4kNQDz6c9SIk2lqm/rT9UmrZqqwNTeD42F0g Qz72jr8o+YI1gb7r5erq16BZkyYg0fJUcbftMdqt05VJg+XN6KA0nrwX5sI5FzcuzoPM CeGhGW19ayyVfvGzX+PwI9ZtB1Ppkkpd4SnX7LtgOsJqgF96bKyzpCcVSd7YKP796yUU i6xZYrGyE64uNyDEo7aRRblUolA0CfyZEdJe7YuosSLGgD7FvqyNsIu2rF9hAFIk/4Zo IDGEcq8ClX4mwuNXxKABAuIEO1bvjoTlTzwinpQ0mioyuB7DbnyZIroNEFgsmiACV2Ng fqZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Wk3G10Xt+BuVhnIgltoFz1hAGxFu2UKBKoqgrFwmKw8=; fh=r90UzL3AqgHjzNjrx6z7vNhzZYQIOccqW9za5uCAJk0=; b=bHlvEyICb3Mto8qhFqBEhOP5rpYpp7gFH58ghtpmihRSjwF7KeMc4Iv1dOkBbELLFX ZMZhkgxGycyDRFmlouH+peYt4wjEPIvZgW7w7fngKdu2okF0rnBXKPvNBxWe9RmUhTzZ e29SZxChdyETepF5gnX3meQlYGsrMO2oFpOBm4uC44D+CPrR4VC32QO8zlY7rLxvTGQv ZBNwoLAplTk1PFT2X4G4dRt8ekwzReCOYu02DGHHr1ERSkCGyvabkwYtpovUZgP3YfYB JccIeOMpYoUNK3795IwEK0HboNVODxXiB/WuTDXun+hbEZpULSO/w9sFC2z3CUbI4OoH VVjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fnKeu2Xt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id q9-20020a170902f34900b001b895572179si851341ple.184.2023.10.31.04.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 04:16:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fnKeu2Xt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id BC87A803112F; Tue, 31 Oct 2023 04:16:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbjJaLQP (ORCPT + 99 others); Tue, 31 Oct 2023 07:16:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234967AbjJaLQM (ORCPT ); Tue, 31 Oct 2023 07:16:12 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C14B310C; Tue, 31 Oct 2023 04:16:09 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1EFDC433C8; Tue, 31 Oct 2023 11:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698750969; bh=w8kgG/MgAOuluXb5mP0VQ+GKsS6sWg759ncFQ+iOEMg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fnKeu2Xt0bImvB+xP6CSqSUtvGO5Z4szF4LOtkSpmeTrxrCKKVHgqS/BgLpANNr38 dTCgIe+n7mmuxVB9vk2H1R1oI90/KQHrrvxT0g0Yk6C1F23UfJG0uLgX/FAZg2EL3P DjnJnl+tpdLJ98NulIH9qGgewMB7sqsCrz3aJDes= Date: Tue, 31 Oct 2023 12:16:06 +0100 From: Greg KH To: SeongJae Park Cc: stable@vger.kernel.org, Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND 6.5.y] mm/damon/sysfs: check DAMOS regions update progress from before_terminate() Message-ID: <2023103157-rebuttal-directed-7f83@gregkh> References: <2023102716-prudishly-reggae-1b29@gregkh> <20231028213936.45621-1-sj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231028213936.45621-1-sj@kernel.org> X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 31 Oct 2023 04:16:24 -0700 (PDT) On Sat, Oct 28, 2023 at 09:39:36PM +0000, SeongJae Park wrote: > DAMON_SYSFS can receive DAMOS tried regions update request while kdamond > is already out of the main loop and before_terminate callback > (damon_sysfs_before_terminate() in this case) is not yet called. And > damon_sysfs_handle_cmd() can further be finished before the callback is > invoked. Then, damon_sysfs_before_terminate() unlocks damon_sysfs_lock, > which is not locked by anyone. This happens because the callback function > assumes damon_sysfs_cmd_request_callback() should be called before it. > Check if the assumption was true before doing the unlock, to avoid this > problem. > > Link: https://lkml.kernel.org/r/20231007200432.3110-1-sj@kernel.org > Fixes: f1d13cacabe1 ("mm/damon/sysfs: implement DAMOS tried regions update command") > Signed-off-by: SeongJae Park > Cc: [6.2.x] > Signed-off-by: Andrew Morton > (cherry picked from commit 76b7069bcc89dec33f03eb08abee165d0306b754) > --- > > I sent this patch yesterday, but seems not archived in lore.kernel.org. > Sending again Cc-ing more mailing lists, to ensure it is sent and others can > find it, to avoid any duplicated works. Now queued up, thanks. greg k-h