Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4265021imm; Mon, 14 May 2018 05:13:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoJFknowAEU5/+f58KrmDJ2LnCdFEAGzrD4BU7Ab5DsPnx/Vjaegm1dc1BtVbEfuwlG0NEx X-Received: by 2002:a65:484c:: with SMTP id i12-v6mr7842250pgs.162.1526300012172; Mon, 14 May 2018 05:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526300012; cv=none; d=google.com; s=arc-20160816; b=Xuw8T8dkKjAefBGQIBU6G7R68yn+ARHk8oHa33usEgj9jRWJfQCuOwwvMoCndcAQnE nLR4lxLbNpyyAXkkg6HcEwMns8Xzp6Jvo18DZxzQWt6m52P6xCKrAYGXiwO9al4eSX24 vVporPCNZBl1rrIpYOxFYRfdOiwpe+ZBrIz9yWvjepfnglLUAOEMCiIkMAC/hOi9dk0T Dnegmnb6SDDezIA4m1UQ0skcktqO4i9WS/rO775SpdPnq8FBv67gvFCNGKgqgCnc8sLU 3pbFw8eUN0Wfz2diCZ0VNYS5ZedLj1EevFqZSn0j7a69DyY+DqLEQmkFvR6B4YCPnaDc 3zDw== 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=zcTO/iqoG9NO/9RDKUaLCpPwDrOlsjMXS8oVpL1K638=; b=tZrKF2JPLZf/EyK1NMiiX7zfrUWXBkJpUoamE1cjfcPDMrxx0I/yV9V2HniPrayyp/ zb9vA4WLvIFtB6JJLvuevt9+UnUL9QK2RSJKWSlWeRaCQ+T5kBftDYMy5G1mOd9PfWj4 GbO8XerMWzU66F7u9Hkgvhp2rcNksUEv/Z9N1GeEm33tf3Pi33vug1aoUbYXfNt4GY1P tuykeX9cV3Ss/icO1I1/Y3VgNGvA8KLRZMtI6wWGWtVaftebZwltL289zzN/3rTCC5cQ 3Ix5FWDF+2pjAH+EAmdbkl/xSkt94/xdmWx5XEkAHUBjLmb05hbBFjiSYL9EdMJ6SqI5 decw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VCbZV3Qt; 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 q28-v6si9782450pfl.317.2018.05.14.05.13.17; Mon, 14 May 2018 05:13:32 -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=VCbZV3Qt; 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 S1752632AbeENMMc (ORCPT + 99 others); Mon, 14 May 2018 08:12:32 -0400 Received: from mail-ua0-f178.google.com ([209.85.217.178]:33945 "EHLO mail-ua0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752037AbeENMMb (ORCPT ); Mon, 14 May 2018 08:12:31 -0400 Received: by mail-ua0-f178.google.com with SMTP id f22-v6so8157443uam.1 for ; Mon, 14 May 2018 05:12:30 -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=zcTO/iqoG9NO/9RDKUaLCpPwDrOlsjMXS8oVpL1K638=; b=VCbZV3QthyHcZO1+kN4k5VCUsEgS6EneIAYOfKGEgICCI2Ghh3tWWV8+O1KuwXNION 2o3oIs10QW0XH5Nb7xoykxSwAbLb0YVAXoKDiM/AMOa5e0GXofHtuxEXFSTZxmzOM76q sdpKuZ/pCD8fE3CBSvek3pcRs75rVs/plqfJR6PpfNvcMBfsjwcFpzfuvw/xaAxGNRMQ i/P4cPcmiFAukb4cVoODpimZoCJ8dbsnVrOirjEKxQE0BEenTWnBEYqVb6qqti935Qp6 I8TMCBEQ0DNYw5QrkYSInflQ23qo625K4J2NICvWpTeIkFklZzNR1cuH0KNbgIWvccog SBdA== 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=zcTO/iqoG9NO/9RDKUaLCpPwDrOlsjMXS8oVpL1K638=; b=JjDEooAOuQ2ho8D+XQrO0O33FbxI0E2zMCb+2pT3OrqZqYxSxJiazlG+E1BESpXDZ4 NpMeH9/7cl/xKXKevIVYmUQYbiRsfICs9XMC38MzbfyI2DNljdDfCuWm3pW9KbOv45De tamQCxIs5UCgir46fYEfc0hLYZSSidvosx4u0c2RzgtasmhjBDhUGpIBS6jF15TJrHOW VzvI5yEGh1DCetxa+I1NXDJy3pH4iLiAjf0LKCPvTGAT4Cw+hxwx2NyTYw7v7198bGHx BThknEZ0e8ffMAPAmIn69yncs0+MOf67IGZLC0HU1bozhV8tla9UbVO2MPF2DNLkv2rt QnFA== X-Gm-Message-State: ALKqPwf1ivU1KtHHe5hxDQxi6jWcXt6jN4Xj09tCA/DsDMx7M7PnIZh7 V1gxB9E5ouIqqhe8Fc2NueL/Fo1EFSawMqqHwGo= X-Received: by 2002:ab0:13c9:: with SMTP id n9-v6mr11629049uae.140.1526299949897; Mon, 14 May 2018 05:12:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.144.74 with HTTP; Mon, 14 May 2018 05:12:29 -0700 (PDT) In-Reply-To: References: <5af57fea.1c69fb81.885f0.2377.GMRIR@mx.google.com> <20180511123915.GC16141@n2100.armlinux.org.uk> From: Pintu Kumar Date: Mon, 14 May 2018 17:42:29 +0530 Message-ID: Subject: Re: Delivery Status Notification (Failure) To: Lucas Stach Cc: Russell King - ARM Linux , open list , linux-arm-kernel@lists.infradead.org, kernelnewbies@kernelnewbies.org 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 Hi, Is there any work around possible to set IRQ affinity for some GPIO interrupt ? How to avoid CPU0 to receive the current GPIO interrupt ? How do we assign GPIO interrupts to any CPU other than CPU0 ? Is it possible to isolate CPU0 for a sometime, from my GPIO driver so that GPIO interrupt can be served by another CPU ? Need your inputs to decide whether it is still possible to set affinity for GPIO interrupt, or its impossible ? Thanks, Pintu On Fri, May 11, 2018 at 8:07 PM, Pintu Kumar wrote: > On Fri, May 11, 2018 at 6:34 PM, Lucas Stach wrote: >> Am Freitag, den 11.05.2018, 13:39 +0100 schrieb Russell King - ARM Linux: >>> On Fri, May 11, 2018 at 05:07:37PM +0530, Pintu Kumar wrote: >>> > Hi, >>> > >>> > I need one help. >>> > I am using i.MX7 Sabre board with kernel version 4.1.15 >>> > >>> > Let's say I am interested in GPIO number: 21 >>> > I wanted to set CPU affinity for particular GPIO->IRQ number, so I >>> > tried the below steps: >>> > root@10:~# echo 21 > /sys/class/gpio/export >>> > root@10:~# echo "rising" > /sys/class/gpio/gpio21/edge >>> > root@10:~# cat /proc/interrupts | grep 21 >>> > 47: 0 0 gpio-mxc 21 Edge gpiolib >>> > root@10:~# cat /sys/class/gpio/gpio21/direction >>> > in >>> > root@10:~# cat /proc/irq/47/smp_affinity >>> > 3 >>> > root@10:~# echo 2 > /proc/irq/47/smp_affinity >>> > -bash: echo: write error: Input/output error >>> > >>> > But I get input/output error. >>> > When I debug further, found that irq_can_set_affinity is returning 0: >>> > [ 0.000000] genirq: irq_can_set_affinity (0): balance: 1, >>> > irq_data.chip: a81b7e48, irq_set_affinity: (null) >>> > [ 0.000000] write_irq_affinity: FAIL >>> > >>> > I also tried first setting /proc/irq/default_smp_affinity to 2 (from 3). >>> > This change is working, but the smp_affinity setting for the new IRQ >>> > is not working. >>> > >>> > When I try to set smp_affinity for mmc0, then it works. >>> > # cat /proc/interrupts | grep mmc >>> > 295: 55 0 GPCV2 22 Edge mmc0 >>> > 296: 0 0 GPCV2 23 Edge mmc1 >>> > 297: 52 0 GPCV2 24 Edge mmc2 >>> > >>> > root@10:~# echo 2 > /proc/irq/295/smp_affinity >>> > root@10:~# >>> > >>> > >>> > So, I wanted to know what are the conditions for which setting >>> > smp_affinity for an IRQ will work ? >>> > >>> > Is there any way by which I can set CPU affinity to a GPIO -> IRQ ? >>> > Whether, irq_set_affinity_hint() will work in this case ? >>> >>> IRQ affinity is only supported where interrupts are _directly_ wired to >>> the GIC. It's the GIC which does the interrupt steering to the CPU >>> cores. >>> >>> Interrupts on downstream interrupt controllers (such as GPCV2) have no >>> ability to be directed independently to other CPUs - the only possible >>> way to change the mapping is to move _all_ interrupts on that controller, >>> and any downstream chained interrupts at GIC level. >>> >>> Hence why Interrupt 295 has no irq_set_affinity function: there is no way >>> for the interrupt controller itself to change the affinity of the input >>> interrupt. >> >> The GPCv2 though is a secondary IRQ controller which has a 1:1 mapping >> of its input IRQs to the upstream GIC IRQ lines. Affinity can thus be >> handled by forwarding the request to the GIC by >> irq_chip_set_affinity_parent(). >> >> As this is handled correctly in the upstream kernel since the first >> commit introducing support for the GPCv2, it seems the issue is only >> present in some downstream kernel. >> > > OK. Thanks so much for your reply. > > I saw some of the drivers using irq_set_affinity_hint() to force the > IRQ affinity to a particular CPU. > This is the sample: > { > cpumask_clear(mask); > cpumask_set_cpu(cpu, mask); > irq_set_affinity_hint(irq, mask); > } > > Whether this logic will work for a particular GPIO pin ? > > >> Regards, >> Lucas