Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp405817rdb; Sat, 19 Aug 2023 06:35:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWNzXjE642h8PqeeY97E6VT968cFY6lVH2yLjlfM6aYrGxp6hlswSgTT+iZfE7izeCbI3e X-Received: by 2002:a05:6a20:7f8b:b0:13d:7aa3:aa6c with SMTP id d11-20020a056a207f8b00b0013d7aa3aa6cmr3262045pzj.0.1692452102889; Sat, 19 Aug 2023 06:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692452102; cv=none; d=google.com; s=arc-20160816; b=1E6/XFgYYr94cwAgTPmKU8uMUGQZR7AnZyCjpOuhomW6jfQO1w1I1NaJvpLxjDY8F4 rytigs1sTqF/bNsgpu4DhMKoBf96lS3xFwbZ/oGmve6aRpCiqiUtunwyEBJoP0kl4mDA LpHZ93vfe9ggLGqLb32ww5Cf27CtWW6q7pM2apG4tTOjPlwfECA2sPzudAmwjK7gnASU 8WxJcwPoAq4ukBUwoeYSiZkP+uW7lFG06XsdAYxkpObc9/Pv5BT39Ek1jxqPg/uXGosZ 8xLeM4c0GrZVbMJSly63CGZo9uzaOYbQr4pnOsoTAjFrNiJDMY41XNcUNBpY5PTbIy1E 1gUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=QAK5pqGLlMYM3mSBsm1dj6oCRYJJVq04mPM9nZca4dE=; fh=djLTez50bxyz81auegPqWBuAwH9Ap3kYnxiB+BgbSwg=; b=bJGOXJBgIZG3+uteeMjfzf07SsWCyQzVkX7G+5QSq6k7ioi6DFrCKIOhgiWBhqfm81 6gXrn9zi7DC/4Xp8lgbeTl83OFTnsqELDiRSVy7oY6Gv3uHipMycx9EXNAqXw9p9Cdio ccfzcLSuBtm38A7yQpeOM6EliIZcEVE6Dt5w4WLwhJRA1nDA1eMqBy6HDutNMGzzy8TG URTcsohmPEOB84iJmM777YXV0bd9cNZUBPbTxfs9hcn6fj83p7t/967GyYEHobYXWgro oiPW006fNHji+CMOg0BRiqiS/p4nc3ZVnKerXIYr/qXeciiBanc9xBTeBPd6+sz6HKoQ IaYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z16-20020a634c10000000b00565d9520544si3337424pga.844.2023.08.19.06.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 06:35:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 05993A9356; Sat, 19 Aug 2023 01:41:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347070AbjHQJ7z (ORCPT + 99 others); Thu, 17 Aug 2023 05:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235692AbjHQJ7b (ORCPT ); Thu, 17 Aug 2023 05:59:31 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0384C2D61 for ; Thu, 17 Aug 2023 02:59:30 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AC276D75; Thu, 17 Aug 2023 03:00:10 -0700 (PDT) Received: from [10.1.197.1] (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 735793F64C; Thu, 17 Aug 2023 02:59:28 -0700 (PDT) Message-ID: <777eda70-d8e6-9f46-52dd-80beed3f0c18@arm.com> Date: Thu, 17 Aug 2023 10:59:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 1/2] coresight: trbe: Fix TRBE potential sleep in atomic context Content-Language: en-US To: Anshuman Khandual , hejunhao3@huawei.com Cc: coresight@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jonathan.cameron@huawei.com, mike.leach@linaro.org, linuxarm@huawei.com, yangyicong@huawei.com, prime.zeng@hisilicon.com References: <20230814093813.19152-1-hejunhao3@huawei.com> <20230816141008.535450-1-suzuki.poulose@arm.com> <80ef7a87-6adf-27bc-43ae-05ae5680e418@arm.com> From: Suzuki K Poulose In-Reply-To: <80ef7a87-6adf-27bc-43ae-05ae5680e418@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/08/2023 08:13, Anshuman Khandual wrote: > Hello Junhao, > > On 8/16/23 19:40, Suzuki K Poulose wrote: >> From: Junhao He >> >> smp_call_function_single() will allocate an IPI interrupt vector to >> the target processor and send a function call request to the interrupt >> vector. After the target processor receives the IPI interrupt, it will >> execute arm_trbe_remove_coresight_cpu() call request in the interrupt >> handler. >> >> According to the device_unregister() stack information, if other process >> is useing the device, the down_write() may sleep, and trigger deadlocks >> or unexpected errors. >> >> arm_trbe_remove_coresight_cpu >> coresight_unregister >> device_unregister >> device_del >> kobject_del >> __kobject_del >> sysfs_remove_dir >> kernfs_remove >> down_write ---------> it may sleep > > But how did you really detect this problem ? Does this show up as an warning when > you enable lockdep debug ? OR it really happened during a real workload execution > followed by TRBE module unload. Although the problem seems plausible (which needs > fixing), just wondering how did we trigger this. I was able to trigger this with just : modprobe coresight-trbe; modprobe -r coresight-trbe; With all the bells and whistles enabled in the kernel. Suzuki