Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3684456pxb; Tue, 7 Sep 2021 05:30:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysaPLLVjuKNJirXzzVXrLLaKReEmUhRmLvXD4HB/wVv9t2e8iKpqnWHPbI2U8qrKfIQRsz X-Received: by 2002:a05:6402:48b:: with SMTP id k11mr2525889edv.7.1631017812513; Tue, 07 Sep 2021 05:30:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1631017812; cv=pass; d=google.com; s=arc-20160816; b=AElyZzG16PahJiElz0y4vwdVHehZbbi8uNmk45crG1MRU5pM8+UZMDTF2cFQECaOI5 NTMQq6G+YtLpnSX+em7/s8nyAJXdowWPRJGtDXq6sENggjHzOMhIdyWSfnZZHMz6FNOR o2JcSWSSETseRnzGrcf8M2S2Qr8y2dsR6k4UDmdtuw7AnTpMQtgkGX/mZsW/PfTZLt8d q6GsFjqRaBhUnOAsEBfh0oVF6OFif7ltGKddrUzQkLrewcK7Xrf0XUXEu9D3ZO9qHoXW N15/r0+OTjnIIHljjULK8jxSCwo/VVjiH9VuAAnyWlWSb/Dbn6HuZ7eHpihLGhC3GKq4 PMzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:references :cc:to:from:subject:dkim-signature; bh=DxJykJMCxYkJPMtlwaWjGcuTROCQKWVJPc/aqT8Eh6U=; b=0QX+TH6qDcs301PeWkhwT4m6SDnw0K5utT52ppMBYDALZ5HQiLsYcyrdqf6xXQ6Rjl xuwYz+ICKyk9aWslf36LRPfXP4VbvpITFiVrlEGCFM+bZw9ss/Ya1AoR0VKDwBPtWUlb bJ8tvTf0xaLnTryeRYm/225d0g12ODUINqZsEgf9587WFxPOTl/TmHtSTHfRYutHezQK 1LFre0WvkLubQkiPpXshx/4FLcl5RcnA8Fe8gTI947tIOJK1vpF/4hRGpQ/napRYw2tp Xqy8SbFmND4DR1mgobT8x5ZihLpFfoyO+PbPW3nAw3KfyxszuZ0qvOLwAx55nDpXB26l E4dg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=Qqu5Oz1s; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx3si339851ejc.479.2021.09.07.05.29.48; Tue, 07 Sep 2021 05:30:12 -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=@suse.com header.s=mimecast20200619 header.b=Qqu5Oz1s; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343694AbhIGMGn (ORCPT + 99 others); Tue, 7 Sep 2021 08:06:43 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.109.102]:47435 "EHLO de-smtp-delivery-102.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242613AbhIGMGn (ORCPT ); Tue, 7 Sep 2021 08:06:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1631016336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DxJykJMCxYkJPMtlwaWjGcuTROCQKWVJPc/aqT8Eh6U=; b=Qqu5Oz1sA54M2K4Aae9GH0tQHO4H7xzdoYjjHAnCzWtw7/R4rMbAreS8CdJV6ETbUDhXaj l9w+bJ36CWazF/pfbxaFRz2Dk/noc5Z6iu/i7jHd0PAKnZnoYdddAryOmTzBbiFIFauijf Ghy0HL5p5/FiQKQqmvUi1Y81hwb21W8= Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2172.outbound.protection.outlook.com [104.47.17.172]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-31-Yget3GjuOLGL9PuuNgD8PA-1; Tue, 07 Sep 2021 14:05:35 +0200 X-MC-Unique: Yget3GjuOLGL9PuuNgD8PA-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cKFu6bKu5CqvQSsZeH90PTEjoTPDza5A2H7ptd3U9Ujy947lmUS7J7zarX/yebFT2r5weYEr8lIatS5LGhPg2zOjQwTIZQE8y8YaIGX1dZHIaM/J9joZTKEO9i3dNn/5nk+uzdaIKHEad0GzZmATYPIcpmBg+W2D4adXutXdMNq/2yh+YkWo/m9o0xiKBY00pVH27Oa4MoMze2m5zk9BPcqIwXpl8W40PSkqHrN4WxJcq7MvnjGB+Vl1BPJ6kf0uJwFAGoaUc5dxXC5vwYVnYteO7BLsG6Rk9Cf1XajP9ETMFT2jKq1qKZk9CLnVHuc+KYF2WQkqUsnjSr2agYETcA== 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; bh=DxJykJMCxYkJPMtlwaWjGcuTROCQKWVJPc/aqT8Eh6U=; b=CtXfxloLrJf41/XtEmZDN/7JY/k3ELuF3QgwEngr7bj2W61JXzXipKAJSXG+YqhWSeHRnO9yVVaELJUZ2AdRYhve5uT/0U9cr8Tf/tA+fd/N+WrL1JdEHSfoXd4X0S/64YD1J3/sAVKBOIGVTkHhrdWj0jCzTsj4CiYkqIss/c2XxK9pS2fuxCofiQfaxhOvR97+PK7QVUjaNlskqLyhdZ/nLmRRpRSMuhUfpwzmxYO0EUHjjZpp8sLsbKg+Jpx5PZh9LlmIzrOVfnydcmeHHkp7iVhKQfBrWVKsVQSkiJ7dNNgSE1pnSySVFgIHFYjlyEp1mcgYn+VoP9LygBUMxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com; Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR0401MB2607.eurprd04.prod.outlook.com (2603:10a6:800:58::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17; Tue, 7 Sep 2021 12:05:34 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4500.014; Tue, 7 Sep 2021 12:05:34 +0000 Subject: [PATCH 04/12] swiotlb-xen: ensure to issue well-formed XENMEM_exchange requests From: Jan Beulich To: Juergen Gross , Boris Ostrovsky Cc: Stefano Stabellini , lkml , "xen-devel@lists.xenproject.org" References: <588b3e6d-2682-160c-468e-44ca4867a570@suse.com> Message-ID: <397bf325-f81e-e104-6142-e8c9c4955475@suse.com> Date: Tue, 7 Sep 2021 14:05:32 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <588b3e6d-2682-160c-468e-44ca4867a570@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0015.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::20) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.156.60.236] (37.24.206.209) by FR0P281CA0015.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.6 via Frontend Transport; Tue, 7 Sep 2021 12:05:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2721335c-c207-4d39-3699-08d971f7cbd0 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2607: X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:949; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1AXwpce2ZTGO0h99O41c6qeudTOS+SRO5wPXSIxeSQqn5xKaa/HDMhF7EzO7rOdJPRMv2vJE1sNwkZFL8qbuK8uNsuYMLyJdsfF87d0WYUjUjM9miel40AeQk+cbBAerKT0JKnXLIgPdRTsiipsSTcGPJV9lZN7N3Oe14dMHC/XLleob+6brqFCytjBJrW6A9/yycffL6tDeuxCBHAS0XBzDRKSNdePmn/kDCYYMvubYBHb+6AYctCdtlsC/UeIaC2TStMc37mPlDLv0juBwLbPW7OzIrWUNSJxUvzztahnzfzd43TTmAZaWACfgUSULu7MmBia4ca5AkAWk6M1zXvQ5fa8qbyFKpEM34Opcfh6vtboKa+BUHeUC4Irl7HQdCX++AU6rEie4b8aaSsvSGjUxcJq3dWzCmYf1oalVs61CHP6qcglBAghz4pDtdZdOisHlKtrfhUb+kA2TOzgipqZ19ThXMilurWRYOI4pj9lLVqB0CHYMQjtDKpHibxDoNdWc8zMT+LghZIYcqELm6I9OLL6GVH29IEZi1Bj15pMSxpO60L3aWOXB4bJN26W1xhuMBdWzufo6mGvbs7bdhe2SxpMh2Og0pHiVYPiWkxptBa2ZYSzWofFykcKWPuhnktvSf+obPEBLGBG68hKCiyK3Yb51hz2bRTFKIvYsPKX213vg+HAcIkRjP/7ZENrZaP7ydwuEKG7SMwuD+pYImGcDcZsbI+D0BSySFIZ0Ow8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(366004)(346002)(136003)(376002)(396003)(186003)(83380400001)(66476007)(6486002)(31686004)(66946007)(66556008)(26005)(110136005)(54906003)(316002)(16576012)(36756003)(478600001)(2906002)(8936002)(4326008)(86362001)(2616005)(38100700002)(31696002)(956004)(5660300002)(8676002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UWpXVWZkanNhOERzNlNSV2oxdUJ1dEg5cEdmUm1IbTUzSHF0ckJjTkJXdnR6?= =?utf-8?B?MHRjY2FoTTRXK3ZxM1IxTnUyeXIwSTNtWjlFWjA2T3ErRmF0cEsrSW1rWnpC?= =?utf-8?B?R2c3QnVITitqdlppVkZHV1kzM1hIZjlGV2FZWWVkSlBjcWFPNHFIcEZFRExE?= =?utf-8?B?ODBXNlBqMEZDYnM4MFZSSGlndlZiemsxRVozRmFJb2NUeVF0TTAxeVJiNU9z?= =?utf-8?B?YWxYTE1BV2dBek9STGRMYzhOVjNHZFo5TXNFOGhzeHU4aVN0U0ZOb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GJwV1c3dmM0V0FIWlBSV092Ri9JRzZtcVJvbDNKbm1R?= =?utf-8?B?WFhmUXUvR1pBSklyVjIrd1VjOHNKN1RJVFhGVFA5cDZDM1N2WVRldm1ZU2JY?= =?utf-8?B?SHlNOEJ5dXpEcW1jM1lCVTlVamR2Sy9HWDNwNFpvM05Nc3FvVnRMc09DVmxp?= =?utf-8?B?S3Myd0tKNjhUL2hNSTRGdjd2UlRlYzk3TjlsOCtHVWJNT24zV3JINzlkem9X?= =?utf-8?B?QWpURm5CQkNBTVYwWm56SmFPN1B4d2hPdlFTWGcvWEZDWFIxcWVwY2xTNE8w?= =?utf-8?B?M3RoQnNJVnljZUI4QlRncWdIVkM1cHpCNjE4TnBFTWNqVGFSc1Y2VWZvUVMw?= =?utf-8?B?Z3F6NHZmT1pscklGRFA3WC9QbU1pVVhUb01EcWsxazkrTVpKRkNPVHMzRkhw?= =?utf-8?B?ODA1UjhGRlp6UXNwM0IrMUZEeWxQZVVwQndLYXpEdkFMcXNaS1ZkY3JZMXgr?= =?utf-8?B?ek9SZkVSUC9WUVdaSHI0WHNsMEF6Q2R6cmY1VlZ1WllqL0NScmhPeUZOUEdJ?= =?utf-8?B?ZHBxZE5Zdk1oOXBaYnM3QWlOSjZZTHpaUk01bEEvYmsxTnFNT2xBbHk2VDJO?= =?utf-8?Q?FfRMgDCFQ8QOyre1IYTAe5LHqbtM0mrGv1R0ZK6?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2721335c-c207-4d39-3699-08d971f7cbd0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 12:05:34.1086 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9EeDANFU13xO+PQ/cQU5CxtYQasUAhqSGaUyX2pGNe+3fdUmKBirWBvRaL+rEloewYWIohN+bVIM7JdbyIpM1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2607 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While the hypervisor hasn't been enforcing this, we would still better avoid issuing requests with GFNs not aligned to the requested order. Signed-off-by: Jan Beulich --- I wonder how useful it is to include the alignment in the panic() message. I further wonder how useful it is to wrap "bytes" in PAGE_ALIGN(), when it is a multiple of a segment's size anyway (or at least was supposed to be, prior to "swiotlb-xen: maintain slab count properly"). --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -231,10 +231,10 @@ retry: /* * Get IO TLB memory from any location. */ - start = memblock_alloc(PAGE_ALIGN(bytes), PAGE_SIZE); + start = memblock_alloc(PAGE_ALIGN(bytes), IO_TLB_SEGSIZE << IO_TLB_SHIFT); if (!start) - panic("%s: Failed to allocate %lu bytes align=0x%lx\n", - __func__, PAGE_ALIGN(bytes), PAGE_SIZE); + panic("%s: Failed to allocate %lu bytes align=%#x\n", + __func__, PAGE_ALIGN(bytes), IO_TLB_SEGSIZE << IO_TLB_SHIFT); /* * And replace that memory with pages under 4GB.