From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E696C4346E for ; Sun, 27 Sep 2020 15:03:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF5542389F for ; Sun, 27 Sep 2020 15:03:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BQWgWL+S"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dgxi7huz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF5542389F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uuGbnhbg0qhq73fFN7femPFfe5BAl7cU0ZuqUM4ItEI=; b=BQWgWL+SwYap3jwk2SOfVC3ja t7uCCH/TJd8HrEtOXHNfTSPUaGuzBNW045xxUtrF3M6lVd9FwWm0tju1v0jAJoDevfw3smNpxTOI5 AVWoSV26iAkiStXFO10yaGXZt2V+NUkZm/xP7hYPFkW6Yc7dL3IEpam/CNLSK71X5J/rbLleFtQF9 OQPWDzZuZ3JIjglcBezezZCZFbxLBTLkcHPpDatnTc8mVZ657SwZ7Ms7zkp4in4w/h9WO/BSYHA2w U0NvPoZVP4953JK/FtE71YkK6mqzQGUDzlvR1Q/Gvmv5I/IJmYN3J5W6qE8g/CX6u523QqiEuStGT hAXLcnwGg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMYBe-0006ik-Pz; Sun, 27 Sep 2020 15:02:02 +0000 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMYBb-0006iI-W3 for linux-arm-kernel@lists.infradead.org; Sun, 27 Sep 2020 15:02:01 +0000 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601218918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0hs5rdUJVOmzg99SVlEBJlBQFGXQLPQJ2GLdFN3MjFs=; b=dgxi7huzoXRwPTjv64eSFBFSiASfdBrzVWy3Y7WC0vL9uWJy2yYNxQ2gLwJuZPRrPW97Hu xzDXyHI71DtT087HOWedCO87vYLaFuUfft3VIy1YEDUbnW3a3UARqr74wYmTdachk49xI5 xdGcqcA3AX/VcdU9sbAagwhGnladd7k= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-356-RYFLELpSNOmretp8xsWe2A-1; Sun, 27 Sep 2020 11:01:55 -0400 X-MC-Unique: RYFLELpSNOmretp8xsWe2A-1 Received: by mail-ej1-f72.google.com with SMTP id w17so2196135eja.10 for ; Sun, 27 Sep 2020 08:01:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0hs5rdUJVOmzg99SVlEBJlBQFGXQLPQJ2GLdFN3MjFs=; b=uSxrJlyj2H/9XsRzt3FAuMNEk3eRsNo5kBiYV3SpsGjNaRWemZsW3d3WAekyl6zvO4 bgz5ihXL6DixXF4yH1XGeSQ1FCqcq91LZaQDe3o2EAl5uWltmXygsx3Ctmuvd+EqG3a2 9VO3RX9UgaXk8Av9BsTdlcuVe7cvFWM1iGbRitMaXnAQRgwsF4hfUpNRh3v/yDRoVgbg 61CcHNr0rxHXY17i4yr4MeeQxB9Yv5nO7qmWbF1uQa5xzfq72GKjCR6k/bdwFloSAP9i FqGxMW53DJR4bZCYuHQyCjNAkWUQMJppLhY/B7qRqUzaqj0BDkDbFDnD0UF4tZIQR91y KZjA== X-Gm-Message-State: AOAM530sf9qpeM3Wnaxh55I8juK3XVfJCP7gHMN8Jt+lTmyF2Kxem9aY 4O0fwX09Ar2zyfKZXKZH/zlNlA+RRKcrqpx14EUvVB3+KpEyl+ZmNYO+yA9VlPPzrsN7ppPpII9 QOHry+Cj7G11mOJ5RDOBk0PehhvsGDCkI3cg= X-Received: by 2002:a50:bb65:: with SMTP id y92mr11310102ede.53.1601218914368; Sun, 27 Sep 2020 08:01:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9xBEE4fL9o6SH/mCyn1ClksiNMLfDL1ho7Cw9z0Iz424ysBl96z0clzUKT7OhlnwXh9r6fA== X-Received: by 2002:a50:bb65:: with SMTP id y92mr11310082ede.53.1601218914188; Sun, 27 Sep 2020 08:01:54 -0700 (PDT) Received: from x1.localdomain (2001-1c00-0c0c-fe00-d2ea-f29d-118b-24dc.cable.dynamic.v6.ziggo.nl. [2001:1c00:c0c:fe00:d2ea:f29d:118b:24dc]) by smtp.gmail.com with ESMTPSA id y14sm6602549eje.10.2020.09.27.08.01.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Sep 2020 08:01:53 -0700 (PDT) Subject: Re: [PATCH 0/3] serial: 8250_dw: Fix clk-notifier/port suspend deadlock To: Serge Semin , Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko References: <20200923161950.6237-1-Sergey.Semin@baikalelectronics.ru> From: Hans de Goede Message-ID: Date: Sun, 27 Sep 2020 17:01:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200923161950.6237-1-Sergey.Semin@baikalelectronics.ru> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hdegoede@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200927_110200_056647_D815FFD7 X-CRM114-Status: GOOD ( 22.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Russell King , Maxime Ripard , Alexey Malahov , Andy Shevchenko , Pavel Parkhomenko , linux-serial@vger.kernel.org, Serge Semin , Will Deacon , linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On 9/23/20 6:19 PM, Serge Semin wrote: > Hans has discovered that there is a potential deadlock between the ref > clock change notifier and the port suspension procedures {see the link at > the bottom of the letter}. Indeed the deadlock is possible if the port > suspension is initiated during the ref clock rate change: > > CPU0 (suspend CPU/UART) CPU1 (update clock) > ---- ---- > lock(&port->mutex); > lock((work_completion)(&data->clk_work)); > lock(&port->mutex); > lock((work_completion)(&data->clk_work)); > > *** DEADLOCK *** > > So the CPU performing the UART port shutdown procedure will wait until the > ref clock change notifier is finished (worker is flushed), while the later > will wait for a port mutex being released. > > A possible solution to bypass the deadlock is to move the worker flush out > of the critical section protected by the TTY port mutex. For instance we > can register and de-register the clock change notifier in the port probe > and remove methods instead of having them called from the port > startup/shutdown callbacks. But in order to do that we need to make sure > that the serial8250_update_uartclk() method is safe to be used while the > port is shutted down. Alas the current implementation doesn't provide that > safety. The solution described above is introduced in the framework of > this patchset. See individual patches for details. > > Link: https://lore.kernel.org/linux-serial/f1cd5c75-9cda-6896-a4e2-42c5bfc3f5c3@redhat.com > > Hans, could you test the patchset out on your Cherry Trail (x86)-based > devices? After that we can merge it in into the kernels 5.8 and 5.9 if > there is no objections against the fix. Done, I can confirm that this fixes the lockdep issue for me, so you can add my: Tested-by: Hans de Goede To the entire series. Regards, Hans _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel