Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2115143lqe; Tue, 9 Apr 2024 09:53:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYOQuNkjoTYdCG5KBwJg//jMgs1yHsEAv31/KzTlq3ulNi0xCLLn5tHvQkiPJvzauYXJaU+NuFdfTdoEty6FV79Cr2bi2x1W5taI3W7w== X-Google-Smtp-Source: AGHT+IGflXNMkkfUwGDn8x+fLWv/TQfc8gfk4lxoeBvfHKdeKkCoCfTCwqd5JCtO4ZMMwaC7Ec4t X-Received: by 2002:a17:902:f644:b0:1e4:55d8:e74c with SMTP id m4-20020a170902f64400b001e455d8e74cmr413339plg.2.1712681633361; Tue, 09 Apr 2024 09:53:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712681633; cv=pass; d=google.com; s=arc-20160816; b=bqePuYOAewkWFsoMehHxQBRdcWPaDBw00Q7jknzamiY/LgxhAKZXVI5svFAwiiVk5v dQdpjGvnNeLZaoGrki4XxWnsPnWlPE73MRjSoFxHmi06sON5nROTFJ1Y5jieZGnfOBI0 iADEfIlqHoXwoqBYQX2NFJ2/PnQH4ib7EwREiM8ys3oH47UfYVVRYoBuaEzOhMKGeaa4 wrVNCXK02TCXHQVErLEckzuMlhebkIUtMGzT2OLb2yBWHqRhtdXi93A3qpFZLi/ImY+k pkuuPrFg96WzQXxZ+EereSq4O6NwtIblxBdK4byv2Kq8DwOpNHWObA3F4g2sEEr5lwHE zJlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=K94SiKIbCJp8SM00bpnKqldx2icgrR1O8gIbHUFQzuM=; fh=ccDyJ53AJLQyHZMVuuYKgwyTJRLNTFO/Mvc0f8ZZh9c=; b=m/MBpXo4/ZSHJ3iP71qp0R41x72E36e7tU8YgN6RMytlGWZKtbgQNHjJ01MtlW35vk GYqR0EETnhSKYCPUzW8Y9PmhcNFI09wxzm/CRDSSXFwj3oB+tnqRUcJAVlKzuLfhs9Gq aFWQSN9QW7RHTYgiS3hSBx0QfH3yO37/DJXciWZomKpjlVufnkn2CV2Rnuk+ngZneujz HbkpPZiZQfU78UxrO+PjZhuGLZpEctl7srvFDembwuGgE6edrkp9SysKhvKWaDjz+qsA oa8LVvdid+f1Wlm7URNpNeS46BOe/XGR19FOPi6QwWKVK6PM/nJMAIZhY1OjnueebdYL cmXw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LZcNb3Oo; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-137342-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137342-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p8-20020a170902780800b001e4ad7873a9si1236788pll.162.2024.04.09.09.53.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 09:53:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137342-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LZcNb3Oo; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-137342-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137342-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0CF33285CAD for ; Tue, 9 Apr 2024 16:53:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B77D153824; Tue, 9 Apr 2024 16:53:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LZcNb3Oo" Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 EA46F6FCB for ; Tue, 9 Apr 2024 16:53:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712681625; cv=none; b=VfjEewxXePNaM6nGcimEjuy/6DA/xZRefdV9jUg7E6dXwl72kl3kB6o7yX/kEXS6ta73yz6jECTinu4vLi0DtpuiQqNRoHCWwdQQd4aZqdKNbSBS8L/+07bLx2h/uAPTerMcqAbXbjxqF7FOkmD1/WudOlq3k6cieXDo3hvhf4w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712681625; c=relaxed/simple; bh=Z5UrXYx7JFbheXSytyRul38kZzlkgMZgaLmQNOp0J+E=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=b8hSa0mshlHMW0bXTS7s7SOZX3XiMpxO+PR26qiznJxDjj03egZu4quGt2YIhAJ81e4FLUUrhuMNuZ4RvHM4da3yZmBc6vStatR2PaIyGZaeGsQ19XokmWDmrOR2G6WLzOxPhzEAkH2V/KrT5PyxHym+z/g1/y3fdY8+IJeNKIg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LZcNb3Oo; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2d886f17740so27435711fa.1 for ; Tue, 09 Apr 2024 09:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712681622; x=1713286422; darn=vger.kernel.org; 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=K94SiKIbCJp8SM00bpnKqldx2icgrR1O8gIbHUFQzuM=; b=LZcNb3OoDs3PdGzmToQHEnQe+A2dSh0L87Q/KFXSBCHyP2ui00kq089/P4BK03eN7Y 2xMSpHAw7AUVg89MufSk4JE3OXDHu/bdvrkeiVAbk3eDBf5FxRoTHCTgGxipsYD2lCyK kLYfiQLh1HwqnwE0pn6VVhR5yfN8qWClOISyGgaBdLfakiE3JmGAlWzmpnAjK7sA/Zv+ 1QJIlm4AZenByJatezzIbd4/k24iFiZcm2JHu+HWTWykANUcLfqsKmYWvu6V1Qu6Ab8S 42I/Px/ddaJzxXFGp0S6fF+ABGSNwW2KKyMZZ56Tk9COj4k87/8j2O7hrpvzbb9CsdeI /CEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712681622; x=1713286422; 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=K94SiKIbCJp8SM00bpnKqldx2icgrR1O8gIbHUFQzuM=; b=iINIuRXgLk9G/yispJ50trr8eHW8gHUKkJURreVAEt3+cvACS+tX6ZnNQZBejxzWOO P2+Y15ApRflhhzb5ZsxqMj8EjBowjd3DwnHMi8LTmRkScOp1WchiqYBIwGpkm+Ihs5k6 TsABUCFD17mLlbQx+9JayaOU41NKdAn0l3Gbopy7fqvxqloJxk/kSRwYn9aK0d5fQBS8 xWsIP1rUm70AE99VB2S6H8OCzZXx/DXUEg9nweKgjC5VxtRoYbXtpQDAzSTNiZw9Rked lknTnm6wn8NMDwd9TWp04WfReml7+8GiqXfRBnbfa7c0BDZBoqcZeCiBUvzAsQ4noOkv /uvw== X-Forwarded-Encrypted: i=1; AJvYcCUnY3AbjPftYnNDFx7CFcrkufW/pBciR/sJ1Izi7t0ZehcTgkg9j6HD7t5tk5SAakUbhdT9XSkEb0qiAOBBJ9qFhgqt7OM717rIzRA8 X-Gm-Message-State: AOJu0YwwMOXQL9QvLmjhWUbctC/XITWbdGzJE1JVRi1x4aO0kcqUiWn+ x5FbRxnaut3KIEthSna+3KwgBpYaE6uvf/qgD5AjgKTizWED61GMfhEFU9vB66hCorDS9BTZFKz jHpMG148GcjyI0xMUGRio6C2fOFY= X-Received: by 2002:a05:651c:1050:b0:2d8:606d:c797 with SMTP id x16-20020a05651c105000b002d8606dc797mr68765ljm.10.1712681622023; Tue, 09 Apr 2024 09:53:42 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240409100503.274629-1-ubizjak@gmail.com> <20240409100503.274629-3-ubizjak@gmail.com> In-Reply-To: From: Uros Bizjak Date: Tue, 9 Apr 2024 18:53:30 +0200 Message-ID: Subject: Re: [PATCH 2/6] locking/atomic/x86: Rewrite x86_32 arch_atomic64_{,fetch}_{and,or,xor}() functions To: Mark Rutland Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 9, 2024 at 6:34=E2=80=AFPM Mark Rutland = wrote: > > Something like this: > > > > --cut here-- > > /* > > * This function is intended to preload the value from atomic64_t > > * location in a non-atomic way. The read might be torn, but can > > * safely be consumed by the compare-and-swap loop. > > */ > > static __always_inline s64 arch_atomic64_read_tearable(atomic64_t *v) > > { > > /* > > * See the comment in arch_atomic_read() on why we use > > * __READ_ONCE() instead of READ_ONCE_NOCHECK() here. > > */ > > return __READ_ONCE(v->counter); > > } > > --cut here-- > > Yeah, something of that shape. > > Having thought for a bit longer, it's probably better to use '_torn' rath= er > than '_tearable' (i.e. name this arch_atomic64_read_torn()). How about we simply name the function arch_atomic64_read_nonatomic() in the sense that it reads atomic64_t variables in a non-atomic way? Uros.