Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3946990pxb; Mon, 8 Feb 2021 04:20:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtuwLCWvdDM2D5EoK58PsTK0+zfHUrkA9PXguscgWgTgNFkvwJ9hk8eA3npAVW3dhHa5wl X-Received: by 2002:a17:906:39d0:: with SMTP id i16mr16825485eje.18.1612786811632; Mon, 08 Feb 2021 04:20:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612786811; cv=none; d=google.com; s=arc-20160816; b=O0Y5WuEAzcASIO1vIufBtdkl/s0Aga7//kJkJWqkp9YrtBETDy0cFNjUMZ4MLASyv7 NEkel6VmqWEYj0T5XQjFm0BFjjV0Rod66AsC5Qeis5NoIPQb4FD/VR6/Bf9ijnmF3rZO /uxs6FyVbspmiJEfZqkS/gPKhzV3h/5zF6t//IvdwQk0rt02On2+MluQAFzt0TUTcBLU MgFtrujTpPV9BrDTCM6RF6+ugJbczhbxko+1L8B8mnSxzVi7t/kvpHoAfiU/gsDzXTfE 4jQ7gOUbelLGPFbRAhKgYkmlxW2FrDcGH6INo+kz54MfvEennBSlsRQkAjW5QeOAnUpk LMJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version; bh=nVd2A/KesqDCb6398RHS2xucf/LRflAYQ/JdyB1onKU=; b=vkaT709ugvyVadVJgauGGx64NbPTqDUujkkGCHhz9XOozcwXnlIKCTp2cN0QDpRSny /QlPSoP7PPQuR0YZoRFiiVRHslErjQlMl9qjKk33F5Q+TTzxm0pTJl6MzhMpK2CeVQC0 P5NoVQW682I0y3LIR85T0hf+ajh/dz+nox+OQdwfAJhFJDDbgGoLSPmUiDJLk1oRLneu zgMUwUNw9GGwwyIApidbZLlwut13dMjbelXUPm+katespXlhg++cH7PQuaVLbu1gfJjQ tKlJEojgFeMgP1QRtXNERc4jormbRTDSXRMdnGPuxLcVZyEc/wlTZoMvefIHLYJKZRey J97g== ARC-Authentication-Results: i=1; mx.google.com; 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 v8si3187176ejo.282.2021.02.08.04.19.47; Mon, 08 Feb 2021 04:20:11 -0800 (PST) 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; 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 S231514AbhBHMRo (ORCPT + 99 others); Mon, 8 Feb 2021 07:17:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:40778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231841AbhBHL7v (ORCPT ); Mon, 8 Feb 2021 06:59:51 -0500 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 EED3A64E8A; Mon, 8 Feb 2021 11:59:09 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1l95C7-00ClqQ-Lx; Mon, 08 Feb 2021 11:59:07 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 08 Feb 2021 11:59:07 +0000 From: Marc Zyngier To: Luo Jiaxing Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linuxarm@openeuler.org Subject: Re: [PATCH v1 1/2] irqchip/gic-v3-its: don't set bitmap for LPI which user didn't allocate In-Reply-To: <1612781926-56206-2-git-send-email-luojiaxing@huawei.com> References: <1612781926-56206-1-git-send-email-luojiaxing@huawei.com> <1612781926-56206-2-git-send-email-luojiaxing@huawei.com> User-Agent: Roundcube Webmail/1.4.10 Message-ID: <508c6c07a2c599ae1fc8b726fda69b44@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: luojiaxing@huawei.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linuxarm@openeuler.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-02-08 10:58, Luo Jiaxing wrote: > The driver sets the LPI bitmap of device based on > get_count_order(nvecs). > This means that when the number of LPI interrupts does not meet the > power > of two, redundant bits are set in the LPI bitmap. However, when free > interrupt, these redundant bits is not cleared. As a result, device > will > fails to allocate the same numbers of interrupts next time. > > Therefore, clear the redundant bits set in LPI bitmap. > > Fixes: 4615fbc3788d ("genirq/irqdomain: Don't try to free an interrupt > that has no mapping") > > Signed-off-by: Luo Jiaxing > --- > drivers/irqchip/irq-gic-v3-its.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c > b/drivers/irqchip/irq-gic-v3-its.c > index ed46e60..027f7ef 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -3435,6 +3435,10 @@ static int its_alloc_device_irq(struct > its_device *dev, int nvecs, irq_hw_number > > *hwirq = dev->event_map.lpi_base + idx; > > + bitmap_clear(dev->event_map.lpi_map, > + idx + nvecs, > + roundup_pow_of_two(nvecs) - nvecs); > + > return 0; > } What makes you think that the remaining LPIs are free to be released? Even if the end-point has request a non-po2 number of MSIs, it could very well rely on the the rest of it to be available (specially in the case of PCI Multi-MSI). Have a look at the thread pointed out by John for a potential fix. Thanks, M. -- Jazz is not dead. It just smells funny...