Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3905336pxa; Sun, 9 Aug 2020 16:16:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVayouJ9Gzs2IlCPArsHB974wXlMtoV8bfSh3jbRfuTW4oE2+cMUAd1qfSMwPal3WpqBLJ X-Received: by 2002:a17:906:4c46:: with SMTP id d6mr20276253ejw.14.1597014982186; Sun, 09 Aug 2020 16:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597014982; cv=none; d=google.com; s=arc-20160816; b=yDlVmvStH9/CwzY3N/3x/nRN72acRcbRU2AoFSszw7yFG5pFD7dIcaDdL4zfWrw8hp Um1Bw6EFEivmEj6IT56zO3Qbjq28RyICsGLcgrtgWpIK+OKyXjJKgEljFmCPrEGwSJ4A sWIVvdcCR0gNGgCmF0WpZaWO+2aatYxLgBXxZ2/o/eb1mElAWuXmU3KZofe8a5H51uNB DjWNtPV2HeUPQ7oDuhwfndNtPVqEG1tOQgW1KiLukkgLU2W/EyAySijG1wj+WfDnedsR J5ev4JBpCwRJwg6xPQCWt9AZq0iVolniwDnVaf4l7+dFgYn/5vk/7JKrJoucZKOD7B/S eoVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=zqq3gXY9wnTvB48ia2XgXbcy6fImuA/qqsxteU9Vm/c=; b=HcIqVbBcrJ3kkttQr1j1AxKuhofH6JSKfef39XDqvAgbck4lMajNVKvT+WP8Fit3Z9 fpCLJ/a6UjWlNSHcTVUdauQ9dDwKxtpLYC26mggoUKfJ7G7ZgxbJzCQAFsynXqdfw5+i HdsX11w9PvDnPnJjk5EOA6Bw/IL92/mhbpw2TgY3Sd3DQmSev6s06n462oNxIJ5c9PdS PoyW/Jj77Q5CxDEQuUAl7PixN8aMh+Y2IVDTI6dmbhHTjMiYYQM1M03WCHYydvOsWNxR DqDxL+fCmH+7+cqts/y/dGEScLLR2r0LsWSB6fcefzJsviM20g4UmsC8tdfjXSLExAq0 tYHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kq1si9906806ejb.246.2020.08.09.16.15.59; Sun, 09 Aug 2020 16:16:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726350AbgHIXPc (ORCPT + 99 others); Sun, 9 Aug 2020 19:15:32 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:55664 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgHIXPc (ORCPT ); Sun, 9 Aug 2020 19:15:32 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 9F8A729B87; Sun, 9 Aug 2020 19:15:28 -0400 (EDT) Date: Mon, 10 Aug 2020 09:15:18 +1000 (AEST) From: Finn Thain To: Guenter Roeck cc: Benjamin Herrenschmidt , Joshua Thompson , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, Laurent Vivier , Mark Cave-Ayland , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/9] macintosh/via-macii: Access autopoll_devs when inside lock In-Reply-To: <20200809190138.GA133890@roeck-us.net> Message-ID: References: <5952dd8a9bc9de90f1acc4790c51dd42b4c98065.1593318192.git.fthain@telegraphics.com.au> <20200809190138.GA133890@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 9 Aug 2020, Guenter Roeck wrote: > Hi, > > On Sun, Jun 28, 2020 at 02:23:12PM +1000, Finn Thain wrote: > > The interrupt handler should be excluded when accessing the > > autopoll_devs variable. > > > > I am quite baffled by this patch. Other than adding an unnecessary lock > / unlock sequence, The new lock/unlock sequence means that the expression (autopoll_devs && !current_req) can be understood to be atomic. That makes it easier for me to follow (being that both variables are shared state). > accessing a variable (which is derived from another variable) from > inside or outside a lock does not make a difference. If autopoll_devs = > devs & 0xfffe is 0 inside the lock, it will just as much be 0 outside > the lock, and vice versa. > > Can you explain this in some more detail ? Not that is matters much > since the change already made it into mainline, but I would like to > understand what if anything I am missing here. > I think the new code is more readable and is obviously free of race conditions. It's not obvious to me why the old code was free of race conditions but if you can easily establish that by inspection then you are a better auditor than I am. Regardless, I'll stick with "Keep It Simple, Stupid".