Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2042445ybe; Tue, 3 Sep 2019 07:12:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLsBt/rdtOiWivUFbH1IAbSh0UmcVpBhmU+KcJ8kVfen2QKWM3/4wAo0JkMkhFJkMT9AhT X-Received: by 2002:a65:6859:: with SMTP id q25mr29920748pgt.181.1567519940245; Tue, 03 Sep 2019 07:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567519940; cv=none; d=google.com; s=arc-20160816; b=jEBzjHga3dL3+il3daJHcjvw0fpy+T2NaxGoOwSArbI+RD+3utoJq0DQQFo9rmpaA5 JQBmUTKiOBav+IwrgruK5uSw7O3hihrN+simhezh7CB5ofaCBQq7SSsum36B734DKizn 5uMCK37c8sxJdjLd8UMgIBjEHsVx19Ou/82xerb+xt+LSjakgQQlTHwlXgm4ZX9llNcP ZZ2E1J8Am9u1jwliV0/o0ubZXKp1xShRma8IDV9gbGTsXLc5Dt1v5LDkIgUjAoI+mUMO 6fM+3Zj4Vd3WylB/pU1s1N9BywhgcCTsLiA57kv6A5/xGB6VefvgZ550qeu8NYttDLlc m5TQ== 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:date:message-id:cc:to:subject:from; bh=B1ljOURBmIyKsrhNvkB5li6gnA3MKYBtFly4UK1OVhg=; b=x6dMmZtve1OJeUTobQYl1Qk63InzyKWwhllzJ8qDRtnA3j5hEiixJVuDKyHMzOL7Tt 9+QmXwCus+bJI7EtInX+luwbU6NiyoTOXOJFoadoOeQEgAdOUM2iZxP8m6QY5uDGlzZE DEHqrXtTT4w1xO4560M8QCo8ELTk75Eq3cP4f+TF89SRMb8j9D5SNFXLQFt9KVUgJs50 K0/5gpTH9QWqd8JER6jp02SCz7p3XWQ9eLTF7yL40UTMRv+PW+ILs5YTIh7p5WrO8PDv SvVKQVuurw61lLEJT/YkFPGSFPidysRpav1VKMKT2xyCmZA9+HSAs5p9NcGE4uDjjs6V GxdQ== ARC-Authentication-Results: i=1; mx.google.com; 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 z9si14765731pgk.46.2019.09.03.07.12.03; Tue, 03 Sep 2019 07:12:20 -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; 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 S1729137AbfICOJw (ORCPT + 99 others); Tue, 3 Sep 2019 10:09:52 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5734 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727667AbfICOJw (ORCPT ); Tue, 3 Sep 2019 10:09:52 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 50AF157CBA547659F7F6; Tue, 3 Sep 2019 22:09:48 +0800 (CST) Received: from [127.0.0.1] (10.202.227.238) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Tue, 3 Sep 2019 22:09:41 +0800 From: John Garry Subject: PCI/kernel msi code vs GIC ITS driver conflict? To: Marc Zyngier , Thomas Gleixner , "Bjorn Helgaas" CC: Linux PCI , Linuxarm , "luojiaxing@huawei.com" , "linux-kernel@vger.kernel.org" Message-ID: Date: Tue, 3 Sep 2019 15:09:36 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.238] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, Bjorn, Thomas, We've come across a conflict with the kernel/pci msi code and GIC ITS driver on our arm64 system, whereby we can't unbind and re-bind a PCI device driver under special conditions. I'll explain... Our PCI device support 32 MSIs. The driver attempts to allocate msi vectors with min msi=17, max msi = 32, and affd.pre vectors = 16. For our test we make nr_cpus = 1 (just anything less than 16). We find that the pci/kernel msi code gives us 17 vectors, but the GIC ITS code reserves 32 lpi maps in its_irq_domain_alloc(). The problem then occurs when unbinding the driver in its_irq_domain_free() call, where we only clear bits for 17 vectors. So if we unbind the driver and then attempt to bind again, it fails. Where the fault lies, I can't say. Maybe the kernel msi code should always give power of 2 vectors - as I understand, the PCI spec mandates this. Or maybe the GIC ITS driver has a problem in the free path, as above. Or maybe the PCI driver should not be allowed to request !power of 2 min/max vectors. Opinion? Thanks in advance, John