Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp194457rdh; Wed, 7 Feb 2024 01:46:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSdjciZFQZwIb3uKtNUFHHwnBmYm5vE01QQDdSCrebEQMn0614yEBiZgblvr8cxbdOmc+z X-Received: by 2002:a17:902:d54b:b0:1d9:7c1e:2f33 with SMTP id z11-20020a170902d54b00b001d97c1e2f33mr6312958plf.39.1707299206323; Wed, 07 Feb 2024 01:46:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707299206; cv=pass; d=google.com; s=arc-20160816; b=u5+zz0RPARvuv0EnnGmZ7lcmiNea5d8ezkx7S4z51NL3CtYcoPLslG7skLVjp0l1rl 4Bnx4c4KWwVRVEd/QwPw+73h7nI+/a1XTNxT85xM4w6iEkxoCXBQl/mUg8EBu+gzElc+ QoiinhqTIkpOCeMRX+hF1/IXOwt7Z/Grc7ZULXx0CDdiQVPdo5ciwhlmIqSEdfqIXK5S MQ+n65Ew/iOzQUcPUIoPSjZ0YjcvIfRgWAje5as7oG+RyNKaiSyV3o47vY2siRemQWLk 9GoIFFrRcHqhRznzAvav4H24ixwrylGwAHPaIlTJzjKBb/9uaHRr0p9XtTdyx+dpXSEr 1cJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=BbyM0TxgwW7NxbPK8YYz+FX1qkBRa9X6fI99XFXXJRM=; fh=7c8lNwvNqlF532Iby6Gc9F0gt/jRBmGYr8btkmeYunc=; b=KQZK5BEyslNDib2Q3RTdO4r853GBP+etHE2GoR55WV3tUqPRPpAff5DICwNvhA1lxk ux8HJRYaHogLi6MwYHN0xFqG/+3e6Aede0yMriClLpaF9IjN2jg277hl2DzDKoUZZP44 O3Iwzxlsbpu7rWP4WQc9Xu+YstK3XuLuXe7bn14e5OrIzU8pPHRV3QxixhdPcOktQ5A9 TelZyd9k8PF/yHW4SxXD80DhIARBKVTSyRm/Jkhz+xRunRw/5f4OjnGxezCA01vDqeEK jvd8m52iWMtn7QPGKA7xohZx8/NwVxO6YArRTXmf+hcaIXLelKaXijZTIW9mZDHq7Fr1 mhbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=G7aCWeJJ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-56244-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCXSpSJFUeqRda3DRvMrZMeB1PBXvh112Ow277g2UznkH7B1HFytSo2waQBCXxExVdwgq3zIiqATxdi5t6/7/wWD8qlR6kLrnzpC+YgRUw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x21-20020a170902ea9500b001d9f2674008si644640plb.118.2024.02.07.01.46.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 01:46:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56244-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=G7aCWeJJ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-56244-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 00E2C28390B for ; Wed, 7 Feb 2024 09:46:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C955225CC; Wed, 7 Feb 2024 09:46:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="G7aCWeJJ" Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BC49224F5 for ; Wed, 7 Feb 2024 09:46:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707299176; cv=none; b=JpRepl5F/SX3aacZsFZiXYLmSJFZTMnA/AM3uqUH/hv8shLPpV0EGzqV9qXWfcAr9MgJksCgBTZFuU1NChWpjU9lXprvQNb3BDrdiwyHu/STjChn3EDVPYqFXgfMFq5XEecEXH95Y/D7j2qHOC10b13gZ4SD2HEssXXkI56EZfw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707299176; c=relaxed/simple; bh=8pC5J/DPGDYSm7eVYO0ax2DxRputXMPsGsVLNt9KW2A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bVXUkzFaZnWFXukF5I5xW4cHDKNMFYihW/8e+Wuzm1aXvETcXygZhNDnXkersZGT9Eb4nN1y9qje/k3dG/OL0N1CVlXRNaiYRhlUfn0Uo54V/LpboEqQfw6XjljpBQAuiTPT5J0RhoTXotFXnxW86Jnr37DwsO+pQAWlUmHF6GM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=G7aCWeJJ; arc=none smtp.client-ip=95.215.58.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Wed, 7 Feb 2024 09:45:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707299172; 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: in-reply-to:in-reply-to:references:references; bh=BbyM0TxgwW7NxbPK8YYz+FX1qkBRa9X6fI99XFXXJRM=; b=G7aCWeJJUhuhyNkWBRZ9UM7qlDYraFHLUrbdbVEE0wOk8mLC6yo3/1GVntJvr+NUewQ9en 9MgAR7WrDBTD6ftSPhs/OCIsWK+SigLahE1gyASEjrHsxvXac7YkxTWVfKoAjlSjWuEADl ny0eRVGG9xoovzWOU8BYc/VxoZz4t+w= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Ganapatrao Kulkarni Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, maz@kernel.org, catalin.marinas@arm.com, will@kernel.org, suzuki.poulose@arm.com, james.morse@arm.com, corbet@lwn.net, boris.ostrovsky@oracle.com, darren@os.amperecomputing.com, d.scott.phillips@amperecomputing.com Subject: Re: [PATCH] arm64: errata: Minimize tlb flush due to vttbr writes on AmpereOne Message-ID: References: <20240207090458.463021-1-gankulkarni@os.amperecomputing.com> 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: <20240207090458.463021-1-gankulkarni@os.amperecomputing.com> X-Migadu-Flow: FLOW_OUT On Wed, Feb 07, 2024 at 01:04:58AM -0800, Ganapatrao Kulkarni wrote: > AmpereOne implementation is doing tlb flush when ever there is > a write to vttbr_el2. As per KVM implementation, vttbr_el2 is updated > with VM's S2-MMU while return to VM. This is not necessary when there > is no VM context switch and a just return to same Guest. > > Adding a check to avoid the vttbr_el2 write if the same value > already exist to prevent needless tlb flush. Sorry, zero interest in taking what is really a uarch optimization. The errata framework exists to allow the kernel achieve *correctness* on a variety of hardware and is not a collection of party tricks for optimizing any given implementation. Think of the precedent this would establish. What would stop implementers from, say, changing out our memcpy implementation into a a hundred different uarch-specific routines. That isn't maintainable, nor is it even testable as most folks don't have access to your hardware. Ignoring all of that -- I question the necessity of these patches altogether. KVM writes to VTTBR at the time of vcpu load as of commit 934bf871f011 ("KVM: arm64: Load the stage-2 MMU context in kvm_vcpu_load_vhe()"), which should drastically reduce the overhead of this hardware fix. -- Thanks, Oliver