From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 058B333C193 for ; Tue, 6 Jan 2026 17:14:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767719664; cv=none; b=gytWV9jHjGRosuKethwfEChVCkMoOx8l2Yu1HR1ZVUTx9Y6aYzujaTFYLxBTTzomL945DtQD2tdrKsMMDyfPWjT7XSJ4BdyGHN919E14e/Xhj749CuLlw4iAq9ncukccEEfLUbBUE2eS4Y5fWvamPJrVj8dAPDZKJveVM+u63YY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767719664; c=relaxed/simple; bh=e4T35VNlQjT4yqGwiGvGk0dwu/9CLYOxKafixrrvTew=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZAcq+UbOHY6eHDkrgD+tYcN3RdUG7B9cBkFpO6p24gyOOnTPtJ57KVdlei8Vx7q8KN4V2x+rRUEG3/Uv+4pakeUXWIxHpEFfk5O6WfU0efZBIQF9Zscy8byRiBpk1YWQg/EQ9pzwTTL5P5HDwROB48Tkf+sSBX/yRH4Nx5m+RLI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=a664+Mkn; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="a664+Mkn" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-b7eff205947so172077966b.1 for ; Tue, 06 Jan 2026 09:14:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1767719658; x=1768324458; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WXlvJG9FK5UUD3fcZ9qJ2guvXJiAhk3kEUMV4nJofUY=; b=a664+MknE8sWX/FthIwixxn7vB5b5Uvvbrv5hSGmS7fQ7n9tIP1HKkSKDi6bBPCiDC o55M0RsiIOrXA596Xthr++dwjuRQUSsPDxYSRvlWhYg4Sw61HS+b1PHX1xnEXRNymtCb 8MOSyGWZr5sht6oB36wFvfJlfnKnNMHGlsSgA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767719658; x=1768324458; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WXlvJG9FK5UUD3fcZ9qJ2guvXJiAhk3kEUMV4nJofUY=; b=VR0UjTuVaP3Gf0OmIvL/VeF2cSXeHLt5FmsbNmLo2/zGN0XdbuiXlS0KVTqaU3dahT B72KzT9HJqiMUyaA7TyWWs2BXQyI83LlResjSeCFu5A4ML9KlIv0iqGP9NhVg4g6hjQq p5my8ftU7B4LLzn+03pCJIz5TR4WbaHV72EA1Q6QnbYfkGMH4ocb//RsGLdoHFMMIODx 6rC8C3YjZGaAYOPx2bm+bek5dKlVQQSpu5j2zd/JrVjeefQIKtyD1t47RHAqBKOaCcof /7jImNIPJ4lapPxHbDlh57P3cOkAHu0a3HeTU232eJ+ABTs3KQmu38vqwqsEY5Ld3at8 1AjA== X-Forwarded-Encrypted: i=1; AJvYcCW0Ni1aeRFPT7ULYjWNX1wHcel3cTTVhBcn2rKcPbL0JhmHj5fI9sjDimJ8k43cIB6B8pWd1sEq1lxzHRk=@vger.kernel.org X-Gm-Message-State: AOJu0YyKWpDs7vaqO1g3ByhdcdUJYecmFC7t2e81GyNshY95JnB1zVk2 bvB7m1e/6F8nQVB7rimKCp+ZlrabZwKWZ9jNO4U8gkLoN1h3i9t/BIggr5l7q74Bog== X-Gm-Gg: AY/fxX4MBYn8E9D9IZKEj/BlWLFVEohr75uZaFkyUbuTErL92+RXiTiph3agFIA/jGI mD9Rk6QBqrOy2sW4MZPhd2hVG+mjqcBbqE2pddt0hhyWgvAzYWIjzSEjC5Jx7oOl/MmTDANWsXq ZIzzwJ8vMHzg6lI/EWTE8qA4pYdpF88SmeBf1C5DK8YqCOmWK0DDFvPNTOqzEaa/osmuPNoOqu1 6rwHBZfX9uvOw01L68KxVJJeHnsIOyjpxr6Slj7Hlmk/ECwgBWwsHGVL9MGOt32wUZlkyY01PNy ujCFHJP1kotY8X8ykL+gvWJvnatgsOxdFbNXLGS5bZjMOXN2Bmd/uMj97BnuNJxN0Xow1fubxPl oN5zPstGqqhq2eRfdku0s66riVb7jefq3Zlb3OggNjLrth4LFnrBNsK8vTu3oEr6S6GjEORILpT 8mxOzZutPOJIqL+mX7nPQf X-Google-Smtp-Source: AGHT+IE722evihuuwUcy6Q4PwCANc2+jPlRhxHzW5JOblV3Ggq8Yl4BedgAWZgXFlOOAVc6DpgPqcw== X-Received: by 2002:a17:907:980e:b0:b72:d001:7653 with SMTP id a640c23a62f3a-b8426c5f9demr391134866b.19.1767719658324; Tue, 06 Jan 2026 09:14:18 -0800 (PST) Received: from mitya-t14-2025 ([2a02:a31b:20c3:6680:43e9:5120:2208:3239]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b842a27c0bfsm279941566b.22.2026.01.06.09.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 09:14:17 -0800 (PST) Date: Tue, 6 Jan 2026 18:14:14 +0100 From: Dmytro Maluka To: Jason Gunthorpe Cc: David Woodhouse , Lu Baolu , iommu@lists.linux.dev, Joerg Roedel , Will Deacon , Robin Murphy , linux-kernel@vger.kernel.org, "Vineeth Pillai (Google)" , Aashish Sharma , Grzegorz Jaszczyk , Chuanxiao Dong , Kevin Tian Subject: Re: [PATCH v2 0/5] iommu/vt-d: Ensure memory ordering in context & root entry updates Message-ID: References: <20251227175728.4358-1-dmaluka@chromium.org> <20260105181200.GH125261@ziepe.ca> <20260105191410.GJ125261@ziepe.ca> <20260106001418.GK125261@ziepe.ca> <20260106142301.GS125261@ziepe.ca> <20260106164518.GA340082@ziepe.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260106164518.GA340082@ziepe.ca> On Tue, Jan 06, 2026 at 12:45:18PM -0400, Jason Gunthorpe wrote: > On Tue, Jan 06, 2026 at 04:50:11PM +0100, Dmytro Maluka wrote: > > So we'd better make sure that if it happens before the barrier (i.e. > > when the device is not supposed to do DMA), the compiler (and thus > > the CPU) doesn't set the present bit, so it stays non-present, so > > the IOMMU will block this unexpected/malicious DMA? > > It is true that any write to the dword containing the present bit > (only!) should probably use WRITE_ONCE. Yeah, I agree that for other dwords within an entry it isn't necessary. So, when it comes to the actual code, it's not like the Intel IOMMU driver has lots of WRITE_ONCE spread all over the code. It's only in pasid_set_bits() and pasid_clear_entry(). Though, since pasid_set_bits() is used for setting any bits, as a result, WRITE_ONCE is also done for dwords that don't need it, but that doesn't hurt either.