Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp636376rwd; Mon, 12 Jun 2023 20:28:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Hg4UAL8caaUfjTdytntgiDrAvgQSShFSRdswa7HKZGuC8SexGjjoo7pfChXamxk/0XRzt X-Received: by 2002:a17:907:6d0e:b0:973:f72f:dfac with SMTP id sa14-20020a1709076d0e00b00973f72fdfacmr8539080ejc.67.1686626884346; Mon, 12 Jun 2023 20:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686626884; cv=none; d=google.com; s=arc-20160816; b=vJX/spanlnwu+ozFx2XAPsSWon44ruQTcFnvm2Hl7kl9JvFjHSt08+1glUhcJ+fXrf U8kxK28ERLaVVhwJ3HjQgr3Vgd26nHRhe206yGRE3VZGztB/GfcaltUUMCmMykjmF3ZJ NdUQkKFXmzCf+0OvyGx8ryC8jcbappNkwL/SKks7GTEttMfTEb6v5LRcSSAJaTJf6m1N JglY++H85dITeGS/cpp3D3EhD3whW/LQ1dhYiJQ+I5FPsaFa7oH7aXDHzDAw4LciAtbG W3zWhc0goqx1DbT9DXIzdshklI2li7m4ScdxyNWyRtTpLajOlA9njrQ9qCI49UKVyatY AN7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=jL/FWqObv9TQq2pqcaGCYv9bHctI5HKAeXNMAUAY3Zw=; b=RvpHkB3m8LZ+cl2PZBc9SezuE5M5wG7G9u5hBKGye81XOQhtUpaab3u3xmolHRVBZa 7UnSFY1efFgjuilV+BuEOr2XEKPFeFtN8p572PiZVEdD2V8UPWmW0sRmWsoBY0HQEazs 7pOFO+ajKOi//yQj5I6OCTxHFMcmkbGvviF3NNvuzem6gYkGMcG5iwkQuW+N/mHchLNc j8k2fZ34MxmxsYsa4U9MvsFVl5LPPBn3RQ/TZG7dCYFZjLf3yBu63Va0w8h7WyCQRSbt px3qobNomIicc7ymHfEqmdBm1SK9hzEOItGg+uqOQuBQO+fU/r1iBdPWs/nJDLMro6hi krwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="A5hUxcR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ju12-20020a17090798ac00b00977cfca6e9asi5512243ejc.300.2023.06.12.20.27.39; Mon, 12 Jun 2023 20:28:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="A5hUxcR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233125AbjFMDLX (ORCPT + 99 others); Mon, 12 Jun 2023 23:11:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239923AbjFMDKM (ORCPT ); Mon, 12 Jun 2023 23:10:12 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 470EF4217; Mon, 12 Jun 2023 20:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686625685; x=1718161685; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=P/VoxzPYJGKVWcFbYSel2k5NLgVhyd1yXneHuuZGDj4=; b=A5hUxcR/V6JQbNWBukutmDykPOmHf/ivJiE8ay5jtPZFTdGHlHdvgL73 fHuMhi5ByDTwjQbc0ACr3cRKMA1QjhiFxRGxcvK9XBtKpaj6OVndWdW+q 8nQ4cEeyxdIJNDVXmBbYAkcSlij4A2fyp/5aPocWNvI6uKzkq5eYENlq7 HQPfwW6RHvhUZIK1zcF2UiBpv4+hsaHDlSzlSweuzcQek7iUczma/COEP bqMgGjbjaa77MVq4t2hzxtLY2ipKdrha0/ywPaTWq/zBxgde5IcGiVBw/ +gV8Svo2j/5GRJhU8tIFYyswhNvfAJpqXYXHdQA7hfvLoPiDDhox2Qj1O g==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="424098731" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="424098731" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 20:07:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="1041594701" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="1041594701" Received: from allen-box.sh.intel.com (HELO [10.239.159.127]) ([10.239.159.127]) by fmsmga005.fm.intel.com with ESMTP; 12 Jun 2023 20:07:09 -0700 Message-ID: Date: Tue, 13 Jun 2023 11:06:03 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cc: baolu.lu@linux.intel.com, Will Deacon , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Dave Jiang , Tony Luck , "Zanussi, Tom" , rex.zhang@intel.com, xiaochen.shen@intel.com, narayan.ranganathan@intel.com Subject: Re: [PATCH v8 2/7] iommu: Move global PASID allocation from SVA to core Content-Language: en-US To: Jacob Pan , LKML , iommu@lists.linux.dev, Jason Gunthorpe , Joerg Roedel , Robin Murphy , Jean-Philippe Brucker , dmaengine@vger.kernel.org, vkoul@kernel.org References: <20230602182212.150825-1-jacob.jun.pan@linux.intel.com> <20230602182212.150825-3-jacob.jun.pan@linux.intel.com> <08830c11-5528-0c42-0bc3-89c3796611fe@linux.intel.com> From: Baolu Lu In-Reply-To: <08830c11-5528-0c42-0bc3-89c3796611fe@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/10/23 8:13 PM, Baolu Lu wrote: > On 6/3/23 2:22 AM, Jacob Pan wrote: >> +ioasid_t iommu_alloc_global_pasid_dev(struct device *dev) >> +{ >> +    int ret; >> +    ioasid_t max; >> + >> +    max = dev->iommu->max_pasids; >> +    /* >> +     * max_pasids is set up by vendor driver based on number of PASID >> bits >> +     * supported but the IDA allocation is inclusive. >> +     */ >> +    ret = ida_alloc_range(&iommu_global_pasid_ida, >> IOMMU_FIRST_GLOBAL_PASID, max - 1, GFP_KERNEL); >> +    if (ret < 0) >> +        return IOMMU_PASID_INVALID; >> + >> +    return ret; >> +} >> +EXPORT_SYMBOL_GPL(iommu_alloc_global_pasid_dev); > > "dev->iommu->max_pasids == 0" indicates no pasid support on the device. > The code should return IOMMU_PASID_INVALID explicitly. Perhaps we can > make this function like this: > > ioasid_t iommu_alloc_global_pasid_dev(struct device *dev) > { >         int ret; > >         if (!dev->iommu->max_pasids) >                 return IOMMU_PASID_INVALID; > >         /* >          * max_pasids is set up by vendor driver based on number of > PASID bits >          * supported but the IDA allocation is inclusive. >          */ >         ret = ida_alloc_range(&iommu_global_pasid_ida, > IOMMU_FIRST_GLOBAL_PASID, >                               dev->iommu->max_pasids - 1, GFP_KERNEL); > >         return ret < 0 ? IOMMU_PASID_INVALID : ret; > } > EXPORT_SYMBOL_GPL(iommu_alloc_global_pasid_dev); > > Other change in this series looks good to me. > > I hope I can queue this series including above change as part of my VT-d > update for v6.5 to Joerg if no objection. > > Let's try to re-enable this key feature of Intel idxd driver in v6.5. This series didn't pass my test. The first time when I run "idxd_ktest.sh -c 1 -t 1 -i 100 -m shared", it passed. But when I run it again, the idxd hardware operation resulted in timed-out issues. I have removed this series from my queue. Best regards, baolu