From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B8E8C04AA7 for ; Mon, 13 May 2019 16:38:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E320421473 for ; Mon, 13 May 2019 16:38:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kdoQdlVe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E320421473 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C9tW3w08sF7yRj4efieVMoLKSNoIPh5bmcG3zc4Hqyo=; b=kdoQdlVevUFYFx 7j7De49LJ3zUf08YNkTxywSEbAnpIAbQkfUG6Pjcnx/AouTrgM15kQXA0rFPuw9YDyf/XbXnOfhsR GoqbJFUiMIROtvR1X9yXYcveWgPauIOVwOlTVH1OZ33fUitZmVGvO5+vyeQt73pumduR3o3xVny8I o+fv4xyST97ejfUonh5SlASp2n+KN1QvTRZEyMZ4ITIVe+Buai+1nOtAV6omS4/d+m8TxHZB7yG54 Xe0vFWgiBw/grZ7H1kYR4t5OmOcUreFZkAhMe7JamT8HQ+NFNQXBI/BhMbUOd66Ui8keUBHG+RMnW fE5tYUezpFv4zt0HCGwA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hQDy1-0001Wz-Jo; Mon, 13 May 2019 16:38:21 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hQDxy-0001Wa-AW for linux-arm-kernel@lists.infradead.org; Mon, 13 May 2019 16:38:19 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B8E80341; Mon, 13 May 2019 09:38:16 -0700 (PDT) Received: from fuggles.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A893E3F71E; Mon, 13 May 2019 09:38:15 -0700 (PDT) Date: Mon, 13 May 2019 17:38:13 +0100 From: Will Deacon To: Dave Martin Subject: Re: [patch] arm64: assembler: Update the yield NEON comment Message-ID: <20190513163813.GC10754@fuggles.cambridge.arm.com> References: <198595.152792649-sendEmail@laptop-0p1i5f25> <20190513085624.GB28398@e103592.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190513085624.GB28398@e103592.cambridge.arm.com> User-Agent: Mutt/1.11.1+86 (6f28e57d73f2) () X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190513_093818_374693_35E35D74 X-CRM114-Status: GOOD ( 26.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Zijlstra , Hillf Danton , "linux-arm-kernel@lists.infradead.org" , Ard Biesheuvel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, May 13, 2019 at 09:56:26AM +0100, Dave Martin wrote: > On Sat, May 11, 2019 at 09:48:40AM +0100, Hillf Danton wrote: > > > On Thu, May 09, 2019, Dave Martin wrote: > > > > On Thu, May 09, 2019 at 03:01:43PM +0000, Hillf Danton wrote: > > > > > [...] > > > > > > * > > > > - * The yield itself consists of the following: > > > > - * - Check whether the preempt count is exactly 1, in which case disabling > > > > - * preemption once will make the task preemptible. If this is not the case, > > > > - * yielding is pointless. > > > > - * - Check whether TIF_NEED_RESCHED is set, and if so, disable and re-enable > > > > - * kernel mode NEON (which will trigger a reschedule), and branch to the > > > > - * yield fixup code. > > > > + * The yield itself decrements the preempt count and if count hits zero, disable > > > > + * and re-enable kernel mode NEON (which will trigger a reschedule), and branch > > > > + * to the yield fixup code. > > > > > > Good spot -- the original comment is definitely wrong: disabling > > > preemption certainly shouldn't make the task preemptible! > > > > > > So, I'm certainly in favour of fixing that. > > > > > > Your new text doesn't look right, though: AFAICT commit 7faa313f05 > > > didn't intentionally change the behaviour here. It looks to me like > > > the preempt count (i.e., current_thread_info()->preempt) is not > > > decremented by this code: the value is read and the subtraction is done > > > for comparison purposes, but no value is stored back. > > > > > Got it, thanks. > > > > > This is intentional, because the the code needs to do some cleanup > > > before preemption can be enabled for real: the call to kernel_neon_end > > > does both of those jobs. > > > > > > Or did I miss something? > > > > > No, you didn't, Sir. > > > > And I try again with log message updated and comment text corrected. > > > > Hillf > > ----------------->8----------------------------------------------------------- > > From: Hillf Danton > > Subject: [patch] arm64: assembler: Update the yield NEON comment > > > > The comment for specifying preempt count check was incorrect in commit > > 24534b3511, and deserves a tiny tweak like the following for instance. > > > > - * - Check whether the preempt count is exactly 1, in which case disabling > > - * preemption once will make the task preemptible. If this is not the case, > > + * - Check whether the preempt count is exactly 1, in which case decrementing > > + * preempt count once will make the task preemptible. If this is not the case, > > > > Then checking of TIF_NEED_RESCHED was removed in commit 7faa313f05, with the > > comment left behind untouched. > > Hmm, you're right here, I hadn't fully understood the context of that > commit. > > Will, Ard, can you comment on the rationale for that? The commit > message says nothing explicit about why the TIF_NEED_RESCHED check went > away: it's now checked as part of the preempt count, right? Yes. The value of !need_resched is stored adjacent to the preempt count, which is why 7faa313f05ca ("arm64: preempt: Fix big-endian when checking preempt count in assembly") can load both of the variables using a single 64-bit LDR instruction. So we continue to check both the preempt count and the need_resched flag, as before. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel