Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp212921lqc; Thu, 7 Mar 2024 15:22:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU6i5hsK1oWmFGJFiClUuJEArrTDMkyY7NL3ckaUiGS34vFA0bxqVmTqpDWjyGF83BJNHaWJ8GNaFgaYJKEOdnWUlcbTewqWQmZdGTdWg== X-Google-Smtp-Source: AGHT+IEBkpsCYBFdvHtrs3IznTCUVtZsbPvE9t9QdMrJFY5rFAspXMCdx2MNpumCZFTB84oRMbHK X-Received: by 2002:a17:903:244e:b0:1db:dd24:9962 with SMTP id l14-20020a170903244e00b001dbdd249962mr4147957pls.21.1709853736721; Thu, 07 Mar 2024 15:22:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709853736; cv=pass; d=google.com; s=arc-20160816; b=WSDResRqHPVPqRA87GTvnJEa/pwt5joegxe6mTPbT22XU1hfKec10vhT2lFAl4PWHg /Xu7vvICsCjXMbrfSoVCIqsGiyU77EWB0k0nEOuvfjy6menDFMNHX2MOvx9KnUW/uYiW 2Jy0IiUWDN31q8vLF+piD7dkU7vDGP+ScxnQx2Tbg4ZJDMqI8wZljr7cd68IZHcIpdsm VeI0x9KotPl+sGUtanKx5uzZiJ6Cy2X/KgqXWnWLS4N7575MnvDVjpzE6/tM/OvkjR1Z Neucng+JQDqjI6KhW0UI27q43tyNDVUN7bF9bbRLbvjmPpID2lt7B0rRJzLUSo/tZ1lL CCBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=FIppr601zKlJPo7n//Aa9KFNnMCMYv3+aWfxsYfg6kU=; fh=WxoVq/TUd8d3nYhabnafWtPHfid2s6gGPWVGPuhuzZ8=; b=m1yp08rgFOUI46+JPk1b9RCwGev7GD3c8siCYrzTeIHoNscfOTFE5IMP+/dKszul7+ G762TreoWclYz6AXjz6J04sgE3eCMC+KyhAbMZunobvpvWIRsiA4GBwOcHVJda8uMPbV 5XPk/t2SglcgL1BPjwehSgWZyWNZJQx6o59kPF6soyv1YQJcHNvrrNLxji/S+6fv6oXk W10r9w/M+21gLLgvJjnpJiKYz0grGvDOX3U9wQctMmjwvMV2Z02iYHEYOrgs4yL3fgJi DTg4Pc+LCVdmeuZtm+2ChW45O8qcYUm8GX+5Y2zRVDGxM+HdJdQwhoj635IT8ozCBDDs R/uA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ICptk1FP; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-96362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n4-20020a170902f60400b001dcada968c2si15479328plg.560.2024.03.07.15.22.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:22:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ICptk1FP; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-96362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 62E96B21C74 for ; Thu, 7 Mar 2024 23:22:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69ED03EA9B; Thu, 7 Mar 2024 23:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ICptk1FP" Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 16E78339BF for ; Thu, 7 Mar 2024 23:22:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709853725; cv=none; b=Oy8tkiPbIMWq8mMHEF7MsOUCrkTcYSN9Q1xqIRB4dPrzISAAFQftz0nfvK8st3k/qL5sg+yk5TNdMMBcD60lBRR8/LZo+4I9bqSfTSx4XfQ8RunRCxCu/pKa3Ym6tIHoh+J6RreZ3hjxnL98leSLaCiWm2Q7DeLKHKWuV3ux1XE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709853725; c=relaxed/simple; bh=FIppr601zKlJPo7n//Aa9KFNnMCMYv3+aWfxsYfg6kU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=iIuf8g2tJu2iCcLFwFIuPHNIPxpFpX4VeJOc8Pvz2ElS6lLK2E0/1BHTz2xuNW6qaSUGEeYHgWbQ6IEPO+DSB2VilIiYqLaS/FoHEwQTHQuX/GWTgmeZKA7acjeaI/wsvWz+Pahkx7BLejS9Fh7vRoQEmD/XB0cEYIpCw1yMFdM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ICptk1FP; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a458eb7db13so221443366b.2 for ; Thu, 07 Mar 2024 15:22:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709853722; x=1710458522; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=FIppr601zKlJPo7n//Aa9KFNnMCMYv3+aWfxsYfg6kU=; b=ICptk1FPbdyzlonRog3ZwAdVwDfl5awMLEGrcHvtKAsHMdOYKFOJepLkr8+OOvIrIi UPoLFr1OHO3Co7eTgBqofJnRDbg7mx/SM/4unEfji2ODFFAv7qOBb9fn33mW9fIMSGTz g5KeRczbwUTXVwcmn7/67XXTW8OPespLbC9rs7Dy6C3TYYCN3vfDb89Nc/HsPldAzNc+ T7N01aB3rGVNGWCaAfYWtIxo8ArURngbwN+KJ0i8wX5gJr1TrR96z5+VcX0IilxRu4Z/ mUFGkpg/+uvrIQ8wU3Zv09cNltD4Q1srbUZUffBYVhfYKAa81nEvrtOU6JpZ17tehekV fQLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709853722; x=1710458522; h=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=FIppr601zKlJPo7n//Aa9KFNnMCMYv3+aWfxsYfg6kU=; b=uwZufCMJ2fwXr53Bn+/emRG72bbYjy9X+cu1x7VdtG/76Rjw/2ZgrkOsJlc4ZH0kIO hW+S1bk7wKfZnOJv5jZhtXoEf7sU7/DiwJo70eVkXXQCbS4UIf3A3K8+nES+8UYIbDrb yPsKD2GHk1IggQreOBAB2l7vpvqStDHtYUzXGDqdmC9LyyljLLhnrI2coP8aoQH/FZs6 ufGGlID2my94suNt1u2uL5ocfxegFjaeELhmMaPdrseAKPelnoC3oksohYzF2cPVqIN1 isfpl073dsaUIiBH3g1T8iy+jeUr+O6UxHhQ0c4QJhuhMx5AK1IgPCkktiX3TB2nDDCv AkjQ== X-Forwarded-Encrypted: i=1; AJvYcCVkqOWyybyg5fJTIBQw/1mJU/bw+G6BbqOCXt/26hKw8YLWu0/Hm9HTGAR9czby7Gi3tynY/nbEkc0v3/7nz0c7i2NrPMpe6p937D9K X-Gm-Message-State: AOJu0YyogYbS0KJcY9FV8BFIfFrFI9cgO8zBqhN2qt+mA7MhGj8M9jd/ BfUgVbjNms9kGTbq/t9jSwUgvgiBSZT8pZ36OZPrP1+POUaL+v4AOFOy+hHXGYMoEoa6gAQrMjV sXaDShwcNno7XMvpyGGd4Gwo4t+fjrhyZPFWB X-Received: by 2002:a17:906:340e:b0:a45:baeb:3b3f with SMTP id c14-20020a170906340e00b00a45baeb3b3fmr4240984ejb.25.1709853722062; Thu, 07 Mar 2024 15:22:02 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240307133916.3782068-1-yosryahmed@google.com> <20240307133916.3782068-2-yosryahmed@google.com> In-Reply-To: From: Yosry Ahmed Date: Thu, 7 Mar 2024 15:21:26 -0800 Message-ID: Subject: Re: [RFC PATCH 1/3] x86/mm: fix LAM cr3 mask inconsistency during context switch To: Dave Hansen Cc: Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , "Kirill A. Shutemov" , x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" > > The "set_" naming bugs me in both of the sites that get modified here. > > I'd be with a new name that fits better, if we can think of one. > > Is it because it's not clear we are updating cpu_tlbstate (in which case > I think update_cpu_tlbstate_lam() is an improvement), or is it because > the function returns a value now? If the latter we can put "return" in > the name somewhere, or keep the function void and pass in an output > parameter. Or we can avoid returning a value from the helper and avoid passing an mm. The callers would be more verbose, they'll have to call mm_lam_cr3_mask() and mm_untag_mask() and pass the results into the helper (set_tlbstate_lam_mode() or update_cpu_tlbstate_lam()). Another advantage of this is that we can move the READ_ONCE to switch_mm_irqs_off() and keep the comment here. WDYT?