Received: by 10.213.65.68 with SMTP id h4csp596374imn; Fri, 6 Apr 2018 05:57:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/gl6hNrOdKu0cmD1aSlrzBMAZ+pKzZvZiwDdPDHTqS3wQhmEq2mHMgAg3V86g1L8D5oD31 X-Received: by 2002:a17:902:ac1:: with SMTP id 59-v6mr20621652plp.367.1523019467334; Fri, 06 Apr 2018 05:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523019467; cv=none; d=google.com; s=arc-20160816; b=I+YMGk8Oj/zh+YUJyMuq0JRrQfi7pSbO2uKvZnc8/8w+FxqlWdxHCoFCwhG/f0F7SD nK139FhyzdM/ag9DjeltfcBjGM/l4EAhXqVJjAnthj/X4THL7/ODPdtdX0naoEMGYAyG oDxJ5arbBDR+92PcOKzAgLU8DrYIwfxKp65vPhFbK1yF/v2stTzO3V8kXhHAU6j0kels XHWjRY+8YFQlSd3NlPTHfkzPNcONHkHNjaJCBF9Qqb3SEp+djDRM/xq8SCDQUFW5g4/O CoMOuk/tsP9Ob9qUjBZDgJobjJOYvlw3YvUtwDCnPYOfiqmqJnQsqhzKGkQ9P+ZzolrA hjug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Rs+J/CiE33toVjhvYrJVJezmlgGzqiMXgDK2gslcy+g=; b=DR0vE8c69KqBWtPHqvhqD2g5TBDaOYf4iQ4QofkNURZXM+FBWVRcpSDMSZiwBXUQEE 5pC5riMFhDxvYxPa6z2rO/vkHWhA0TkjCW0Q2i7Y7/fGhZwMAVX1bgfVYUraLvkwVHCw IlItYeS8T3C/CtdAfaY89vg5iC4jnsKYNisi0aBMmMNvzVunrzxqRg4yTZceOsN0LhWt O+QxHBJJoH0G9HAfRTdscojWNxP2kcFbyVEJogW9sJhMv1zYxW7IZs3HQsN5eZ27Yo/B ZWQksu5WpdNh8nXTkAsqK8OeT4fHxLs3gRKyxfqj/bBYHiCACuY6BpgRsNMjOOGt52wX 1FrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XcDASHQv; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n86si8021581pfb.126.2018.04.06.05.57.33; Fri, 06 Apr 2018 05:57:47 -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=@gmail.com header.s=20161025 header.b=XcDASHQv; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752316AbeDFM42 (ORCPT + 99 others); Fri, 6 Apr 2018 08:56:28 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55893 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579AbeDFM40 (ORCPT ); Fri, 6 Apr 2018 08:56:26 -0400 Received: by mail-wm0-f66.google.com with SMTP id b127so3358199wmf.5; Fri, 06 Apr 2018 05:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Rs+J/CiE33toVjhvYrJVJezmlgGzqiMXgDK2gslcy+g=; b=XcDASHQv2sbGQbqRQ9b13vYoogCYzl1U5mfnKO48PEbKcDQf6QPyemlYhTDIP6TXjq s8wDzKEkbtH1jZuchLZD6voy+XESIBn9n0vpphNep2pf6sWBjGUwZ4QknqiNrHDM9b05 5xhBVQ83fSy2yB7Nr2BRDmCHkLg2Wj/Lmr/yw91VrD33S0YHff6ioT2DspNpqsL+B5OB qLZnQX+doylnzn6MTs3hskLjiZlROIbGJAM5FfuF6xYmjLSNkqdzp/0QiWbCydukBA0x tmO3myMOR/ZK5QREHik1qT27ilJ21wHhDAwHCwxZEAGM+4yrZ2eHJCLoa1+JgM3nrL3y jzQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Rs+J/CiE33toVjhvYrJVJezmlgGzqiMXgDK2gslcy+g=; b=KBOGW0S9eWhpQzqtMJy9nAvZglcHkpZIJ24SGDHvm+WhM8VlLb5UUabTGcpZgOGRbL X4AXEmgHgT1uduSnSWgwhFuNyl+fw87xKWtvQi/nJghHBcpi2zug7MkacZUHCfi1Txra JgXkIdMILVNAU6pfvCMRjqaKaNW+GFQjO8wimXPsJ9+vRVQ5HlBOXvLdGhTRa1Pr3sGk Chy42lsuvD9JRsBGtIE7yAZkR6FYzmasvl4lDHSXKmKUraqgSqPHCKPR4NRZHXRtcDE+ vMCrTayUxvppiWpj8cdyIOyGu0iTiriQdYrduQwYGq/z9Jt71OIi4jdrQbaFjdECD3eV 37WA== X-Gm-Message-State: ALQs6tDNAX2Pg+YlUuSU/DLGUtWYnT6fwvWVZXp8Ey38hve0mOgNnq9c BW6d5FStUqqaB7/efD8nVzm6/8sBYmUOMXzheZI= X-Received: by 10.80.138.138 with SMTP id j10mr6819724edj.36.1523019384940; Fri, 06 Apr 2018 05:56:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.134.132 with HTTP; Fri, 6 Apr 2018 05:56:24 -0700 (PDT) In-Reply-To: <4a2170b7-e5e9-4f5c-8ff7-79e102a658c1@st.com> References: <1520852307-26659-1-git-send-email-fabien.dessenne@st.com> <1520852307-26659-3-git-send-email-fabien.dessenne@st.com> <4a2170b7-e5e9-4f5c-8ff7-79e102a658c1@st.com> From: Jassi Brar Date: Fri, 6 Apr 2018 18:26:24 +0530 Message-ID: Subject: Re: [PATCH v2 2/2] mailbox: add STMicroelectronics STM32 IPCC driver To: Fabien DESSENNE Cc: Rob Herring , Mark Rutland , Maxime Coquelin , Alexandre TORGUE , Ludovic BARRE , Devicetree List , ", linux-arm-kernel@lists.infradead.org" <", linux-arm-kernel"@lists.infradead.org>, "linux-mediatek@lists.infradead.org" , srv_heupstream , Linux Kernel Mailing List , Benjamin Gaignard , Loic PALLARDY , Arnaud POULIQUEN Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 6, 2018 at 5:59 PM, Fabien DESSENNE wrote: > Hi > > > On 05/04/18 11:38, Jassi Brar wrote: >> On Mon, Mar 12, 2018 at 4:28 PM, Fabien Dessenne wrote: >> .... >>> + >>> + /* irq */ >>> + for (i = 0; i < IPCC_IRQ_NUM; i++) { >>> + ipcc->irqs[i] = of_irq_get_byname(dev->of_node, irq_name[i]); >>> + if (ipcc->irqs[i] < 0) { >>> + dev_err(dev, "no IRQ specified %s\n", irq_name[i]); >>> + ret = ipcc->irqs[i]; >>> + goto err_clk; >>> + } >>> + >>> + ret = devm_request_threaded_irq(dev, ipcc->irqs[i], NULL, >>> + irq_thread[i], IRQF_ONESHOT, >>> + dev_name(dev), ipcc); >>> >> In your interrupt handlers you don't do anything that could block. >> Threads only adds some delay to your message handling. >> So maybe use devm_request_irq() ? > > The interrupt handlers call mbox_chan_received_data() / > mbox_chan_txdone(), which call in turn client's rx_callback() / > tx_done() / tx_prepare() which behavior may be unsafe. Hence, using a > threaded irq here seems to be a good choice. > rx_callback() is supposed to be atomic. So was tx_done() but some platforms needed preparing for the message to be sent. Your client is not going to be used by other platforms or even over other controllers, so if your prepare is NULL/atomic, you should assume tx_done to be atomic and not lose performace. If time comes to fix it, we'll move prepare() out of the atomic path. >> ....... >>> + >>> +static struct platform_driver stm32_ipcc_driver = { >>> + .driver = { >>> + .name = "stm32-ipcc", >>> + .owner = THIS_MODULE, >>> >> No need of owner here these days. > > OK, I will suppress it. > >> And also maybe use readl/writel, instead of _relaxed. > > The IPCC device is exclusively used on ARM. In ARM architecture, the > ioremap on devices are strictly ordered and uncached. > In that case, using _relaxed avoids an unneeded cache flush, slightly > improving performance. > Its not the portability, but that the impact is negligible in favor of _relaxed() version when all you do is just program some registers and not heavy duty i/o. But I am ok either way. You'd gain far more performance handling irqs in non-threaded manner :) Cheers!