Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1392296rwr; Wed, 26 Apr 2023 14:28:47 -0700 (PDT) X-Google-Smtp-Source: AKy350Z2bq1xC0vsyiBkqibFVJ6YzaGxktvLhj2VjKnBnfq1QkTd1Js8C7fsUZpwjCQFNPjf/oFl X-Received: by 2002:a05:6a21:788c:b0:ef:957f:5a2b with SMTP id bf12-20020a056a21788c00b000ef957f5a2bmr29620762pzc.48.1682544527265; Wed, 26 Apr 2023 14:28:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682544527; cv=pass; d=google.com; s=arc-20160816; b=ZagG+B2EuDPq1GNJa2mtO510V5Lf5kt1uLxAS9lihfkc1v/vmBU2LlqCCulAzD2b1Q vCozSUVi2UDcBmQp9aA3mcy5U8TqNBP+2PeS1mVnD52t9Rbm1dfCrAACUK0GN6X633D1 9+GQMCOpAi39TySaxZOZNCq0aCuTsvAulsWScKWLkuUxiKXjlDR5txw7xWOr+bB4JSht 6dVXMYf5bqVNxmd9RR38YcLK4TBmKq7gluo9WztqoJ1WvHo2Uf01g/JZHlVhdfgJ7yMc XU3uL04rI+d/Jb8fCwUekJtpqFLaBleg1nASq8wB5wG/dl3JHlZpWqSuwsTdWOi4EquT NoNA== 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-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=Po76Rbq1I5mKafhEe9BitPa8Wldij0sAwG7yGqg3eXs=; b=pOeCsRUu4I/N4D8e6V1ic75tM4Xwy/dHiFonkZ/pMrRDgyy3rZIF/WcGLZH9aF+eMw ryjC1IHgvjCS5cvXYVKtdz6eX59vyc/W7pyOiziPijHzObK5je0oWOEyRQCXAuMIg95X wItj7QWPXVpLROPOR0f6YsWJ/Hnc9W4UTz2UwHemjZZFZnLnEW8ix/4LgNJImgl+oWUA lryVJZJJpegQQbPbrFmpmU8HGh2bIIVr9CXtN3C8GWFKToSTD/EjHcMlusOH44NfP2OY Knhg6VqYM8Ru8Nsf8Y45shdmSNrO15tRNIqepa8mS77w1fN1JSAitJHrTuXdI6a1Wexk 175Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vmware.com header.s=selector2 header.b=gWsDysON; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j64-20020a638b43000000b004fb9330dcfcsi17854978pge.323.2023.04.26.14.28.32; Wed, 26 Apr 2023 14:28:47 -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; dkim=pass header.i=@vmware.com header.s=selector2 header.b=gWsDysON; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236396AbjDZVXD (ORCPT + 99 others); Wed, 26 Apr 2023 17:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229582AbjDZVXC (ORCPT ); Wed, 26 Apr 2023 17:23:02 -0400 Received: from MW2PR02CU001.outbound.protection.outlook.com (mail-westus2azon11012004.outbound.protection.outlook.com [52.101.48.4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BC8C19B9 for ; Wed, 26 Apr 2023 14:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fDeM8nci9AgijV90dNcgFrYVFIAHmtYfGHbFVNyefjWxpzXEJZWz1HtKlejvd6+8NtpyrOdzsMyYG6WkWQSnrKmIwpDLK8b+zWDguQdA4I+tSai6CvuPket0NhIA1watDBzusK/lU9byJyNauDzIABFc869SaOcUDhiID06k9ghE5HZWuLUcot7dOpUGvWrYrVLR1uepR1reCHTSmHaLN7VOcLvNDqMaOZIKFRycIw3q84AxJJZ8ySmxlD/SEEsPT0CD8uGQP5YFegGyZxBV9UvSzbsfmT7OQA+XOaG3rvIYRpqjng5CC2EpWNSIKc8VFZaYOp1FjEP2ai2bdIXHZg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Po76Rbq1I5mKafhEe9BitPa8Wldij0sAwG7yGqg3eXs=; b=n55NZ9/xXf3AoPod3yTRlXHkuqOD+jTxIKeYMuDtfoSkoxNhzi02M/0OZfVWFR0tUSzvy5P5QiZea8BWpu+Sjvi9j7UP69lzTiBALxUr0Pt9SVgYMPKA4bhiNXN9/1ajvEcfZRKAyopjXFHUFIHdYi0Iyrao5JWUxiCXwg24f2mFFDKZ7GcqdgdezcqW8XPZEONRfBO9bq1el9Ce4FzV0tyQlHVA20rm8eqpjKQW3CZpOcO0B3G8rp/zZxjKbRHsXeRULtAvltYnQCQhnNH9B76XTPXBCP2kKUNe5ajIU0vv6b5tS5H0SiG1hgjvF+DJJBxhxB+FNHQ0JiPwq1JIKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Po76Rbq1I5mKafhEe9BitPa8Wldij0sAwG7yGqg3eXs=; b=gWsDysONurCQGyexgK46WjZp557CmDXb73P5GuDgA+mETVN7LwN/VwUDGWw0YKfyp2xEO1zcZmZ4sXCi3ngscWcsvQlHt0ywoSCcDLKzEldsxfDkulZHZOCCVVpPV4un8I5Z7Eq5UBsSa/7hVd2vp89gurMLdLuoS2fPNZNhIeI= Received: from BY3PR05MB8531.namprd05.prod.outlook.com (2603:10b6:a03:3ce::6) by BL3PR05MB9186.namprd05.prod.outlook.com (2603:10b6:208:3bd::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.21; Wed, 26 Apr 2023 21:22:57 +0000 Received: from BY3PR05MB8531.namprd05.prod.outlook.com ([fe80::f1bc:4933:8701:7ff0]) by BY3PR05MB8531.namprd05.prod.outlook.com ([fe80::f1bc:4933:8701:7ff0%7]) with mapi id 15.20.6319.034; Wed, 26 Apr 2023 21:22:56 +0000 From: Nadav Amit To: Jon Pan-Doh CC: Joerg Roedel , Suravee Suthikulpanit , Will Deacon , Robin Murphy , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" , Sudheer Dantuluri , Gary Zibrat Subject: Re: [PATCH] iommu/amd: Fix domain flush size when syncing iotlb Thread-Topic: [PATCH] iommu/amd: Fix domain flush size when syncing iotlb Thread-Index: AQHZeH5MzL7QCyjHEUuk1s9n/e4s+68+FGgAgAAFFgA= Date: Wed, 26 Apr 2023 21:22:56 +0000 Message-ID: <985C9735-6009-449B-BF9A-1293AFBCBDE7@vmware.com> References: <20230426203256.237116-1-pandoh@google.com> <7F4D224A-A6A0-46BF-B008-A9E488257639@vmware.com> In-Reply-To: <7F4D224A-A6A0-46BF-B008-A9E488257639@vmware.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3731.500.231) authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vmware.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BY3PR05MB8531:EE_|BL3PR05MB9186:EE_ x-ms-office365-filtering-correlation-id: c5247137-f539-425b-3fcf-08db469c675f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: X2MYilILeBLbxIQOgz89YwIDvwhyu3PMFuzJdBUXvDjTgsUdbT+kO6kC4R5dtc8GRwesdo+edSeMm7jn+qA/YEwl3Ur3hN1yuyhTL06su1Ip6SDzV5DpTJMx4fRpqr+rIE8p5LHIMxLL/J5O3YDk0WtbRjtDV+7aUqdK3gqibXu28oVmnFUcTG7rswiYXzvyE6dU3JBu5gX9giQKavdWuAPIU11XrY5EJYwBG9qkM0m2LfKS2j+OwZ+Hhi/aNJ2yV5FbiDX+IoBE5SDQ+Nti9PvebVTADlpWeuENGPQVDdzwecP9ca4ZNKezWsFyEoZbXgCRo7JTfKHDlaZrtFyM6zEiJcNeHPgV4SwNLgkxw1iBhh2nkPKfJqBH2i9+LNfddN0bm3GZuH5y+oYRmKTLazmLUlY4edriijKt6ZZH4Yg515le7X+2zQJV7NoBXPNEp4yG5ymHP93QRJ+leqQB+Oon4GcbgVkj7sAI1B0nylGekMjUEBe5OMHZzKbGqnPSK+TIxiQhjExk6uJC3YS11pI65ZQTQy0tE6b5aNubf3/AinjWHSzMfNlnHsK0cp31oZJDWEHZcPtBCdSXsz4mgLF2r5dtqfdkgbMLHY5gK3AyzoU3K5abeR+NSO11/9D7JkkeDkR/f71hTW6uv7ZO3w6rETIfP7KhRJxDTFkHrYqXfO5V+J8LvBY+1JuuzEPv5zNXhNjj8WwAMnZiGb5DMA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY3PR05MB8531.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(346002)(366004)(136003)(376002)(451199021)(26005)(6506007)(6512007)(38100700002)(122000001)(71200400001)(6486002)(66556008)(64756008)(66446008)(41300700001)(4326008)(66946007)(478600001)(66476007)(6916009)(36756003)(86362001)(54906003)(76116006)(316002)(2616005)(83380400001)(186003)(53546011)(38070700005)(33656002)(8676002)(8936002)(4744005)(2906002)(5660300002)(45980500001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?yWIKgRNjHvS5UhMMRz2z+rQXkD7iRJKtHdV2JpZx0dRip+/lMpdVIGFNvzLz?= =?us-ascii?Q?V5uUSjC69gPasGSof3xcBVaVc/r3WTCdctP5fZ/wXf6c39p1gqggFpxQ+3hL?= =?us-ascii?Q?67Rs1yPPM2A5IpGRiiiHCnhpsPQxRrzQ7RT4Lz19Q+qE/3fSxPYCXS4CucO0?= =?us-ascii?Q?TABGSp/OK4j4Ej9JtNSgKoZavItDmhA/q2MhqHsi0h1gXus/VKrodqLHy0om?= =?us-ascii?Q?F0jz/cr80INpdWvr1zsWITc/1EuDkcITCvmrQMeRuOb7QOOMI/kO2Am9t8mE?= =?us-ascii?Q?XHuBPEWQ+zXCMy2ZdAYoFQ2CFfVsvx0Hm4wozY4K38oMAlWK9xnj6l4Fsj+7?= =?us-ascii?Q?qcyF/+4g2coxvU9PALM9oiSp+rNWOYNL5yCo8UtmTB74P/fP6pzpvc18GHq8?= =?us-ascii?Q?E6aDRK+4om4ABsI6k1vqpUYuwH/Eu9LnbBACYhx3AKZ0K8jWqXvuFlVw+1jd?= =?us-ascii?Q?pk7HFD/myMjq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q?0vHlSqqoFaXmrWni7y7WlziE8D0hh5WGU5iU/J43kVP3hiua0bHo1j8GRyLL?= =?us-ascii?Q?YHg4SFCJUrdOFRwM6ATDy5wAazYueaZCQYwHqsTFglW+nVw0zO1jUzE/stp+?= =?us-ascii?Q?dDFdy1EBKVDCxkAnAlkwWAJdPguCxooYgRFzR3QGMz/xR6tCLlXiAqPXIhov?= =?us-ascii?Q?PSC3JoCpmDO0wjpoREofaCwLppgGxpEyLFuNEeMu?= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY3PR05MB8531.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5247137-f539-425b-3fcf-08db469c675f X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2023 21:22:56.5776 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: zyEMxqyzHEmY0lLX2T1HrH1+qKYdC4sNfe1rDCUWh7ZvP5pvjcdiWb8kZhwZMYYcn4RHCH1ZinjoV55idSc9OQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR05MB9186 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 > On Apr 26, 2023, at 2:04 PM, Nadav Amit wrote: >=20 >=20 >=20 >> On Apr 26, 2023, at 1:32 PM, Jon Pan-Doh wrote: >>=20 >> When running on an AMD vIOMMU, we observed multiple invalidations (of >> decreasing power of 2 aligned sizes) when unmapping a single page. >>=20 >> Domain flush takes gather bounds (end-start) as size param. However, >> gather->end is defined as the last inclusive address (start + size - 1). >> This leads to an off by 1 error. >>=20 >> With this patch, verified that 1 invalidation occurs when unmapping a >> single page. >>=20 >> Fixes: a270be1b3fdf ("iommu/amd: Use only natural aligned flushes in a V= M") >> Signed-off-by: Jon Pan-Doh >> Tested-by: Sudheer Dantuluri >> Suggested-by: Gary Zibrat >>=20 >=20 > Sorry for that. >=20 > Acked-by: Nadav Amit P.S. I think it is stable-worthy.