Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp235579lqh; Fri, 3 May 2024 22:08:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMkCe7wkyv2swDYmmdmotwrE4UnXn1fE85AlNV2IB2rypjO8/IMEqdCB1zbvEeQEBD0QUlKNnHzppDbIXS5E1tiPVgyFjWfnM6HwC5bw== X-Google-Smtp-Source: AGHT+IEJp/suTMRxvfIf5TlUY1ofmPaz3gtjtFv66TTip3YWFaI7UgwAHj0TRY7XIx7YA4Ag0DqZ X-Received: by 2002:a19:2d48:0:b0:51d:682d:c2ab with SMTP id t8-20020a192d48000000b0051d682dc2abmr2739503lft.32.1714799330127; Fri, 03 May 2024 22:08:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714799330; cv=pass; d=google.com; s=arc-20160816; b=JnIH5GkCOrSOkjbj9raRDgmB5a8HaMY6aH+joi7QmdRtKWfvkd6eDH2zqQ3P3jr8Fb SRl0USNV7pGacfNzyok2jzUi+Cq9LT8aPhx4yQHcHIBuEHDvdWTk6ve2rt2xF7NGdAaC H9xgrlzg4AdgAooDjez9igSKenLx9/HNiCcU9JHpxF6f/GBD3JuyfK1tnRIYwmjb/e6D BVw3mT54+4Z2vlJg4VnERnwTlM9YqbiDjEyyKxW4T86O9INz0chajhtKIjqj4sgk72f3 YGxIb0PJUAYrTOBOREnj4aOyyspYOv7v7n0UrK/FIr/VWJAGotoY6uIpaTsa9dWKUes/ ufiQ== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=ZfsStUYLb/xWJMdFbmgAtk05hXAgA8ofaIf/l+09NXs=; fh=XIehMoNIABZYw4jPMqUUb62eeH1uYrkMesD703g1lX8=; b=P/QNHGM2T9O0qoBAYFaTbm0tjW9/JV23nv+X0V46h0bA/ZwAo8GXXHq4vRF9Yhg7aP 58i/7HK2GBrBEo/BmaQ+8aPrLiOtu6ZYBkWFMlvB87N2e9j0bYX6czhS5bJ0pIIXQ6mj p/D4bHpUBNfT0YWyCyB7MM5yllWj4AxldibiZFNb4r80KGshostXRFF3t1Wk1eI9xK1H 44xrROgVgxaV9cYNszuf9jrMimQMJ8a2zIqiGo1riTursK2khuDiglzzA1CDtHCMnhch D+uE2m8cjf1nYe28lpHNNyuGh86MOuORlEc+sxe+VG/qxoPnMbbGkJNKDJknaaCoU0cX TmrA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PJfO5Z6T; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-168521-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168521-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dn22-20020a17090794d600b00a51a6bf356csi2428486ejc.4.2024.05.03.22.08.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 22:08:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168521-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PJfO5Z6T; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-168521-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168521-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id CD9891F2269C for ; Sat, 4 May 2024 05:08:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E2C94A35; Sat, 4 May 2024 05:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PJfO5Z6T" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9EEA628EA for ; Sat, 4 May 2024 05:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714799321; cv=none; b=I2Gzj28hhS9LyhSaXQp3dG8hQn8XXT/o5YQVR5ANp46/fgGvUCL8Cdb10SANMkLPajMlA/wbp1RXmSoDJ62ttvOzbzBwyE5zYKeaVYRW8Xkk2fgXpr0K+1UDm9xm0VTwlVmb9FzIUtp6AsNG0ZxGA0CyeUgkJs49yWY2orLy39Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714799321; c=relaxed/simple; bh=fYhGMy9BM+AuBO9/QTYR9umpxdJ7Anyl3osEtMYAJ5I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FF0nqBZfRu8DtadlrN+Nr9YQSAjpb2gqB0VYx+A9wrB9fNlNfa+SSo6gx6IMMH6Vn7vi9vuDsqk5qUbzYaZxYkVB/0CzVRrnSoikGoOPQrMfrEl6tRDWRja67WUZayJbFeEbnALjAi0X9BaOSSdKKpqj6U615PjP5DeDJHTxPXA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PJfO5Z6T; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25DFAC072AA; Sat, 4 May 2024 05:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714799321; bh=fYhGMy9BM+AuBO9/QTYR9umpxdJ7Anyl3osEtMYAJ5I=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=PJfO5Z6TA0rEg/ckgHHi/JarXqfuecNTvQ4GzuuWfSGsvYVIi7n4n58g9Co3wbLbl EpEcQad3w8811E1aR3L2DokgyZ/oiOB6OVSoWg6WP5u25AEkEVy/w/P7sQ5cyKbEOk Z5cg47nai0JxCg87tZbFLqtYnsOGAT1DCn3TqTwMwMk7BMWQMIQVwaRkvzfFAYKVYd aVxggQRSWRM3xycGzKb0AOYhYd6dqqUxD9RnvJ8Jg4Od8hEW8BwIM5CivIqC8cquW1 JmdVwunnH1Em2/NrAmm8yxXbDh+YSPlDPlVGddRcS5Gkkc/KoHp1+L8viGTaNPSxoR 5hDP/51moAlpA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B8CD4CE0DEA; Fri, 3 May 2024 22:08:40 -0700 (PDT) Date: Fri, 3 May 2024 22:08:40 -0700 From: "Paul E. McKenney" To: Linus Torvalds Cc: Boqun Feng , Marco Elver , Tetsuo Handa , Greg Kroah-Hartman , Dmitry Vyukov , syzbot , linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Nathan Chancellor , Arnd Bergmann , Al Viro , Jiri Slaby Subject: Re: [PATCH v3] tty: tty_io: remove hung_up_tty_fops Message-ID: <3f2c415d-dc7e-4647-9002-4beb804d885c@paulmck-laptop> Reply-To: paulmck@kernel.org References: <892324fc-9b75-4e8a-b3b6-cf3c5b4c3506@paulmck-laptop> <1c886023-ae61-46ba-bb3c-b460c30de937@paulmck-laptop> <2beaba9f-6f83-4a7c-8835-fe5fe88a006c@paulmck-laptop> 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: On Fri, May 03, 2024 at 05:14:22PM -0700, Linus Torvalds wrote: > On Fri, 3 May 2024 at 16:59, Paul E. McKenney wrote: > > > > Hmmm... Maybe something like this very lightly tested patch? > > I'm a bit nervous about using the built-in atomics, when it's not > clear what the compiler will do on various architectures. > > Gcc documentation talks about __atomic_is_lock_free(), which makes me > think that on various architectures it might end up doing some "fall > back to helper functions" cases (possibly for odd architectures). Right now, both GCC and Clang complain if you give __atomic_load_n() something other than a pointer or a sufficiently small scalar on x86. Let's see, starting with READ_ONCE()... ARM7-a Clang complains about even single bytes (ARM7-a GCC is fine). ARMv8 works like x86 for both GCC and Clang, AVR GCC and M68K Clang generate calls to helper functions, so they need to implement {READ,WRITE}_ONCE_MERGEABLE() in terms of the current {READ,WRITE}_ONCE() macros. M68K GCC works like x86, but generates a call to a helper function for an 8-byte load. Which means that the 8-byte case needs to generate a build error. Hexagon Clang works like x86. Loongarch GCC works like x86. Ditto S390, sh, and xtensa GCC. MIPS Clang works like x86, but throws a build error for long long, which might be OK given 32-bit. MIPS GCC handles long long also. MIPS64 and MIPS EL GCC and Clang work like x86, as do both compilers for POWERPC and POWERPC LE. And for RISC-V 32 and 64 bit. I based these on this godbolt: https://godbolt.org/z/rrKnnE8nb The #ifs on lines select the 8-byte and structure case, respectively, and you can pick your compiler. I just used the latest versions of each compiler for each architecture, so there might well be a few more surprises. > IOW: I don't think the patch is wrong, but I do think we need to > verify that all compilers we support generate the obvious code for > this, and we don't have some "fall back to function calls". You are right, this is going to need some arch-specific code for a few of the architectures. Hey, I was hoping!!! The compilers do not currently optimize these things, but things appear to me to be heading in that direction. Thanx, Paul