Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp111450pxh; Thu, 7 Apr 2022 15:38:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyySvcWoc9mwdzZuJ6uuE94Vlf9ht5Ecu273PnBXfsCiehnzDtEPhn4My4RbW/DcZYn37b8 X-Received: by 2002:a17:902:b582:b0:14c:a63d:3df6 with SMTP id a2-20020a170902b58200b0014ca63d3df6mr16479795pls.51.1649371117597; Thu, 07 Apr 2022 15:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649371117; cv=none; d=google.com; s=arc-20160816; b=e7h2YRF8f1CPwaoI0h2srQGu+WSnLZpEKThMUQFg6w1IXo6Igv/Wz3DfZZCVO7vj+m tQYcF2+0dClZGJ5I69icWc5tEU64FtUu83rIz/rguT359eIES52g5DWCDRdn9f4pBTCX CbNIkWttlfPHOeuzn8SJxS0658uEHDvxlBArDLDlM8n5J0jNRnVFTR33sFUZv8Wp4/Aa c+pzLMpyTRUcGpbp82jI+sZ2mz4CYiJGtMIxXlqlqIutfIgAj6eyEeCDxOvjXuBvZC6K jdT2GqqLtHAz9j/eRy1t7yfQr5SSv4sHKrlOTzf6NzY4Kfe22WPb8OGe9zwFkjlJSf16 QCvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=STQ9sdu7fcjWHfFUdOtymgRVheoNmkf792JQ6ogqgQc=; b=aaiTh7hhznKzzanoI6Y8agH8bTwsqBA2xNolcmC+tM09HPwvIfgmLptKqXFXcGlhTS G0YOaBmWrrw5iPoy2yssuimOvRSPKS7PhEdToicnfLRKI0iHXytXxkmDyaKKmWTacMQb R9CU7k6/LOzjHxzIph59Nb0Tn0vgwyAvNel8GYgKxp1tv+CgzlU1FgmryUf1p90e8cf0 MCKjYnXqCb+zoeavHRgf4OfmERPkjtw+9eVeM8WY9gY2ufmjD7h9lKk3KU+Y9kMJsAKz 51B4k6OwuXtuo0rJzrvzPdDy4SUWuw/rxyjjnqNY6o0YS4wRxsbDfj6ZuM28spuhxb4i 5n2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VPYvHsDy; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d10-20020a170902854a00b00153b2d16425si922038plo.45.2022.04.07.15.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 15:38:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VPYvHsDy; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E5B84216A41; Thu, 7 Apr 2022 15:09:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231907AbiDGWLG (ORCPT + 99 others); Thu, 7 Apr 2022 18:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232036AbiDGWKt (ORCPT ); Thu, 7 Apr 2022 18:10:49 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63FD1FD02 for ; Thu, 7 Apr 2022 15:08:25 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a6so13770920ejk.0 for ; Thu, 07 Apr 2022 15:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=STQ9sdu7fcjWHfFUdOtymgRVheoNmkf792JQ6ogqgQc=; b=VPYvHsDyI4ltaYQ7gEJm6N87rAkuNORBkK+KUXazodPOUi0+MPk3BDKylYtRD333kq 3JELxOBUeEDCAP62xPCqomIUgkqWBd/xKWFvF+3ZRlU6r/zFo1CvHtmrlp5xQCP7RZOA 34B2fkawD5vMVVWzegnKEIxQC2i8TpC2WUdRZMjJ0U5SZPtVxHm1Ids7CeubKKWJkr65 D9XUPkplVlT1EDjyS9CoFKDihVPck1Bdd+TeZCRmQKZXfKOCat0GKVrVf819EwPXa7IZ MtQ74t74r7L5CGvaygu8IzVfVfiOLhn4Bna9cldfu4hKdDeC7Zon2kuK6yIXlHvIKC9+ W6tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=STQ9sdu7fcjWHfFUdOtymgRVheoNmkf792JQ6ogqgQc=; b=ieo+7yIqf2OMRezkmZ83hQ1QCSHUHcEXR4wP9+Jmd0b0NLTaOKeetWThlH18yWVlDd +yY+kOHP/feWFtQLpwdKsSziw2lFLnkMxGgxXebhYfn4Vy5x3dk8iiKrQg1I6bqWm+0O 95Et7Q9o49rlJ4J9uWZWIeJLJMG3vrFUT/1pd60jvkk/0nBn6vMlyGi4rEKThxUyd3LX Zjp06nyRGMv/3bhP/vH7JSZiPOX3Rx01S5QSwGA4GSBk9HThKYcgiGlqDLcnXIJlrLbJ cNZzMvJYS9o7dHA5qNIYHsKeA3uq6UQiFMBztoX39ZHl1DJqggSqaK/bEvMIwMlqZ49u WcxA== X-Gm-Message-State: AOAM532BatCNOtpNQJxKlivyXs7Xa+hxKGzfMRNz9mUgmWmSkF44ZeSK clEdur/TVni4nees33A6sse2GalbajnVvsKnFe4= X-Received: by 2002:a17:907:8a26:b0:6e1:2646:ef23 with SMTP id sc38-20020a1709078a2600b006e12646ef23mr15982957ejc.109.1649369303851; Thu, 07 Apr 2022 15:08:23 -0700 (PDT) MIME-Version: 1.0 References: <20220407154430.22387-1-duoming@zju.edu.cn> In-Reply-To: <20220407154430.22387-1-duoming@zju.edu.cn> From: Max Filippov Date: Thu, 7 Apr 2022 15:08:12 -0700 Message-ID: Subject: Re: [PATCH V2 11/11] arch: xtensa: platforms: Fix deadlock in rs_close() To: Duoming Zhou Cc: LKML , "open list:TENSILICA XTENSA PORT (xtensa)" , Jiri Slaby , alexander.deucher@amd.com, Greg Kroah-Hartman , "David S. Miller" , Chris Zankel , s.shtylyov@omp.ru Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, FROM_LOCAL_NOVOWEL,HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, Apr 7, 2022 at 8:44 AM Duoming Zhou wrote: > > There is a deadlock in rs_close(), which is shown > below: > > (Thread 1) | (Thread 2) > | rs_open() > rs_close() | mod_timer() > spin_lock_bh() //(1) | (wait a time) > ... | rs_poll() > del_timer_sync() | spin_lock() //(2) > (wait timer to stop) | ... > > We hold timer_lock in position (1) of thread 1 and > use del_timer_sync() to wait timer to stop, but timer handler > also need timer_lock in position (2) of thread 2. > As a result, rs_close() will block forever. > > This patch deletes the redundant timer_lock in order to > prevent the deadlock. Because there is no race condition > between rs_close, rs_open and rs_poll. > > Signed-off-by: Duoming Zhou > --- > Changes in V2: > - Remove the timer_lock. > > arch/xtensa/platforms/iss/console.c | 8 -------- > 1 file changed, 8 deletions(-) Thanks. Applied to my xtensa tree. -- Max