Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp350591ybm; Fri, 29 May 2020 01:34:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4oi+zKkMalExdfegfYwFd7JJQeX8WvPNUaqoWZzO5iBwKXkoXV4jHcEdQ9dNpVnk4v+vd X-Received: by 2002:a17:906:f6d6:: with SMTP id jo22mr6406127ejb.310.1590741290334; Fri, 29 May 2020 01:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590741290; cv=none; d=google.com; s=arc-20160816; b=PCP7AZITVxOX2tAjbObekDpjU+GG3FIvT7TlUWNTYyBKdl5nZckr5D350DZRZT/z4H 8Xn4Oq1qPZOWm8xMz/7EMjuCgDPBb5A46Vef662Xm0CPeXEvxmB26w7Ui7u/QRbeZWnV spPOGnvK9/3f9J+vIRG8OHSvVt36Y+jzWIvcPPf1GivGGjXlrFhNNtLY4+CryIlGx+Hs abZzgebW0aB5pemAanpnm8yN+EwBhA5a17pzZsPGKrLcVhlrh92SmxlKa1f/DNH0rl8w QJmKAG0Jk/8VDywOwSlSFHXZ8HFLp7VvwVYnwV/R1s1Hz03ImaVYDJo10pcm9ubU1bNf Zopw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=GnRp7ujizT7JHYM0sEH+tEA34YMiZxHfbgql5Ep3mpM=; b=ICA4RoOfYsEOWkaFcjJF1jOqDF3KzRpTf6NcN3H3inQraMZtcNLaMAn6gVAJIQ8rBc 7fpozzGgImrasKcZjXUo+DtCwQJkbgmzcI9VE3G7QKE8W6ATADlTKSpT7Qtfr0BebF+K ss6uVCBj5+u7EvjLbbk1MyeI/srg23zlOk2mPufPiroX2NSmfxy6iuaXTB5Sib8k3tSk N6gW6D/5p7juHNTDJn7Ej1TwGKZ82yqlkvDAyd/axMPo3wsfg5Sf4Z45sKZTn51IyQII g3/GlWEo0a4AlCppcZZaddCABRxDU0DW9IcuY9lcYc1TOcqIPgu5fQvHPKD8j8SkTK87 hnzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=joysJ+Np; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 4si4573212edw.72.2020.05.29.01.34.27; Fri, 29 May 2020 01:34:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=joysJ+Np; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726330AbgE2Ich (ORCPT + 99 others); Fri, 29 May 2020 04:32:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:46912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbgE2Icg (ORCPT ); Fri, 29 May 2020 04:32:36 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (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 95CD2207F5; Fri, 29 May 2020 08:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590741155; bh=c6Aa5ByuhdG16T+5Vu74GnNb0ZM+kd3oe7ecqFSIjgY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=joysJ+Nph1O6ii0Q3g0E5dyYkW2jwQEFd1pZ0jexWpDcDdZDw/XCRQlYlZ20PpBoV 0f5TU88TMJzW4ub8J2EfxgBtv1ynUdMN48EFzdgrohcbJLLvER467XxLdtOH0hPIUD IquyZ2Wcsof87ce7gBTifswM/74D6c7vWMUhM2Lk= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jeaRN-00GDax-PL; Fri, 29 May 2020 09:32:33 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 29 May 2020 09:32:33 +0100 From: Marc Zyngier To: Ali Saidi Cc: Thomas Gleixner , Jason Cooper , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, benh@amazon.com, dwmw@amazon.com, zeev@amazon.com, zorik@amazon.com Subject: Re: [PATCH] irqchip/gic-v3-its: Don't try to move a disabled irq In-Reply-To: <20200529015501.15771-1-alisaidi@amazon.com> References: <20200529015501.15771-1-alisaidi@amazon.com> User-Agent: Roundcube Webmail/1.4.4 Message-ID: <8c3be990888ecfb7cca9503853dc4aac@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: alisaidi@amazon.com, tglx@linutronix.de, jason@lakedaemon.net, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, benh@amazon.com, dwmw@amazon.com, zeev@amazon.com, zorik@amazon.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ali, On 2020-05-29 02:55, Ali Saidi wrote: > If an interrupt is disabled the ITS driver has sent a discard removing > the DeviceID and EventID from the ITT. After this occurs it can't be > moved to another collection with a MOVI and a command error occurs if > attempted. Before issuing the MOVI command make sure that the IRQ isn't > disabled and change the activate code to try and use the previous > affinity. > > Signed-off-by: Ali Saidi > --- > drivers/irqchip/irq-gic-v3-its.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c > b/drivers/irqchip/irq-gic-v3-its.c > index 124251b0ccba..1235dd9a2fb2 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -1540,7 +1540,11 @@ static int its_set_affinity(struct irq_data *d, > const struct cpumask *mask_val, > /* don't set the affinity when the target cpu is same as current one > */ > if (cpu != its_dev->event_map.col_map[id]) { > target_col = &its_dev->its->collections[cpu]; > - its_send_movi(its_dev, target_col, id); > + > + /* If the IRQ is disabled a discard was sent so don't move */ > + if (!irqd_irq_disabled(d)) > + its_send_movi(its_dev, target_col, id); > + This looks wrong. What you are testing here is whether the interrupt is masked, not that there isn't a valid translation. In the commit message, you're saying that we've issued a discard. This hints at doing a set_affinity on an interrupt that has been deactivated (mapping removed). Is that actually the case? If so, why was it deactivated the first place? > its_dev->event_map.col_map[id] = cpu; > irq_data_update_effective_affinity(d, cpumask_of(cpu)); > } > @@ -3439,8 +3443,16 @@ static int its_irq_domain_activate(struct > irq_domain *domain, > if (its_dev->its->numa_node >= 0) > cpu_mask = cpumask_of_node(its_dev->its->numa_node); > > - /* Bind the LPI to the first possible CPU */ > - cpu = cpumask_first_and(cpu_mask, cpu_online_mask); > + /* If the cpu set to a different CPU that is still online use it */ > + cpu = its_dev->event_map.col_map[event]; > + > + cpumask_and(cpu_mask, cpu_mask, cpu_online_mask); > + > + if (!cpumask_test_cpu(cpu, cpu_mask)) { > + /* Bind the LPI to the first possible CPU */ > + cpu = cpumask_first(cpu_mask); > + } > + > if (cpu >= nr_cpu_ids) { > if (its_dev->its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) > return -EINVAL; So you deactivate an interrupt, do a set_affinity that doesn't issue a MOVI but preserves the affinity, then reactivate it and hope that the new mapping will target the "right" CPU. That seems a bit mad, but I presume this isn't the whole story... Thanks, M. -- Jazz is not dead. It just smells funny...