From patchwork Fri Sep 17 10:45:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12501647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E80D8C433EF for ; Fri, 17 Sep 2021 10:46:06 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95D2C60EDF for ; Fri, 17 Sep 2021 10:46:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 95D2C60EDF Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.189243.338817 (Exim 4.92) (envelope-from ) id 1mRBNW-0001FW-CK; Fri, 17 Sep 2021 10:45:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 189243.338817; Fri, 17 Sep 2021 10:45:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mRBNW-0001FP-8b; Fri, 17 Sep 2021 10:45:58 +0000 Received: by outflank-mailman (input) for mailman id 189243; Fri, 17 Sep 2021 10:45:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mRBNV-0001FH-Bz for xen-devel@lists.xenproject.org; Fri, 17 Sep 2021 10:45:57 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.111.102]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e2c63ba3-9a54-4ac7-bd9d-d83c977a2db1; Fri, 17 Sep 2021 10:45:56 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2109.outbound.protection.outlook.com [104.47.18.109]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-28-GrDtbzgpNkWMdQW2zCUVqg-1; Fri, 17 Sep 2021 12:45:54 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR04MB7038.eurprd04.prod.outlook.com (2603:10a6:800:12d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Fri, 17 Sep 2021 10:45:52 +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.4523.016; Fri, 17 Sep 2021 10:45:52 +0000 Received: from [10.156.60.236] (37.24.206.209) by PR3P189CA0085.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:b4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Fri, 17 Sep 2021 10:45:51 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e2c63ba3-9a54-4ac7-bd9d-d83c977a2db1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1631875555; 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=xygT969cDBZ/j2pA5jAQZPS3mU7sdWk4emBIUX/9lVE=; b=W9TAmaYNRJX6PYHTNKiCWHjq0BNDf8SV3TKCRCC5PYoinxmk2e3IUZOgaRRU0k8dRZ1fYI Wy7d/uPBxu1US9dBO9scyjvHwVAnpMifEq/xnqM6itJwwWyeg1ohLQE/nz6LlIzPDnwfiz J3EjnL50pBwNKnhHqPlwvPWmjVGqjAE= X-MC-Unique: GrDtbzgpNkWMdQW2zCUVqg-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QipcfJjC3Xsc6Dmx/BuF/G9EHVfVtUX1uqsYY8SDfToaGCDxpA+2TmZPbBhITA6nHnVHJ0l21rS0x8aBxdOBbnjkNDRDsxNVKNhxx7J4zNT13fY2A+/4sdTb3NycPl77+nW6vC+EVBDYQEvZ6f154TyZnr2zizkCOrlwjId6oA/pUeLqRFBsLFdU57DAf1dDOrcKaBhOXkJskTDB+LuCONqvq0EYecKduk3pn/1cvOHdL/LS7R+DDLgYhWpSz55dj8V0LWCMJT8wLcp08N9IggF14TtNqbb56mVz+ufn/PmBc9d7THdv+K4CLzmiLZ2nyEtTA37RmfQWHvyuQrpT2g== 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=xygT969cDBZ/j2pA5jAQZPS3mU7sdWk4emBIUX/9lVE=; b=H1GMQi1hiWB9rb6AhRrlSKlWcuoeaNGgzGBuZYAqHnGuSrUz5GLZlU+kIdLT5t54O1a9LRYRAoFF2prEy2yqmnWhmnh7cB9NSTPzdmrzQqSviyFyMMYcF35DJVslYFfyIOZzMUQwZBClVljmx6qObMnesHdp9Nxaofp4bL9/ZJBNe7GFoRHSh7pthHFls6Rah1ZyPfnExcnfp2WIv5taFJlwnjhxWZ7RwYP8CR8BzflpJ8PFb2KiBFscCPFuqg+XVWnskRIKoJeAeuC1L5lqHmx3bOqjhyXtVSs6ZWLNx78yXohowi0mJNnKS4mrQODRX2X2j7roI8HMjE46Opbx0w== 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.linux-foundation.org; dkim=none (message not signed) header.d=none;lists.linux-foundation.org; dmarc=none action=none header.from=suse.com; Subject: [PATCH v2 1/4] 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" , "hch@lst.de" , Konrad Wilk , "iommu@lists.linux-foundation.org" References: <164e58ff-2edd-2c99-ac3d-e18eb06ff731@suse.com> Message-ID: <7b3998e3-1233-4e5a-89ec-d740e77eb166@suse.com> Date: Fri, 17 Sep 2021 12:45:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <164e58ff-2edd-2c99-ac3d-e18eb06ff731@suse.com> Content-Language: en-US X-ClientProxiedBy: PR3P189CA0085.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:b4::30) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 51a8b658-b3cb-4ac7-1729-08d979c8519b X-MS-TrafficTypeDiagnostic: VI1PR04MB7038: 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:1201; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jJvfl4TOCMxZk5Hkw6X1UGtuuJekKSpg5sbARmQDJzbR4PwzObuEuRLB4ElgjWxJ4DozlfkadWHD37Y3J/e9Fy86fiIg0OS/iWfK2TcROwvraU1+z69n8vFDvx9yzQ3DYLlwnF9Q5eIr0tMWUJ8Njc0xR+mXmdbdhauFYRziA9WjaY+LuldbvUY6HrMJX0Nb0ZBYtwLv3XtX34tBqlZk6YjVTjlgR5boCKsL06fnI0MKVnNdsV4RuV6B5dmqlHC7RoUo/9gSFu6+VuNgPweWUYooq8ABV53bwlXHVK4mBG6ghApj17HTUihckeXoOTwQZDrPgKE26eAikPz8/T+iCmCQ9NMGzU0OAdGRZBa7/9VoqowHDX7gEHT8TlSiu5JphBiuMeT1f8Uvc0841/9OVTLPWlMOwXhSlab7mdkMFk6S/29MvxEKSCJcNcuMECJLNJb93r44NzT7hf3sfBGLqAGMPZ2VpT7d13Rsc7BSpkZh47TtnLqyqejmZKtbKtCLGSZjqmN557F4nM24XgB6BKdZp6tSfhxL4fMKm/C15vYCTu75zp3gZcB3H6dOWT76KaIQ1R4lhlvlv6m4ZCoPAsbcu0yjVOV2OWYRN3UIATu2NHcDddDyz3zvHd5Tzcr41ZdZwEIKbbLRVNWjmJEFIZ3OFMC2AGFbpwBgKPRYiDl7bMq9WzZjFiS0LIv5Z59YeXX0NL9F2vBAkUVLHcYLwY20uDlEHR6JCBLUfdReuFg= 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:(136003)(396003)(376002)(39860400002)(346002)(366004)(26005)(38100700002)(83380400001)(8676002)(36756003)(2616005)(66476007)(66556008)(6486002)(8936002)(2906002)(86362001)(186003)(31686004)(66946007)(956004)(5660300002)(316002)(4326008)(54906003)(110136005)(478600001)(31696002)(16576012)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?78txMPmhJzaD7Qw7Etjq0OD4M3Ro?= =?utf-8?q?PKfTc9P6pKcCX0ERSy5DB+oG9J9IWwd515P+kQK41fuIfmj9qr6iPTCkIUSYm/ccQ?= =?utf-8?q?oZ4Woocg4zReTa863ECFgBEiBTUogRpryJmuvPAjT9/Flh5uajC0odNyxEAIKklNW?= =?utf-8?q?mRZ7LSYImtwMwcrmg7sLdl9VAc2od+ZviX0QwTja5KYewarNo5a9G6q9kcisN54jO?= =?utf-8?q?rDxSlR/Z2AF7grDQILzdDdw1gVxCmbPTqK8H2nmwSJ4PXqwnIyUdiMmgQqgJhnl93?= =?utf-8?q?ajr2KS76zGbVNI7hiAlNh4N9gOQsrdo6ME/dbB3SBMm1Yc5uhcChZz27qt2xFEfDx?= =?utf-8?q?18g8IbrM7R/EAc5pUS7LpAwNsxf3lQxNzMJzPHCMyBpRf7ZFZUbfxj1Js/z6SEKfi?= =?utf-8?q?enBCOKuVrNhn7pP/5wBVHeCVxz5bB+bkeFnu1+y9iU5DtLBICmSJfY2o7Ypz9Mw0W?= =?utf-8?q?y/VTT5j3x7kgkns3HoEpggLW7Oflh6Uc4OxPsW6TDr4yuqmn1VXD6t2//K+sOzuTy?= =?utf-8?q?BLciXGvxIYqIAiX4566fBagGA5KeK98MMwIen4gK6B4XB1n724JhEIfvy/Vjg7nSP?= =?utf-8?q?7GVJLQU2xe+7b5yAqPAHxiDeibf16EjCsovIWcGKNMu4gZkx7b955yjZOt8BGzEpx?= =?utf-8?q?V+NQRL4pDTuoSWMuNQFLhq9sITPhrnK6ynb5/1uSLc16HQCSD56O67gS7BfprxFi1?= =?utf-8?q?l60DRouzDfmZXwzRpl8lV0w/rVIEz5xpZeoiWJGxiJP5Zea4u4urfGqycS+Gvlvna?= =?utf-8?q?9UNg10nkO2qI8sSlVO4QS8myYIJWuEier0NXCk1PnnhqqUAg/O0mTsUmeUbPtAAOF?= =?utf-8?q?WQF+M7BVOVxdM44hmjEUNFGIomWQTFLB39aL4CTgAUhAAsyOWcunpscvyyTuLux5P?= =?utf-8?q?EqUtdNLw670T7GnVVUy+P8A4AY0Q2NYpMaFx8GgLPVA00RtOQF0nUfq1kRhoiSvv9?= =?utf-8?q?XCWvFZ33MssjEPTIIoYDkxG+D9ilAF3hJGM78yGxeCzjxpHFX+YY/9izrsRuhVHhT?= =?utf-8?q?Ol8Ja9jis4Dowaw+ZttUNbOal1Fm9OI+5aUzoykOn6rnW+zmTDLx4wv1Cij2l4MGA?= =?utf-8?q?m3YIglF+cNfeLdtbxeHl7+aCATMsBuJb1ax9ZbJzrHWfzN1Ifqen9kKUeFV6H3Bs1?= =?utf-8?q?5XxlqYu15ZvBhfj9fyCBjgjIgvYHIyYyfJIAKQhDmvxGyaOPRrym61z5bzdWLYI8a?= =?utf-8?q?JXBA0itzke2Ele++qbKVh4PbQGrJ58E6g4vgdDjrNL9BNYdZqpM/QexeFOt3WvwlN?= =?utf-8?q?coxKVn3MxN/rO72D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51a8b658-b3cb-4ac7-1729-08d979c8519b X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2021 10:45:51.9854 (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: gg4diNqLAQ1fx64FdDFPcPfx1T/o/UzWchvG1YWd1pA9kTjucQnGvrZeUel1lzk+QfIzb/1NrKAowws/Hhq85A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7038 While the hypervisor hasn't been enforcing this, we would still better avoid issuing requests with GFNs not aligned to the requested order. Instead of altering the value also in the call to panic(), drop it there for being static and hence easy to determine without being part of the panic message. Signed-off-by: Jan Beulich Reviewed-by: Stefano Stabellini --- I question 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"). But that's perhaps yet another separate patch. --- v2: Drop logging of alignment. Wrap lines. --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -230,10 +230,11 @@ 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\n", + __func__, PAGE_ALIGN(bytes)); /* * And replace that memory with pages under 4GB.