Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp129723rdh; Tue, 6 Feb 2024 23:00:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVOJz0mtVcAgKeLLxIhHXNAxv2ZjFsZuLWuMI1RVTPZtFn6BTP0kNMbz/Osim7mAmoocbukZve2pPOz5qID7y+xFRSBd+bRBIDOoIw5Lw== X-Google-Smtp-Source: AGHT+IHQoTCGU6G1l4uTbUkATReJ5b7ZR15DS7Vz+OMruUxqnhmShqIxnia8dsAEwr2iRsoB0jAA X-Received: by 2002:a17:906:53cf:b0:a38:2ba9:7f8c with SMTP id p15-20020a17090653cf00b00a382ba97f8cmr3623313ejo.21.1707289227925; Tue, 06 Feb 2024 23:00:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUXCLzcYRwsHffPBIEzoXKXQyXV3Pkq69jp1We9QLMiNg1eaNxrw6ddvjYtBxzMiB6HY9SqRv2E15YtJ4Rw8pjsUQwOZmPF7L1jXLhV7g== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gw16-20020a170906f15000b00a382ca6f8a3si571213ejb.19.2024.02.06.23.00.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 23:00:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56051-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=tFpilawa; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-56051-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56051-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7E2821F2762A for ; Wed, 7 Feb 2024 07:00:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6DEB1CF94; Wed, 7 Feb 2024 06:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="tFpilawa" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2074.outbound.protection.outlook.com [40.107.92.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2C91200C7; Wed, 7 Feb 2024 06:59:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.74 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707289183; cv=fail; b=oB4JBfGm9exUIwozF4gCZmRg0BN2t16j8LH9W7zyTt96MfLy07NN1PKsXQWnJEAzdZD+q50EKEA8aT80nZq6dYKyO9t24d2peKhGPJBwF8HZRjZ07zLCtpN4qemKMDAA0MZPXM0g8U6zZde9jccHUejFBZJ3OuAKLu/GDpDm+jo= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707289183; c=relaxed/simple; bh=tK2lzvh0a9cfTmRTqOnKXtJ2Ki7/NQDSwv6rQSSI7Bo=; h=Message-ID:Date:Subject:From:To:Cc:References:In-Reply-To: Content-Type:MIME-Version; b=VlTg1dccgpoNis1l4U29B1280QBc+yzk/zfpWjia2dZ8ZUbRab/aT1eoxdbUg7y7++6m7ggojR/ixpyLJxPUzHUa42XKuldzRyTbzcV/jlt5y5geYyAB8VB22QA50ZHqOUOGPzU7c8vnciqrW3xTac+G2pDqyZfXEE+s4j3wZHI= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=tFpilawa; arc=fail smtp.client-ip=40.107.92.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ioiKqrNxOjyhG4dXDlLUB1ByrpCYQc/nYoVe3N9vQlYwQI61N1Q+KDcFBk/dyP+jGfiYZKe79rqxn7GuWRVuJdPMdEScjiDGQlaxA583QjZkX6ax+TdTqbkXsrbGRHVIFf1vqHT6MHMQ7RwAGgT2oyHFmlzE1p0zh9JNlBLZzmp2TRX2mNaoYOrAm6LGXQnAi8pmJRCoORS/q40tWktYwp8v1+esRDQnDrPcJsVW4tbLXHwJyAZ/PisiYAoYXICPja8oCdLQnjVk2gNGhI/CKsKFqxfcz0sDHdIn6tbheSTmN8wpr8Pun0TUntIJdzeQxQvssu/Pys7VqCTM28GztQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5OTNsUhAJLxuwSJWTTf+VxosVOISkM1YC9HoFncuvTI=; b=Cf02DFIyvFREGPT4qtzfj6V0Fj5yoSABI4XQqoP0iljD5pb0ztWeF18fxhznKl/OJx78iaAam/iwXYa5jVVDoxTdCMeHWlpO+tPqjmbjjmP/Ur4cjS+bdqhaQ2LvwjFUk4FP808m1dB6mLO4IYYeikckGpgx917v1qBOY+I/7nXwwjov9j56XJQXXS6KS9QagiCxnRwNCtxLPJcyF3aXom4DkCenxkn++nnQDZjbdSEKT52E6Tdrcej99C/uXLj1TwsJCu6MSyfoEbFRtxocebqw0dlQhtS/bp8dDEQEaNL5M1kzmekDD28/wjPGM25uoc/nq4TG+lpnkvoJHQqCvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5OTNsUhAJLxuwSJWTTf+VxosVOISkM1YC9HoFncuvTI=; b=tFpilawalkH5XvQoyt13yQx6IppFziMrKcHQqDmIv/jJ9rLvTXz8DwwMvwWXu+u33xw5sn8SwkLqb2Yg9m9B/n1C1zUPEZgv7Ly7etmHKkW9ohSTCMdaqeyxwMTRyoF8GU1nDgqrWWdMy4IvwRQgXDFMbj608iN13Y2nG4HdVIc7/gwRLK23i3xRXFX3D9uqkBu6e6egtqtxTJLC+nj5g1AouHvh61QoR7AqxTCDTg1YQSf8MKTaSO3/v8rDmMk12zKjoh5E92O8qWOqS7xCbb9F9DoVarzEhhTQNuiupL0fqSczse8I4ulI4BvBcLflZr2d5fUWKZG8kVO9cVsNAA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from PH8PR12MB6674.namprd12.prod.outlook.com (2603:10b6:510:1c1::18) by DM4PR12MB6278.namprd12.prod.outlook.com (2603:10b6:8:a4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.17; Wed, 7 Feb 2024 06:59:38 +0000 Received: from PH8PR12MB6674.namprd12.prod.outlook.com ([fe80::e85f:6a24:436f:5594]) by PH8PR12MB6674.namprd12.prod.outlook.com ([fe80::e85f:6a24:436f:5594%3]) with mapi id 15.20.7270.015; Wed, 7 Feb 2024 06:59:38 +0000 Message-ID: Date: Wed, 7 Feb 2024 12:29:29 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V4] PCI/MSI: Fix MSI hwirq truncation From: Vidya Sagar To: bhelgaas@google.com, rdunlap@infradead.org, ilpo.jarvinen@linux.intel.com, tglx@linutronix.de Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, treding@nvidia.com, jonathanh@nvidia.com, sdonthineni@nvidia.com, kthota@nvidia.com, mmaddireddy@nvidia.com, sagar.tv@gmail.com References: <20240111052814.713016-1-vidyas@nvidia.com> <20240115135649.708536-1-vidyas@nvidia.com> <23c5fac1-ebf1-4e5d-9691-7b87060b0df3@nvidia.com> <0c9d7bab-1da7-4ac5-891a-62e28db8d60a@nvidia.com> Content-Language: en-US In-Reply-To: <0c9d7bab-1da7-4ac5-891a-62e28db8d60a@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MA0PR01CA0031.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:b8::18) To PH8PR12MB6674.namprd12.prod.outlook.com (2603:10b6:510:1c1::18) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH8PR12MB6674:EE_|DM4PR12MB6278:EE_ X-MS-Office365-Filtering-Correlation-Id: d73f55c6-efa1-4f85-20d4-08dc27aa5990 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YxCw018hLPiM5/VEdiLJtWdQa8iVigS8lLkJkvG7XDP6mTn0tDWkf1P9Bd7hRdCN1zwMi4WuUNXLt0NL5ZdXmDXThiCVm3Frx5CMyHjPIvR9UPF9w6USS3ipEuNksUH4N0gTwl5h47T+U7PfZYU+LWGH4ei1abrZl3a20M7XfuLQ0jJUnvU9tTxGnCULmr6LEL159exdVbCXWwjzrOlqL8K5s+cg0q7QZ72dKUamEAGzhH1Zh0D5ZbmLUDnTMNU65qgRJ9nPgJuOb9ejZn2RE+QwX7VGmtHML8nXPjaZzuJE9XIh8xJzDFZdhjwKFa3HwjPfoy/9mQvw081SA1GJZFTh2c6vEI1heJ7Ju5FfLnYeUHfPULq5sq/o5vSnTBn/lv+TQbtELMqo6VeUSVAtsQeyKyBYzjb4nAncgJ22bha+ENxn95CVKSCLJuAcNFAJ6q9lWrDEBQZ++iQq1hAnh4cSd8yaExWrerOSDofTU9La8BOciKwJFvQnOTPbobAogTiOeGbpU27unjD9E0VDfp+j0Msq+zt4nPBEUHhxyLMVf6GJZjXlURZp15fStPUHCB/weu+0aksluPtQpr/9o3mocHa8uHJR4n88sAVccnnhpAlNhmmFN+tsxN2yUe0nFWQ9MC0Qm022Fp5/rbpF3g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH8PR12MB6674.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(376002)(136003)(346002)(366004)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(316002)(6486002)(86362001)(2616005)(31696002)(478600001)(26005)(31686004)(6506007)(6512007)(83380400001)(6666004)(66556008)(53546011)(66476007)(66946007)(38100700002)(8676002)(4326008)(8936002)(36756003)(5660300002)(2906002)(41300700001)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZzFiUldJS05uN2NWWDU1K2d0M2NvNWtlOGxNeEl5Yy9ZNHpCTkM4aWRPbjhu?= =?utf-8?B?Zk1rckY5NkhoUi9vaW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TeTVDM0YzRmN1?= =?utf-8?B?NDR6a3VaVkdiV3Bob2M3b0RoMDF1VDNtQVM4TjFBc253ZitQdUFmOGFxK3dP?= =?utf-8?B?Qll5TXBNVDBhK2JEektYZ2Z5VHBwejlvdTU3WU8zNXRDVWZUVjlwTlYxeElv?= =?utf-8?B?OWZqZ0JLenR1WWI2S1B6YWowWWcrdDVKdTRMTThPWVAyV1ZNYlExQTVsa3hw?= =?utf-8?B?STBOVXdmbjNYdUpJY095SXVJSW1tUnB0MzlxNDJnSlFEajBWRmxMVVYxRERa?= =?utf-8?Q?V4UklFCX3dH54r4AGIlRtohMk?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d73f55c6-efa1-4f85-20d4-08dc27aa5990 X-MS-Exchange-CrossTenant-AuthSource: PH8PR12MB6674.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2024 06:59:38.3694 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VcVVbHv/bNTfjR/VvYbV7g8G7ohYW//0iYF2o9k7o5Ti0hdzo6Y5Q3Xf8O4DHo3/d4YfG55a9wQRjWIosR+qYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6278 Hi Thomas / Bjorn, Can you please guide me on getting this patch merged? Thanks, Vidya Sagar On 1/31/2024 8:45 AM, Vidya Sagar wrote: > Hi Thomas, > Sorry to bother you. > Would you mind giving an Ack to this patch? > > Thanks, > Vidya Sagar > > On 1/23/2024 9:31 PM, Vidya Sagar wrote: >> Hi Thomas, >> Does this patch look fine to you? >> If yes, would you mind giving an Ack? >> >> Thanks, >> Vidya Sagar >> >> On 1/15/2024 7:26 PM, Vidya Sagar wrote: >>> While calculating the hwirq number for an MSI interrupt, the higher >>> bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI domain >>> number gets truncated because of the shifted value casting to return >>> type of pci_domain_nr() which is 'int'. This for example is resulting >>> in same hwirq number for devices 0019:00:00.0 and 0039:00:00.0. >>> >>> So, cast the PCI domain number to 'irq_hw_number_t' before left shifting >>> it to calculate hwirq number. Please note that this fixes the issue only >>> on 64-bit systems and doesn't change the behavior in 32-bit systems i.e. >>> the 32-bit systems continue to have the issue. Since the issue surfaces >>> only if there are too many PCIe controllers in the system which usually >>> is the case in modern server systems and they don't tend to run 32-bit >>> kernels. >>> >>> Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy >>> irqdomain") >>> Tested-by: Shanker Donthineni >>> Signed-off-by: Vidya Sagar >>> --- >>> V4: >>> * Added extra information in the change log about the impact of this >>> patch >>>    in a 32-bit system as suggested by Thomas >>> >>> V3: >>> * Addressed review comments from Thomas Gleixner >>> * Added Tested-By: Shanker Donthineni >>> >>> V2: >>> * Added Fixes tag >>> >>>   drivers/pci/msi/irqdomain.c | 2 +- >>>   1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c >>> index c8be056c248d..cfd84a899c82 100644 >>> --- a/drivers/pci/msi/irqdomain.c >>> +++ b/drivers/pci/msi/irqdomain.c >>> @@ -61,7 +61,7 @@ static irq_hw_number_t >>> pci_msi_domain_calc_hwirq(struct msi_desc *desc) >>>       return (irq_hw_number_t)desc->msi_index | >>>           pci_dev_id(dev) << 11 | >>> -        (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27; >>> +        ((irq_hw_number_t)(pci_domain_nr(dev->bus) & 0xFFFFFFFF)) << >>> 27; >>>   } >>>   static void pci_msi_domain_set_desc(msi_alloc_info_t *arg,