From patchwork Mon Nov 11 18:28:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 179109 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7029827ilf; Mon, 11 Nov 2019 10:37:23 -0800 (PST) X-Google-Smtp-Source: APXvYqzsBLcESvuuJGwErcIVyGLMGcEO1TMuP8oADlw00//uti5Yce1fmbLkv9M8YG86ZgVMbmbh X-Received: by 2002:aa7:c695:: with SMTP id n21mr28192040edq.204.1573497443177; Mon, 11 Nov 2019 10:37:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573497443; cv=none; d=google.com; s=arc-20160816; b=t8UsNcg6B1doVkJ1E8GubS3ycZRgfPqaJrydcF3OoFtxrF/ZIIbH0YNeoF12ZZnwiy 0w4F7D7SN+x4btSuMyRSNvAd7s7xRJxFq9a4fZOcuAPXdC33m1iA2yQEL0Hgx8Lx+xhz OUWab6DihUGiwiEasu3XyYJrRwXpyJoiiBGxO0/xeMkFLvvT2UhgKZv9UawYpUC18Sxn 4eFRfaqBEq4E3S8HiDIlBK9wrPZeX78GF1CxyUVGDUnS24bNuLMQ5quKXKK/oflPtZqf ce3kj/+fb/VmaIhH7+UE/X3F2plCH43wDeGIc8R4POpjeOglarqOElYc/CpT8MMH1vVc kPQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Aq6SN4Ha0kATsfz+g1RwOeKOrWWgigh6/rW5A3c86Y4=; b=vkUYC+iAnb+BDyKyMnziTvaVyHtniuTjm5/n/6dFdeMH3IFFJhIt7mhZIhCwFb5rvF jKLYMHK8A5t4A8xwxDirgKENw6uWmFNAZzfNl/Ng7trck51i6UfEwTpwOOpR9NkNjtCI eOqw4SyCbWxgqiAMUjH221uxpHtRaX20kyTYXDT1MtwJpdPKOUDQNhWfWi9xR81NCBvi MyU5zQa//fnQL8M9rYOw28630nK2C1gV436cZ8/haYsjmK7MDjBw8BMfrOINU21/B5un 9L0mQO31WVtBV7ZJU/hVP8CWRdRpmMrbEcMGu9coQucAuqiKEHOmSJwahPCBopR0dHwe GAFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pvsbFIkd; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si9761716ejf.270.2019.11.11.10.37.22; Mon, 11 Nov 2019 10:37:23 -0800 (PST) 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=@kernel.org header.s=default header.b=pvsbFIkd; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728847AbfKKShV (ORCPT + 26 others); Mon, 11 Nov 2019 13:37:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:55946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728828AbfKKShR (ORCPT ); Mon, 11 Nov 2019 13:37:17 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DEA7B204FD; Mon, 11 Nov 2019 18:37:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573497436; bh=qQ5L4rfGHyWCFEcxEHYJAqF8P0ll5C/kHsoR9YbzQ1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pvsbFIkdQJ1k0jeuqUcch/lnrUDLFqTXIadVeMse7q1dK6kxA4XWqJLn0KUGhdFtK MILE9n1i54wTj+ZebmkOKlkv+c4kSlby36QibIKO32ZXQyhf8Dkl5Nn8wFT/lXxcTq ZQxLDjLOIX1KS0NGX8UikGj5NZIyXwBOoFk+hjls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Alexey Klimov , Sudeep Holla , Jassi Brar , Mathieu Poirier Subject: [PATCH 4.14 054/105] mailbox: reset txdone_method TXDONE_BY_POLL if client knows_txdone Date: Mon, 11 Nov 2019 19:28:24 +0100 Message-Id: <20191111181443.524703978@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181421.390326245@linuxfoundation.org> References: <20191111181421.390326245@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 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 Signed-off-by: Greg Kroah-Hartman --- drivers/mailbox/mailbox.c | 4 ++-- drivers/mailbox/pcc.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -351,7 +351,7 @@ struct mbox_chan *mbox_request_channel(s 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 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); --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -266,7 +266,7 @@ struct mbox_chan *pcc_mbox_request_chann 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_c 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);