From patchwork Thu Sep 5 16:17:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 173159 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp935113ilq; Thu, 5 Sep 2019 09:18:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqy31QxeXYNC8kjuJ5ehB/xZjidHMW67kMcYK8Op771JQIO4A9EgPrlDJx6E5ytZNJYJMPZe X-Received: by 2002:a17:90a:b292:: with SMTP id c18mr4773408pjr.1.1567700299947; Thu, 05 Sep 2019 09:18:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567700299; cv=none; d=google.com; s=arc-20160816; b=HVKBW8rI8r+s+fMcjoCBNJwlWLmIE4AEFhaBEZd1Hry3L73NPM0t266kasvPoy7Ijo 70MBqX7X6P1xIZmBf38FLjLlK6rAO9E9eQXB+wFcsaXHPi2XA7Rj2/2fZHmZIY4dmeez E7DDS6H/7kwrBdhCm/vRfrqWVh2ZRshAL0vrgR7IFcEMhjg5ADySmVF6X5i0TNuysiME OpxOqnE+EwumY3239YdzM5U+SZHH6v37wQCSC1kCZdVnah1WidufYDEXROvpkxjDemkv RJspRJ0zoEtcz12Ne4qnquc/948s7U6icv/vOYU87UBjy7YP8EZYDvR4JBU66HaRStwh WpZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=8QjjqDFW2as8gsE3MNwHPLPN76USmssxyGkKOBC9D3E=; b=mgDxaSgLRWHothMtcDB2PdxhpEmoW5owuk0O9DQifFNFIMdxyM/cyXvN93lqvUhkWg 0UPPXGSFlSFtaam/Il4P0t0R1P3GaNEmWeLNRJMkrY7a88kCcZOt17vRrK9PIYl99fZL y6y2DRmiVnOSgOvm7Cv15IWShQ4U7n8OAkAlSz8C90r9fGXQLVLjHHRCKo5V0W3Dd50x 5Qt1SgdSNjWPxy1mdx0xKNx2ghI3cjvomZ0ZOQm5xGTBnQnIxnvaSG5y+nhaVpAw2GWj c3tYBTTWTJdJEF0VoQfdrkHEsX7nITo3KATlEDZXBPyJN1RThI9IfO5VXBBjMu1S+1oa 9ykw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HL27V+NY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3si2442272pld.431.2019.09.05.09.18.19; Thu, 05 Sep 2019 09:18:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HL27V+NY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388593AbfIEQSS (ORCPT + 28 others); Thu, 5 Sep 2019 12:18:18 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:34148 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388431AbfIEQSQ (ORCPT ); Thu, 5 Sep 2019 12:18:16 -0400 Received: by mail-pl1-f196.google.com with SMTP id d3so1556208plr.1 for ; Thu, 05 Sep 2019 09:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8QjjqDFW2as8gsE3MNwHPLPN76USmssxyGkKOBC9D3E=; b=HL27V+NYul1f+O0bmc6YkYSMF5euNDbYJl3hh04CdtFtjxmvNCYdhhn4rVKZ4mtbnC haoz4ZuRykOa1EVcbKBLOnulQom5g/1qMM4K3pUJqI9gyl8+8M7gUP3hdV27jiyNhaLP o/VZfks/pnLsAsEemsNEwt2UAy9aH5QMHPRsXyteaLVX8yuXtIU8Q7J3Kt0GHRGIjeu+ 6uqwAVSO0rrjztAQNUcFDtt/AS9X6aQBAlsAr+yR2VeRxvHvm5f4PTxaab1YLr0ySVHa WGR7mnvK9yLWmfNAcVoLZFMGqTS8ZaLoVAcycwWbcXSXF16pUzOt3ohlbzYqLRrORRPt DjoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8QjjqDFW2as8gsE3MNwHPLPN76USmssxyGkKOBC9D3E=; b=fjML/jdcBbFZTIjJA4nsoSI3d6I/09SlbnxIdH0jxG+khMkfIxB2jBK7yW91Wg+yqv VkznMy38dS9q6MUrPVffcgvq2fh9EJN/F0rGrwlSk+W9EUSbz+zHx9NuzbnZP6vRttwr RWH8+I4J0jNkB+CILbe59JzGV8vnSwJcaesdCrLyNLmBXZVZ2VrU5gwMY4cc6JI4Ry+m qWRc4lxOtx5SzrzghoPd/I3K3KYhgqmWVJLDN/Jg0IaZu1QLul3u08B4TRhGwhQ8tQWu JpFiiaoTAy3G5zZuASmE8KV0NfRuumopM5pYs1GNEJzLYSMo9LQio87DAif8r70GO68F MT4g== X-Gm-Message-State: APjAAAVXdNAhYG23RHNUe79XGKIsG4s3NpEDB+zRSdMhGmcqTLOPBiBx H7tE/W6BFZowijp+sJXKDcw46A== X-Received: by 2002:a17:902:8a87:: with SMTP id p7mr4384259plo.240.1567700295503; Thu, 05 Sep 2019 09:18:15 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id m129sm6324005pga.39.2019.09.05.09.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 09:18:14 -0700 (PDT) From: Mathieu Poirier To: stable@vger.kernel.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pci@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [BACKPORT 4.14.y 12/18] mailbox: reset txdone_method TXDONE_BY_POLL if client knows_txdone Date: Thu, 5 Sep 2019 10:17:53 -0600 Message-Id: <20190905161759.28036-13-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190905161759.28036-1-mathieu.poirier@linaro.org> References: <20190905161759.28036-1-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sudeep Holla commit 33cd7123ac0ba5360656ae27db453de5b9aa711f upstream Currently the mailbox framework sets txdone_method to TXDONE_BY_POLL if the controller sets txdone_by_poll. However some clients can have a mechanism to do TXDONE_BY_ACK which they can specify by knows_txdone. However, we endup setting both TXDONE_BY_POLL and TXDONE_BY_ACK in that case. In such scenario, we may end up with below warnings as the tx ticker is run both by mailbox framework and the client. WARNING: CPU: 1 PID: 0 at kernel/time/hrtimer.c:805 hrtimer_forward+0x88/0xd8 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.12.0-rc5 #242 Hardware name: ARM LTD ARM Juno Development Platform task: ffff8009768ca700 task.stack: ffff8009768f8000 PC is at hrtimer_forward+0x88/0xd8 LR is at txdone_hrtimer+0xd4/0xf8 Call trace: hrtimer_forward+0x88/0xd8 __hrtimer_run_queues+0xe4/0x158 hrtimer_interrupt+0xa4/0x220 arch_timer_handler_phys+0x30/0x40 handle_percpu_devid_irq+0x78/0x130 generic_handle_irq+0x24/0x38 __handle_domain_irq+0x5c/0xb8 gic_handle_irq+0x54/0xa8 This patch fixes the issue by resetting TXDONE_BY_POLL if client has set knows_txdone. Cc: Alexey Klimov Signed-off-by: Sudeep Holla Signed-off-by: Jassi Brar Signed-off-by: Mathieu Poirier --- drivers/mailbox/mailbox.c | 4 ++-- drivers/mailbox/pcc.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 44b49a2676f0..055c90b8253c 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -351,7 +351,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) init_completion(&chan->tx_complete); if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone) - chan->txdone_method |= TXDONE_BY_ACK; + chan->txdone_method = TXDONE_BY_ACK; spin_unlock_irqrestore(&chan->lock, flags); @@ -420,7 +420,7 @@ void mbox_free_channel(struct mbox_chan *chan) spin_lock_irqsave(&chan->lock, flags); chan->cl = NULL; chan->active_req = NULL; - if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK)) + if (chan->txdone_method == TXDONE_BY_ACK) chan->txdone_method = TXDONE_BY_POLL; module_put(chan->mbox->dev->driver->owner); diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 9b7005e1345e..27c2294be51a 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -266,7 +266,7 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl, init_completion(&chan->tx_complete); if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone) - chan->txdone_method |= TXDONE_BY_ACK; + chan->txdone_method = TXDONE_BY_ACK; spin_unlock_irqrestore(&chan->lock, flags); @@ -312,7 +312,7 @@ void pcc_mbox_free_channel(struct mbox_chan *chan) spin_lock_irqsave(&chan->lock, flags); chan->cl = NULL; chan->active_req = NULL; - if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK)) + if (chan->txdone_method == TXDONE_BY_ACK) chan->txdone_method = TXDONE_BY_POLL; spin_unlock_irqrestore(&chan->lock, flags);