From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F016AA04B6; Mon, 12 Oct 2020 21:20:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2AAB51D992; Mon, 12 Oct 2020 21:20:02 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by dpdk.org (Postfix) with ESMTP id 517801D991 for ; Mon, 12 Oct 2020 21:20:00 +0200 (CEST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09CJFLJe140360; Mon, 12 Oct 2020 15:19:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=DzWqaPsg8xLqATXCtdtKyXRBXB5S79e4IxBv659LCXw=; b=Viiz/HV1nRzqzcGTjWoBJyso1caB2FDoZJOmYFrgu6bCoKcQG7CQYfoYUtZQsFmMOjsk uO76/aPFavUrdUFNtCMOwHCNN38PghIsehtyEIKUQrS0XFq3seDvLHxhPqZOsWUT+vQB z+aexjmdUbTv3uM4r/Wn8Ax4k+uLNcrlq8R6Tfbt5JLLAxbyNMq25Wl4dRaSr4J5PLHC IN69BaglaqkpFKKNHACv9DaK5jhQyUnvjDaY76q871Wei0EPfNeBiggVpECQSxwSt+7g HaeYbci6DEoLJEo7FRF+wu7fczKDuobBcdZJ86QOvmMZHSZdEZ+LKNawmAoeNg/atcJE 4w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 344w51g3k2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Oct 2020 15:19:58 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 09CJJv9X009184; Mon, 12 Oct 2020 15:19:57 -0400 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 344w51g3hg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Oct 2020 15:19:57 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 09CJHUKD005886; Mon, 12 Oct 2020 19:19:56 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma02wdc.us.ibm.com with ESMTP id 3434k99yte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Oct 2020 19:19:56 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 09CJJor431588620 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Oct 2020 19:19:51 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D4CB6A04F; Mon, 12 Oct 2020 19:19:55 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 689CB6A047; Mon, 12 Oct 2020 19:19:55 +0000 (GMT) Received: from Davids-MBP.randomparity.org (unknown [9.211.73.22]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 12 Oct 2020 19:19:55 +0000 (GMT) To: "Burakov, Anatoly" , david.marchand@redhat.com Cc: dev@dpdk.org References: <20200630213823.1583764-1-drc@linux.vnet.ibm.com> <20200810210707.745083-1-drc@linux.vnet.ibm.com> <20200810210707.745083-2-drc@linux.vnet.ibm.com> <2c830988-c4db-7bdc-50f3-3fa445a81673@intel.com> <03bace21-0a55-e88b-7f13-2a8764125547@intel.com> From: David Christensen Message-ID: Date: Mon, 12 Oct 2020 12:19:54 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <03bace21-0a55-e88b-7f13-2a8764125547@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-12_15:2020-10-12, 2020-10-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 priorityscore=1501 mlxscore=0 phishscore=0 bulkscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010120141 Subject: Re: [dpdk-dev] [PATCH v3 1/1] vfio: modify spapr iommu support to use static window sizing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" \>>>> -vfio_spapr_unmap_walk(const struct rte_memseg_list *msl, >>>> -        const struct rte_memseg *ms, void *arg) >>>> +vfio_spapr_size_walk(const struct rte_memseg_list *msl, void *arg) >>>>   { >>>> -    int *vfio_container_fd = arg; >>>> +    struct spapr_size_walk_param *param = arg; >>>> +    uint64_t max = (uint64_t) msl->base_va + (uint64_t) msl->len; >>>> -    /* skip external memory that isn't a heap */ >>>> -    if (msl->external && !msl->heap) >>>> -        return 0; >>>> +    if (msl->external) { >>>> +        param->external++; >>>> +        if (!msl->heap) >>>> +            return 0; >>>> +    } >>> >>> It would be nice to have some comments in the code explaining what >>> we're skipping and why. >> >> Reviewing this again, my inclination is to skip ALL external memory, >> which by definition would seem to be outside of IOMMU control, so the >> code would read: >> >>     if (msl->external) { >>         param->external++; >>         return 0; >>     } > > The external memory can still be mapped for DMA with rte_dev_dma_map() > API. The heap memory is meant to be mapped automatically by DPDK, while > the non-heap memory (created with rte_extmem_register() API) is meant to > be managed by the user and will be mapped using the user_mem_map > functions in this file. So for my purpose of identifying the memory range qualified for IOMMU protection, are you saying that external memory in the heap should be included in the DMA window calculation? Like this: if (msl->external && !msl->heap) { /* ignore user managed external memory */ param->is_user_managed = true; return 0; } Dave