From patchwork Wed Jul 19 17:58:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 9852925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A45A2602C8 for ; Wed, 19 Jul 2017 18:00:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA6F7286CB for ; Wed, 19 Jul 2017 18:00:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A79A9286D7; Wed, 19 Jul 2017 18:00:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 36DB8286DF for ; Wed, 19 Jul 2017 18:00:03 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=M/Vds2u47Knhv9LmVrra2w43uqD9ZTLwRFY7T/jEBlQ=; b=kbN3kCxRdCmJxiQ2+7JZ919F3B jkGrptv4O9ZzE3kcXSAJZgNhHaUN4/vCNzgVCbx0UrrwpJeU5O6xu63/DkScx8NDMcck4iz/mUwV5 z+qSaJgieUxxe6ZPk54m/E0rf6MZmI9LW/sgS6luDbBGlxi0wfUuCms/93QMvVN66uL8zAf7SLXes ain4LaZIaPblnx41k5nm/jVc+AYKw/bJ1zR6KWI0ENd4Wb198Xe8Wtm3Lce6v+43OyfUHH1sgDbUO T6WbRfUIj0wPchNZ7dB0jkcQggMZlcLL2LwqvRPZmzsLk9S9A7t5P3WAZmjpKt7VkT1BOvQJYlLSQ CNlX31/w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dXtGT-0006iU-C5; Wed, 19 Jul 2017 18:00:01 +0000 Received: from mail-pg0-x22d.google.com ([2607:f8b0:400e:c05::22d]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXtG8-0006PL-7o for linux-arm-kernel@lists.infradead.org; Wed, 19 Jul 2017 17:59:42 +0000 Received: by mail-pg0-x22d.google.com with SMTP id s4so3323345pgr.5 for ; Wed, 19 Jul 2017 10:59:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UtRmaJlOpL4Kvxiq49KR8w5Z9hT2bfOw5Mex35eP/Ts=; b=f3dwMNBYvR6RgfTGVLgOSZpx643QB4HiDB/5JSibLBdqhq2QVtBt/VWHZnOCSU6BJa bur2GUxX/xdJ3C/nJmn/mgTSqQJBrTLdZ7Bc6TDw4G6znLqk68R6t5cAMLKZaPscZXeo xJ448/eeiGcVLxXo68qKtWcGaGFwRDkaldqRsa5sduAqQGYXBk8u1vJBVvm6//uiG4Lq iPZf+a7x+f7GnL0QmoWP73gZjHZGgDqP8DM3VUhpjM4GQs51MFVlz05LNdzC3M8Vuh/C ZhTrLdNmh+pvv4xarI3qR12mrfQEaXchy6Vm7ZCwSUyOIAipBSyOCMWQT/Tm4K2NBNoO jXrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UtRmaJlOpL4Kvxiq49KR8w5Z9hT2bfOw5Mex35eP/Ts=; b=szWTEnpR3gOYQ04zwBFKcWsCY6tKpHnBr2WVVGzgMTA9B+j7u+0NBxOxXlFaT8xAJG rgSG7v5Nd52NqgG7trV06f5HLvzb0iRiotdHJ2NXav/ay3g376qModU5PAvyIFUkF5un Kwckg+D1fG55e+rls5iGBUCAFQglmSarQU7bvlpxGUBIuPI1dGM9pJKbdotWTHA45Q/U HverycT82PhbMDaZJ+35uZMJJmgSMpbHrgx+hbox+cmkh1K3yQFlpPZMfkZNrloOZxG6 hJEcvBz31QO9l1zHkgujXsnz7s1FKDNjqe1M4b9FqfBbe4tWCcr9AhT7JuLTAh8qDfLJ Sp8g== X-Gm-Message-State: AIVw110tfAX95nI0lJ2CBP4JP1KPgxIWIFgywM3DLW8rj6gAaWkzWEpX dc5srXTmbJdXDWDC X-Received: by 10.84.215.144 with SMTP id l16mr942156pli.381.1500487158300; Wed, 19 Jul 2017 10:59:18 -0700 (PDT) Received: from skynet.sea.corp.google.com ([100.100.206.164]) by smtp.gmail.com with ESMTPSA id c62sm858546pfb.93.2017.07.19.10.59.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Jul 2017 10:59:17 -0700 (PDT) From: Thomas Garnier To: Russell King , Thomas Garnier , Thomas Gleixner , Catalin Marinas , Will Deacon , Dave Martin , Chris Metcalf , Pratyush Anand , leonard.crestez@nxp.com Subject: [PATCH 2/3] arm/syscalls: Optimize work flags assembly check Date: Wed, 19 Jul 2017 10:58:59 -0700 Message-Id: <20170719175900.124074-2-thgarnie@google.com> X-Mailer: git-send-email 2.14.0.rc0.284.gd933b75aa4-goog In-Reply-To: <20170719175900.124074-1-thgarnie@google.com> References: <20170719175900.124074-1-thgarnie@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170719_105940_301873_D3D78AFF X-CRM114-Status: GOOD ( 10.95 ) 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: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Remove the double branch and use tsteq instead. Suggested-by: Russell King Signed-off-by: Thomas Garnier --- arch/arm/kernel/entry-common.S | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index e33c32d56193..6e094b639d83 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -42,8 +42,7 @@ ret_fast_syscall: disable_irq_notrace @ disable interrupts ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing tst r1, #_TIF_SYSCALL_WORK - bne fast_work_pending - tst r1, #_TIF_WORK_MASK + tsteq r1, #_TIF_WORK_MASK bne fast_work_pending /* perform architecture specific actions before user return */ @@ -70,14 +69,12 @@ ret_fast_syscall: disable_irq_notrace @ disable interrupts ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing tst r1, #_TIF_SYSCALL_WORK - bne fast_work_pending - tst r1, #_TIF_WORK_MASK + tsteq r1, #_TIF_WORK_MASK beq no_work_pending UNWIND(.fnend ) ENDPROC(ret_fast_syscall) /* Slower path - fall through to work_pending */ -fast_work_pending: #endif tst r1, #_TIF_SYSCALL_WORK