Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1691363rwd; Tue, 16 May 2023 23:12:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6pGV1VemXduqIItzDw5go2KxUSo+J/DwhfvcP7nbAu7XPwDpKgvYXNIdsnearEawofUvQN X-Received: by 2002:a05:6a00:15d5:b0:64c:a554:f577 with SMTP id o21-20020a056a0015d500b0064ca554f577mr12123959pfu.11.1684303977512; Tue, 16 May 2023 23:12:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684303977; cv=none; d=google.com; s=arc-20160816; b=P2mthJdFPGr+9lHS56Yu72n9hh7mmo5iSFZ62ShAfpNFQVi2mLAjUMjOuIr9JuWN63 FSqUoI42hRAR5FZCAgqzOjCR6kr3wxzd5zr+4MOuvpYCF1f5hg8FQYrw9d+YihJkxtOv VwV3a3N0Yc/KTlxreYOpRKu5h10ZLv26lLBKZGSAKA3cVTBwt+GIihK4OCYf32uhkoqo 6Dgfy3BlUzULCui1voVnRDu62W6cN3dmw9xwAFbTMsU3DHm2xCw/oPYwdfGpyRSihkXk mWlMFRB2vDeAtT9b8xjScM1ndjzBGcgvxYXuY4S0rXV0/tA3IH2vfaD8H5dhos4ydU4G RM5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dCbjMLR0MZgcNfob+sgwKSmJL6K6D2r7QJTL+XYxuoY=; b=baMfurGQIZeSduQ0n8SPUw89l79M+74umEkWEdg4XG2iQqVUb6hF7+IIJV8spYVpIR LrMeZ3auVxtKA0i9K2HRrcGaUtI37xxPSrOT+Y/zMvnc/0nGxE8V5YgUCMQWqWcX60d0 sl6PLjsbP2U24GpZvtdwDhLfKBI2hwER1EyA3mz7HqpHLHsj2ZrfdodXnXB++Egilh91 KR2Nuf4Y3FJQmUWpdbry1OcuZ2swJgnSPqrQiVniIqb91RIYqNGPxu42NPiHWvsVy8VO w4fYjX0cUpmmyMJ1T0BJfJuQfAon+RHYWj4AmFjkVJ7Fi89ZM0507x1LDkCtDGXkVpvd K2NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=neCmu+km; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a13-20020aa7970d000000b006281ec442absi21829651pfg.309.2023.05.16.23.12.43; Tue, 16 May 2023 23:12:57 -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=@google.com header.s=20221208 header.b=neCmu+km; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232514AbjEQFt1 (ORCPT + 99 others); Wed, 17 May 2023 01:49:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229661AbjEQFt0 (ORCPT ); Wed, 17 May 2023 01:49:26 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A93F35A5 for ; Tue, 16 May 2023 22:49:25 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-52cbd7e73d2so277296a12.3 for ; Tue, 16 May 2023 22:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684302565; x=1686894565; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dCbjMLR0MZgcNfob+sgwKSmJL6K6D2r7QJTL+XYxuoY=; b=neCmu+kmQQCi6kMbUvpKbB3crrQIIlJOMJaAX5+04o65SAm/rJJCULnMqUZtV9DUZj TS3Bj10pryxxtgQi2zKgGImlwFJ8h9KjXeJkwzavmE09947Ia3Dw8/z59I7LL+Bv8+Ge NJv56L2xKXKFgtXxkFFv5dW3hkStv92iKK7l+4Xv0jUMatFTRZGKOANQo/wh6n+C6YJj ftCW9eI1zRxJ2qpKs2jECnogoiP/FV0KTa9tl/cYElWMQfYvpCrp6XwHack8ieAWRRMl SrsbyOrN0dLztIsY+mGw04SwsdzDz9xD8Kr1Wv5w8dfa6iMZaWd7ceOBRA4iveWzeHSB qAEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684302565; x=1686894565; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dCbjMLR0MZgcNfob+sgwKSmJL6K6D2r7QJTL+XYxuoY=; b=h/YYCU0EfbNElHTcnVMsWgXoYwLJfgHy/MKlC+rSplfrdfw5fSC9CacqDB3W32+3I3 OWzvQkW18clOultehEQlwu7ykINXlri6IVokTG9rjtqY25YK6lEkCwbVf2Np5mFtD+JT GAykxblHlhk9s/MlxIrQpvUvBvH5uM1m/Zk42G68bUNifq+YUvLHNc+WEDv6hcxVE/zX CGoarfvPACTE++Zct9t9n6HkhPcbM1OgcPbozwXQMouZgRAJrdYwxIiC4/JP2oCgcgPs SN/AjJXyASgoWx5+XnchRxmO9USKjypF+vnZAq0Hj57JCYsGRIsnjNVso3Wn8cVf6FPN +ikg== X-Gm-Message-State: AC+VfDzxjXAwKauZmfF73S3XlVBl14Lvj7mDFuNYMxV6zW38xS61NQVK Ag2kEqHwUyUb61cPY8EpOVWpntsjcZui039BA1Rs3A== X-Received: by 2002:a05:6a20:3d09:b0:100:5f62:be76 with SMTP id y9-20020a056a203d0900b001005f62be76mr43582822pzi.54.1684302564708; Tue, 16 May 2023 22:49:24 -0700 (PDT) MIME-Version: 1.0 References: <20230426203256.237116-1-pandoh@google.com> In-Reply-To: <20230426203256.237116-1-pandoh@google.com> From: Jon Pan-Doh Date: Tue, 16 May 2023 22:49:13 -0700 Message-ID: Subject: Re: [PATCH] iommu/amd: Fix domain flush size when syncing iotlb To: Joerg Roedel , Suravee Suthikulpanit Cc: Will Deacon , Robin Murphy , Nadav Amit , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Sudheer Dantuluri , Gary Zibrat Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Wed, Apr 26, 2023 at 1:32=E2=80=AFPM Jon Pan-Doh wro= te: > > When running on an AMD vIOMMU, we observed multiple invalidations (of > decreasing power of 2 aligned sizes) when unmapping a single page. > > 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. > > With this patch, verified that 1 invalidation occurs when unmapping a > single page. > > Fixes: a270be1b3fdf ("iommu/amd: Use only natural aligned flushes in a VM= ") > Signed-off-by: Jon Pan-Doh > Tested-by: Sudheer Dantuluri > Suggested-by: Gary Zibrat Cc: stable@vger.kernel.org