Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp604772rwl; Wed, 5 Apr 2023 05:26:55 -0700 (PDT) X-Google-Smtp-Source: AKy350bsqwrTBQ3TVL8Fbjxni3QQj5SHng22DTj88gYyh0Nj4aWE1pj40QTHaSAhoNAEQE2iKgk7 X-Received: by 2002:a17:907:20a9:b0:92f:b47c:cefc with SMTP id pw9-20020a17090720a900b0092fb47ccefcmr2641247ejb.24.1680697615442; Wed, 05 Apr 2023 05:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680697615; cv=none; d=google.com; s=arc-20160816; b=SnigQBhE5nEuuUVkavkNPmTSwh50gLuZbTC1Xu7scFrt0Z2xsGL6d7xrYQnepmvrGj w2yOXltsDeOdi9Tanabo8rC3gLmyuWvPGZuDChAoE336rnIv/dOKpcTYK9iBrp3AV4m0 mV4A4mibO6obNu83jyZvKRp9kQaLJ3NKIBpD0q8BDWnjRZvETe1gOSZpQXO9DgoEUu42 fIefGUPBmiFOuUuMssQLmtUlBM15nb3UCaeDJVMpLjEnWYfW7exw9zYz3qoZ+3ZOMuNe 8j5ntGKGhaSUARvgtlV5Tm9HiQB9QPgxFx17LMxanYQ/xheJJjGUtmRZLZ4hHMSNjq/w NtQA== 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:reply-to :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id; bh=qMq04o9PLhQk96k8qgyuybShzwG6KdsNXZjfDdTzib4=; b=wdFO1dk+bwEbXqiwh27HnkwBIU/FuT2jmLJ6M3PpPGQhOFVTj02YDsR6K2Oyy4Lfvt d3IxXzkr81z/stEhiwiYinuLMsUPStOxrFeQ9q6yiAauBFEVaPrdzCbbWtCqFql47z+P eqemIRYHjcLgw8TysiMfAtxZ+hUtkUXr03CbitIFGeQUNXN01ESCc/oLWmXHwJQqV1M6 epxDb4NwNwp1sootTXUZOhF4MCN9YySxwgEMKYNTq6XNKC0euOoddSTrshcKHiKwq0Ov UEuAXQ4g/HleAkONcXT/1g5tWA7H1zNlOoTnPazk9MTelxepTRh9fx5BFCASbdIwWMFq u90w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f16-20020a1709062c5000b009313d581faasi617472ejh.101.2023.04.05.05.26.29; Wed, 05 Apr 2023 05:26:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237052AbjDEMZC (ORCPT + 99 others); Wed, 5 Apr 2023 08:25:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237096AbjDEMZB (ORCPT ); Wed, 5 Apr 2023 08:25:01 -0400 Received: from wp530.webpack.hosteurope.de (wp530.webpack.hosteurope.de [80.237.130.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A220540F9; Wed, 5 Apr 2023 05:24:46 -0700 (PDT) Received: from [2a02:8108:8980:2478:8cde:aa2c:f324:937e]; authenticated by wp530.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1pk2Bn-00016R-NG; Wed, 05 Apr 2023 14:24:35 +0200 Message-ID: Date: Wed, 5 Apr 2023 14:24:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v1 2/2] swiotlb: Fix slot alignment checks Content-Language: en-US, de-DE To: Dexuan-Linux Cui , Petr Tesarik Cc: Christoph Hellwig , Marek Szyprowski , Robin Murphy , Konrad Rzeszutek Wilk , Jianxiong Gao , David Stevens , Joerg Roedel , "open list:DMA MAPPING HELPERS" , open list , Roberto Sassu , petr@tesarici.cz, Michael Kelley , Dexuan Cui , Tianyu.Lan@microsoft.com, linux-hyperv@vger.kernel.org References: From: "Linux regression tracking #adding (Thorsten Leemhuis)" Reply-To: Linux regressions mailing list In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;regressions@leemhuis.info;1680697486;1e83ec65; X-HE-SMSGID: 1pk2Bn-00016R-NG X-Spam-Status: No, score=-1.4 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 [CCing the regression list, as it should be in the loop for regressions: https://docs.kernel.org/admin-guide/reporting-regressions.html] [TLDR: I'm adding this report to the list of tracked Linux kernel regressions; the text you find below is based on a few templates paragraphs you might have encountered already in similar form. See link in footer if these mails annoy you.] On 04.04.23 21:55, Dexuan-Linux Cui wrote: > On Tue, Mar 21, 2023 at 1:37 AM Petr Tesarik > wrote: >> >> From: Petr Tesarik >> >> Explicit alignment and page alignment are used only to calculate >> the stride, not when checking actual slot physical address. >> >> Originally, only page alignment was implemented, and that worked, >> because the whole SWIOTLB is allocated on a page boundary, so >> aligning the start index was sufficient to ensure a page-aligned >> slot. >> >> When Christoph Hellwig added support for min_align_mask, the index >> could be incremented in the search loop, potentially finding an >> unaligned slot if minimum device alignment is between IO_TLB_SIZE >> and PAGE_SIZE. The bug could go unnoticed, because the slot size >> is 2 KiB, and the most common page size is 4 KiB, so there is no >> alignment value in between. >> >> IIUC the intention has been to find a slot that conforms to all >> alignment constraints: device minimum alignment, an explicit >> alignment (given as function parameter) and optionally page >> alignment (if allocation size is >= PAGE_SIZE). The most >> restrictive mask can be trivially computed with logical AND. The >> rest can stay. >> >> Fixes: 1f221a0d0dbf ("swiotlb: respect min_align_mask") >> Fixes: e81e99bacc9f ("swiotlb: Support aligned swiotlb buffers") >> Signed-off-by: Petr Tesarik >> --- > [...] > > Hi Petr, this patch has gone into the mainline: > 0eee5ae10256 ("swiotlb: fix slot alignment checks") > > Somehow it breaks Linux VMs on Hyper-V: a regular VM with > swiotlb=force or a confidential VM (which uses swiotlb) fails to boot. > If I revert this patch, everything works fine. > > Cc'd Tianyu/Michael and the Hyper-V list. Thanks for the report. To be sure the issue doesn't fall through the cracks unnoticed, I'm adding it to regzbot, the Linux kernel regression tracking bot: #regzbot ^introduced 0eee5ae10256 #regzbot title swiotlb: Linux VMs on Hyper-V broken #regzbot monitor: https://lore.kernel.org/all/20230405003549.GA21326@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net/ #regzbot ignore-activity This isn't a regression? This issue or a fix for it are already discussed somewhere else? It was fixed already? You want to clarify when the regression started to happen? Or point out I got the title or something else totally wrong? Then just reply and tell me -- ideally while also telling regzbot about it, as explained by the page listed in the footer of this mail. Developers: When fixing the issue, remember to add 'Link:' tags pointing to the report (the parent of this mail). See page linked in footer for details. Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) -- Everything you wanna know about Linux kernel regression tracking: https://linux-regtracking.leemhuis.info/about/#tldr That page also explains what to do if mails like this annoy you.