Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2862195pxj; Mon, 14 Jun 2021 08:49:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2eJ1exXh25T8EcqYyTZIroEqHIhXa1oW401wTbLLr59/yAkN4hApweMkXasWSp2NWXbCg X-Received: by 2002:aa7:d602:: with SMTP id c2mr17895874edr.317.1623685783854; Mon, 14 Jun 2021 08:49:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1623685783; cv=pass; d=google.com; s=arc-20160816; b=cdc/+XpCnYgd8orIv2prQRx+PzjaHrxZbgm1r/Ow9kGiKUFfJ4Rp1NqA2VIFmol3Ep +w8b3DQyiZRi3vUmo9TiwoN2tyGq+bKEumIoRjoCV1ljwEbBkPNKDMlJ/U1ZMUA2kZNG yuvyvDE5Etr7wO+nXYM3kfBwpMDL+zv5T+aCpDN9SjNTaDOfN5XywrlAIf9hsyfmKNEI j/SIAxknPizOqkyKrEw7BMUOGUWiPvWYBlCakAiKxvDOYRV6pLMc+DNL+6g/DPb2qIGQ a1jrlTtXiSYTbjIrl+VpxWl2veXxT9Wqd1eKF/S6irm5xu8NwLO7pg5YbRgDBWrc2U5k l7hw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-language :content-transfer-encoding:in-reply-to:user-agent:date:message-id :from:references:cc:to:subject:dkim-signature:dkim-signature; bh=t1qtCFv42Ehv8s+NNj+MyFNBqYrN7lrL8g47Ata/JRM=; b=zHDpGvRygfFhs2qxUAuaPraulmxxqsV7HPpGPa1h5n15o7j0XbItNzNP8gNJdzxy9z Dcxr09ZCsW4rr820xdWPAbPBh9PuWFRHRo5IfM6TveAmFKrA4FroducM5qgXtHkWpfI0 DTR6At3XCFfcx1rHy25Zpw0UntvGpIi2mmAMjEX5R+98WiDh6xCJ4n528zGPjPoLrN0j LYsYgQGf5u4Tl2G5QBffJT3/8CdbNdou+kBcIZDzWbRQBVetJQFGIopsSoOgF/GQYOXD Ix/5dOdm7lS2hqlbwzW2BEHimfEHQ7UhuP1ilfcXL+UNAQF4RPO3L6SoynruGnIpkiBN umsg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=KCUvgy6a; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=NeJYS48p; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si11326517ejz.386.2021.06.14.08.49.20; Mon, 14 Jun 2021 08:49:43 -0700 (PDT) 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; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=KCUvgy6a; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=NeJYS48p; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233560AbhFNPsG (ORCPT + 99 others); Mon, 14 Jun 2021 11:48:06 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:5834 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233985AbhFNPsF (ORCPT ); Mon, 14 Jun 2021 11:48:05 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15EFh660015718; Mon, 14 Jun 2021 15:45:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=t1qtCFv42Ehv8s+NNj+MyFNBqYrN7lrL8g47Ata/JRM=; b=KCUvgy6ayIKB6DfZAfEGR4lqztmC+cdXDzzGhPTX6PejPNQXFZl5SQdddDffC+Z62Wfh 7RWGAMFTmwmuGeq6rpJs/yU6cdDik+waC8bmOsIMDZ//wLRiznepSXbKJKFamA6jZOhI ioW4JYiwVqMajv/5LilE2Q1tT9FHCGm6NiBDN1SUktCUEE+Zb6YuZ3tbVw4JlOtvWn5T QZ/PanAGrSvCmtwSyl6BI2q0UfxzTLT0bdiuxONvGkjcT+jbd27bEo7t2FVr9qskqX9D 61MVJu7KK8AtfCwsOEMWYztcH346btIao8lP3XypOX/b8OAT+EVNRkCx7O8z5hu0zlp9 sg== Received: from oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 395t6ug90j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jun 2021 15:45:54 +0000 Received: from aserp3030.oracle.com (aserp3030.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 15EFiOkR028132; Mon, 14 Jun 2021 15:45:54 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by aserp3030.oracle.com with ESMTP id 3959cjh3jc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jun 2021 15:45:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hjP2co2IpBTx8GIrp208SOnXKoembSdA20V3JR6K8E0ZOhbBEs4hXxV9eqFUmUhg7yNFIEFMN4B9kmXg5oN+BeG+JDExm8ShJ6cWvfVpQSV+NrKOdYwD9X+fdj3bid2I8Lidq/0vdTZaNERREHmPZWZPWB9c73mehEb2gZachhX+dfuzDz73rmWPFzuNT+tSF0baV1IiC1EP5F+AXulL+iM95KKDhQ1A9yCfgP1+DbTJjey0cqqSU9bttoNWWOfj19rgDFgB+3mrV5vCR5OcdLJIygAU+OUSI5m01bRoydokcC19HLD4YSgoS45BH6hEwt3pvtpMVOTPAn05oe96+Q== 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-SenderADCheck; bh=t1qtCFv42Ehv8s+NNj+MyFNBqYrN7lrL8g47Ata/JRM=; b=jkv1zkU2bTisN/HS2HSgti5Ueu/houq800F2ZV8u2efs3r+Z/yHDYu10O7jH/9Gp2ToHuc1mLF176RFBNa0LZb1wjKUgi0XfXwpA599AUzzIy0ZGNLtHtYgDKWR9zumgWKYXKJBUdKQ4LoeLEMpCRPfDxKmeFX7EhXXuqB2aGlGPc52fzDjp6cIgIR8arGEWrpoQSDwz9wR4W1L5D4e8oDXh/NvnBd6gsetxLaVRXgHZQzqaLqx4R6fMp5ojNA+wOCKViAIeT3V04r7nh8eIzDCN1FT/DvqylIYpXXghBkdH9RtITmyBPPPfduTpVyLV5cUqeqbyP19rRlu4EaQQyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t1qtCFv42Ehv8s+NNj+MyFNBqYrN7lrL8g47Ata/JRM=; b=NeJYS48pM9EGXk0Zg6FynSAU3Rut451t3QxtXeC6w6XPbtrDGaxHIo6ODUF/f0FXGyZGyTmJJ3ZAhj/6yCxqyvqO9Y2V+RgragE3OGgeGYxE/TyNg7m9LKNaWQ/0IdJcmOq9/mnudbCdZiO72jVCRrSGcuCDIxGrOOItBbj7y0g= Authentication-Results: epam.com; dkim=none (message not signed) header.d=none;epam.com; dmarc=none action=none header.from=oracle.com; Received: from BLAPR10MB5009.namprd10.prod.outlook.com (2603:10b6:208:321::10) by BL0PR10MB3012.namprd10.prod.outlook.com (2603:10b6:208:72::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.22; Mon, 14 Jun 2021 15:45:51 +0000 Received: from BLAPR10MB5009.namprd10.prod.outlook.com ([fe80::78a3:67d:a8ca:93cf]) by BLAPR10MB5009.namprd10.prod.outlook.com ([fe80::78a3:67d:a8ca:93cf%7]) with mapi id 15.20.4219.025; Mon, 14 Jun 2021 15:45:51 +0000 Subject: Re: [PATCH] swiotlb-xen: override common mmap and get_sgtable dma ops To: Roman Skakun Cc: Konrad Rzeszutek Wilk , Juergen Gross , Stefano Stabellini , xen-devel@lists.xenproject.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Oleksandr Tyshchenko , Oleksandr Andrushchenko , Volodymyr Babchuk , Roman Skakun , Andrii Anisov References: <20210611095528.9230-1-roman_skakun@epam.com> <855a58e2-1e03-4763-cb56-81367b73762c@oracle.com> From: Boris Ostrovsky Message-ID: Date: Mon, 14 Jun 2021 11:45:46 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [138.3.201.21] X-ClientProxiedBy: SN4PR0201CA0011.namprd02.prod.outlook.com (2603:10b6:803:2b::21) To BLAPR10MB5009.namprd10.prod.outlook.com (2603:10b6:208:321::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.74.101.149] (138.3.201.21) by SN4PR0201CA0011.namprd02.prod.outlook.com (2603:10b6:803:2b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20 via Frontend Transport; Mon, 14 Jun 2021 15:45:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c73d10f5-f84e-4ce3-76da-08d92f4b7cc8 X-MS-TrafficTypeDiagnostic: BL0PR10MB3012: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ShpcMXAD8stzTvaXdEy4f2R5h6rHIPkC2l15hiXvbVbbrBVoqcvbZmzh2/EXQeBHXfEG/MU4CZKY56zZSlveJa55XvgB6VhJENBA3Qy3SyFsr8Y4vtvGMcYEqeue3UAjbTFZJQaCz8K69U+3alh64i4wVlutgryqs64iyuCcLlIEJ+/u53j6fkAreY3V2i5fTTd28yU8XAa8KRNZf/mHWokiN5saqVyHKm8sOpGHaBPJFKwGO3yLmEQgzkkaktMG6n5RsLQ63LWNyd068egQKt0HaLG6MD7xzGbnnzxOoCIBSSsqqG9CYDgt+YVvlHH9K6vw2ly5PYou/TC9Vd8lTUPn3R+ZIcGdKYbIDGHEdbhb7MJ2j4TQqim8dm6DyUjsPh8Y8E4aybykloJ5GuNqZQT0YyvL9fK3DtS/a/ErqQZvRh1y6TqFwS/Ce6lq0Am0ErBKahgjpf8WhQT1EQ+7XKg5iMEWGA12fws/rOaiuqMX1KEmUs/JucWOgLYryPUihlabrhwKyWNrvxpUZH8T8y1t/B+inJAS8W0XBosGxY3VZZ7i3913Iya4snHJqtGvrrm/uTKlRi9afkY09vrexDgk2f6RySaZ24632PL1VDTgxbvDBA7A8rpsYJuYJJ/oLnr8PAloJg419MDCpUBLV7NvG1YsBav1DxTCdGyhSRk7njwa43M+XZdOD6IFunH6 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BLAPR10MB5009.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(376002)(396003)(366004)(136003)(39860400002)(53546011)(66556008)(66476007)(478600001)(38100700002)(16526019)(4326008)(31686004)(6666004)(31696002)(186003)(36756003)(86362001)(956004)(8936002)(316002)(2906002)(44832011)(83380400001)(5660300002)(26005)(66946007)(54906003)(6486002)(4744005)(16576012)(2616005)(6916009)(7416002)(8676002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SytyNWRNYi9FUDBnTjZPaHRxdWJnQWxQaFF0R2tHR1Q4S3VYWXlOY3AzTmJw?= =?utf-8?B?bnM0U0FuczBVd2NuVFdkM0s5aDI2ZXVuS2ZKR2dianM2cE5BRWdJVFB6eW9a?= =?utf-8?B?SDF0aEJLRDBBbEV3bk9zWXN6OVBaUG03L1FKQ2pLY1JXTHRqY1lTQ2NHaW1I?= =?utf-8?B?RGFiV2V5YWV0Yll4cllNdThVN2lCODVaSTVhZENSenNIenIrZkZ4K1pKRUxW?= =?utf-8?B?b05CQS95dzFlVUoza01oR01UUUN1RGJMdnMweG96QzcxbnpYVm5sZzJzT2tp?= =?utf-8?B?ekpqaW92M09oYmlBamt3QTdQL2w4a1Vmb3hBWW5FQXEyZk9GTUlHTDV0M2wx?= =?utf-8?B?bnZYUXEzN2tXamJTUkYxbEdBVGRIMTNsWDlqdHl1VFJOakJzOWswUUt1NE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RvWC9QWWky?= =?utf-8?B?dldpamo3dUt6eWtPbFlqMWl1b2ZaQmRCTmVTSytlU1MzVm9DSGJFV01EOENa?= =?utf-8?B?VlJndktaMmRka2liWWFveFFyTzlibnZQbzVaVi9HS1R4UnVScGVpcndYTjFr?= =?utf-8?B?NmtZVkJoOU5raWxKQ0l2ZU5Zc1FoOFAvYTVWN2JvbVpsK0JFZjVPN0dmTFBp?= =?utf-8?B?bStYdkxUMmpQcEJvRmJKd1pJOWpyb1p0Y0pkV2l6eFJmdDFzMlBvbFlPTG5r?= =?utf-8?B?T2M1cWVSMUN3aEVWTjZsYldMMHVoRzdsMGd6YnBpa2liczNXcXBxWlRhWlpR?= =?utf-8?B?emxGUUtqazBkbU5GWm9tMWJoUnFCUHQ0RytXTTBSa0VyR1piSHhaRTRlVUFR?= =?utf-8?B?WXJLTUxjVzFSdWVmNGlMekMvdUZZbHJxV1NDVEVNbjBQdjNoVEVrS2o2bTNh?= =?utf-8?Q?th+CK8KAQIDqv8OWWjqSxre8Vy40OVFDmjSA2r7?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c73d10f5-f84e-4ce3-76da-08d92f4b7cc8 X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5009.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2021 15:45:51.4630 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sAZtYjKeywxXLISzbKKdBtadpe4JDoIVIEwgOaOtjs9hGgGYbVhoEAOsCoMkqCADwLEMvk80dIOQ1ddaz0mwfLOlIK9bhqORByrQkb8RFtk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB3012 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10015 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 mlxscore=0 adultscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106140100 X-Proofpoint-ORIG-GUID: EGjVKAP4kx5qywM8t1DC1JU7_YyRKcqv X-Proofpoint-GUID: EGjVKAP4kx5qywM8t1DC1JU7_YyRKcqv Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/14/21 8:47 AM, Roman Skakun wrote: > Hey, Boris! > Thanks for the review. > > I have an additional question about current implementation that disturbed me. > I think, that we can have cases when mapped memory can not be > physically contiguous. > In order to proceed this correctly need to apply some additional steps > to current implementation as well. > > In mmap() : > 1. Is the memory region physically contiguous? > 2. Remap multiple ranges if it is not. > > In get_sgtable() : > 1. Is the memory region physically contiguous? > 2. Create sgt that will be included multiple contiguous ranges if it is not. > > What do you think about it? We make sure that we allocate contiguous memory in xen_swiotlb_alloc_coherent(). -boris