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=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 AF7F2C433DB for ; Thu, 28 Jan 2021 20:28:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3F52660235 for ; Thu, 28 Jan 2021 20:28:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F52660235 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZQKSG0EQBKWQlzrX1nxCJyR+FFXhCwT9PwUAGJwsZT0=; b=KzvUbDg9h/G4XGPUUzcaPOOpN 7QPMOnlNofPvtpF4khewpjdQSQYcyZ18Hb+pcIs+TVG5XCI/72yjMv9j0Dbj1UKsQhGsgWiQiz1nH P0bR8PsmNRsWzNG9O005ZsniBMRn1H13WlDKNcmnCZKv4eWzXR+Cuiroau8mvCSKNIFRHxMlk8QgE tjrhOoJCSmLhj1Ks2ijcFLUKWtqVNN9LITMfd1EQHgnCylDQi2InwWKFWT5TvHBAvRX8sDFTrTvJ8 yPpkmROn4jk/erC0tCFrra/sxUPbviHp7MNXFQFmOwb3I3YTT+AmD8bNlg7hWzlHw0q2SVR4pDXfv KzWTTDBmQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5Dsv-0003kr-6q; Thu, 28 Jan 2021 20:27:21 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5Dsd-0003fa-1O for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2021 20:27:04 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 30A6564DDE for ; Thu, 28 Jan 2021 20:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611865622; bh=A8VizoC/kGtJF6Ee4cawYgbcj/+BUWWZ59hffYwI1GI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ulA/eRWW9GMlsKEzH/xrofPDGjTyOP8senjIeg/tVuqNH0qDj0JcCU3aQjpNx9cVz EA0JksZA1m4rrXUeki5eJvsJ4amGhWYlbHBGVbKce2COtDWD/sPV41jSXlpOSmlkFt xrAo+K7YKG1JL2JpOSa8HmYO/qb1mUyVSTxwUALlpFmsB4bX0YtQhHHcBjTtQuwBW2 yw6FM22ScpLv+hJZZpYNzgI5S3GL1XNUNNN0/D58AWzwF9QWcb5Zx1o/9BoFsN9Gjq 5frbxnKOISyyJNNIGZuThM8Qn3nymcdRdWcFs/1i/oUMNwtM/ZAOQk6sm6ZhtnTNl3 DPEaXRrIkP9UQ== Received: by mail-ot1-f54.google.com with SMTP id i30so6479596ota.6 for ; Thu, 28 Jan 2021 12:27:02 -0800 (PST) X-Gm-Message-State: AOAM533L9QSTLcZEP+F4Dges2EO9rM4umWbg09prXfkZKNdVNu6HJ5Xk fnYHLy6CM13IuclgaNBkBYBSrQPxZlcF0nSrLbs= X-Google-Smtp-Source: ABdhPJxW/whtZhO4aofUYo+kF+Q81MhrlRvsoaGLSpRp51IXUhTfICw+9zZOYvrA3xnZ9UnkVaHeVay3sktECgO5NVQ= X-Received: by 2002:a05:6830:1614:: with SMTP id g20mr804055otr.77.1611865621406; Thu, 28 Jan 2021 12:27:01 -0800 (PST) MIME-Version: 1.0 References: <20210128130625.54076-1-ardb@kernel.org> <20210128130625.54076-2-ardb@kernel.org> <20210128202401.GD3016@willie-the-truck> <20210128202509.GE3016@willie-the-truck> In-Reply-To: <20210128202509.GE3016@willie-the-truck> From: Ard Biesheuvel Date: Thu, 28 Jan 2021 21:26:50 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/9] arm64: assembler: add cond_yield macro To: Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210128_152703_336470_5A447CC7 X-CRM114-Status: GOOD ( 27.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Herbert Xu , Eric Biggers , Catalin Marinas , Linux Crypto Mailing List , Dave Martin , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 28 Jan 2021 at 21:25, Will Deacon wrote: > > On Thu, Jan 28, 2021 at 08:24:01PM +0000, Will Deacon wrote: > > On Thu, Jan 28, 2021 at 02:06:17PM +0100, Ard Biesheuvel wrote: > > > Add a macro cond_yield that branches to a specified label when called if > > > the TIF_NEED_RESCHED flag is set and decreasing the preempt count would > > > make the task preemptible again, resulting in a schedule to occur. This > > > can be used by kernel mode SIMD code that keeps a lot of state in SIMD > > > registers, which would make chunking the input in order to perform the > > > cond_resched() check from C code disproportionately costly. > > > > > > Signed-off-by: Ard Biesheuvel > > > --- > > > arch/arm64/include/asm/assembler.h | 16 ++++++++++++++++ > > > 1 file changed, 16 insertions(+) > > > > > > diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h > > > index bf125c591116..5f977a7c6b43 100644 > > > --- a/arch/arm64/include/asm/assembler.h > > > +++ b/arch/arm64/include/asm/assembler.h > > > @@ -745,6 +745,22 @@ USER(\label, ic ivau, \tmp2) // invalidate I line PoU > > > .Lyield_out_\@ : > > > .endm > > > > > > + /* > > > + * Check whether preempt-disabled code should yield as soon as it > > > + * is able. This is the case if re-enabling preemption a single > > > + * time results in a preempt count of zero, and the TIF_NEED_RESCHED > > > + * flag is set. (Note that the latter is stored negated in the > > > + * top word of the thread_info::preempt_count field) > > > + */ > > > + .macro cond_yield, lbl:req, tmp:req > > > +#ifdef CONFIG_PREEMPTION > > > + get_current_task \tmp > > > + ldr \tmp, [\tmp, #TSK_TI_PREEMPT] > > > + cmp \tmp, #PREEMPT_DISABLE_OFFSET > > > + beq \lbl > > > > Fancy that, I didn't know the '.' was optional in "b.eq"! > > > > Anyway, a very similar code sequence exists inside if_will_cond_yield_neon, > > only it doesn't touch the flags. Can we use that sequence instead, and then > > use the new macro from there? > > ... and now I noticed the last patch :) > > But it would still be nice not to clobber the flags inside the macro. > Yeah, that's a good point - I did not consider that. I'll fix that for v2. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel