From patchwork Tue Aug 11 14:04:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Rothwell X-Patchwork-Id: 1343331 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BQvwh3VJPz9sRN for ; Wed, 12 Aug 2020 00:14:44 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=kpGr4zXq; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BQvwg4hn2zDqJc for ; Wed, 12 Aug 2020 00:14:43 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BQvjP5RZXzDqKL for ; Wed, 12 Aug 2020 00:04:57 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=kpGr4zXq; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BQvjL1w4qz9sTW; Wed, 12 Aug 2020 00:04:54 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1597154694; bh=F39woJCZMBkygpxOek1ThAwjDi+p7mNCpABduvHY+/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kpGr4zXqojSoiUiNx8PRmmspoGM8JN6V/rQ5W+dSOKvef/9bYarucQtUvFzWo+02p gwQwaAAE3e1woxO4S1Nf4aGEnoJjskI497gY83GVLqDyockyt9WF4rJLAijNWQTp0P RjaYex6ofLro1YT0Cbej1ispcL+6m5gAss0kDr6sN1WRJFzqkW5FhXf7UscHB815MR nu6ci6sGTfeF8Av6v94R+GAGIaSgN802Wtk7le0kn+LiEm+cvbPwJHa2gVxfOQMA7a xxwST52S5e0dgOOtRILAthwhyCzYJ16vf0H1h5fhvLUyVtofEzhJlJww/CHzdFV+Z7 qobO1XMEo/Qpg== From: Stephen Rothwell To: Michael Ellerman Subject: [PATCH 1/7] powerpc: unrel_branch_check.sh: fix shellcheck complaints Date: Wed, 12 Aug 2020 00:04:28 +1000 Message-Id: <20200811140435.20957-2-sfr@canb.auug.org.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200811140435.20957-1-sfr@canb.auug.org.au> References: <20200811140435.20957-1-sfr@canb.auug.org.au> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux PowerPC List , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" No functional change Cc: Nicholas Piggin Signed-off-by: Stephen Rothwell --- arch/powerpc/tools/unrel_branch_check.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/tools/unrel_branch_check.sh b/arch/powerpc/tools/unrel_branch_check.sh index 6e6a30aea3ed..4c1e04ba5081 100755 --- a/arch/powerpc/tools/unrel_branch_check.sh +++ b/arch/powerpc/tools/unrel_branch_check.sh @@ -1,3 +1,4 @@ +#!/bin/bash # Copyright © 2016 IBM Corporation # # This program is free software; you can redistribute it and/or @@ -26,7 +27,7 @@ awk '{print $1}' BRANCHES=$( $objdump -R "$vmlinux" -D --start-address=0xc000000000000000 \ - --stop-address=${end_intr} | + --stop-address="$end_intr" | grep -e "^c[0-9a-f]*:[[:space:]]*\([0-9a-f][0-9a-f][[:space:]]\)\{4\}[[:space:]]*b" | grep -v '\<__start_initialization_multiplatform>' | grep -v -e 'b.\?.\?ctr' | @@ -40,12 +41,12 @@ awk '{ print $1 ":" $6 ":0x" $7 ":" $8 " "}' for tuple in $BRANCHES do - from=`echo $tuple | cut -d':' -f1` - branch=`echo $tuple | cut -d':' -f2` - to=`echo $tuple | cut -d':' -f3 | sed 's/cr[0-7],//'` - sym=`echo $tuple | cut -d':' -f4` + from=$(echo "$tuple" | cut -d':' -f1) + branch=$(echo "$tuple" | cut -d':' -f2) + to=$(echo "$tuple" | cut -d':' -f3 | sed 's/cr[0-7],//') + sym=$(echo "$tuple" | cut -d':' -f4) - if (( $to > $end_intr )) + if (( to > end_intr )) then if [ -z "$bad_branches" ]; then echo "WARNING: Unrelocated relative branches" From patchwork Tue Aug 11 14:04:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Rothwell X-Patchwork-Id: 1343333 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BQw0j3b25z9sRN for ; Wed, 12 Aug 2020 00:18:13 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=cQHftowC; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BQw0j0nw0zDqQx for ; Wed, 12 Aug 2020 00:18:13 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BQvjR3ZJMzDqMm for ; Wed, 12 Aug 2020 00:04:59 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=cQHftowC; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BQvjQ23Hzz9sVB; Wed, 12 Aug 2020 00:04:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1597154698; bh=cuPV6ghQz9euWNmis6qEkUpmOpmkGsAFncHAJh6hUs0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cQHftowC3ZDyxl6GhZBsL0zVwNFuh6aZwzYtzIVN/JxEJF1puMO2AcMVvFSeMJe0c 0yq8gYc+CmQqurv+PpY1vml3w65BzqXi8YMVly2CWBfn8R9damiPBE+HbjJ2bmkJTu NbkIBklM3F4KJMo0x/EAFFYnWdS5kCYJ6+ERHygGbcSEPdAkCILgGOyExM+N8HZjy6 UHLFr1REK78zTTujjbmUBLhtGRCFwtCDU/nZosmMAixIADaF+rCdFT3ENu0S8VCRmz E+Mr3E7R95zaO6R3Q1fndCZkK/K8FJPX3xZwx2sQpVVpCoXfuss5X3CcJn/7HyVOO2 ZCTlwUKdxdwXw== From: Stephen Rothwell To: Michael Ellerman Subject: [PATCH 2/7] powerpc: unrel_branch_check.sh: simplify and combine some executions Date: Wed, 12 Aug 2020 00:04:29 +1000 Message-Id: <20200811140435.20957-3-sfr@canb.auug.org.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200811140435.20957-1-sfr@canb.auug.org.au> References: <20200811140435.20957-1-sfr@canb.auug.org.au> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux PowerPC List , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Also some minor style changes. There should still be no change in behaviour. Cc: Nicholas Piggin Signed-off-by: Stephen Rothwell --- arch/powerpc/tools/unrel_branch_check.sh | 25 +++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/tools/unrel_branch_check.sh b/arch/powerpc/tools/unrel_branch_check.sh index 4c1e04ba5081..d735e3875b5e 100755 --- a/arch/powerpc/tools/unrel_branch_check.sh +++ b/arch/powerpc/tools/unrel_branch_check.sh @@ -17,37 +17,34 @@ objdump="$1" vmlinux="$2" #__end_interrupts should be located within the first 64K +kstart=0xc000000000000000 +printf -v kend '0x%x' $(( kstart + 0x10000 )) end_intr=0x$( -$objdump -R "$vmlinux" -d --start-address=0xc000000000000000 \ - --stop-address=0xc000000000010000 | -grep '\<__end_interrupts>:' | -awk '{print $1}' +$objdump -R -d --start-address="$kstart" --stop-address="$kend" "$vmlinux" | +awk '$2 == "<__end_interrupts>:" { print $1 }' ) BRANCHES=$( -$objdump -R "$vmlinux" -D --start-address=0xc000000000000000 \ - --stop-address="$end_intr" | +$objdump -R -D --start-address="$kstart" --stop-address="$end_intr" "$vmlinux" | grep -e "^c[0-9a-f]*:[[:space:]]*\([0-9a-f][0-9a-f][[:space:]]\)\{4\}[[:space:]]*b" | -grep -v '\<__start_initialization_multiplatform>' | -grep -v -e 'b.\?.\?ctr' | -grep -v -e 'b.\?.\?lr' | -sed -e 's/\bbt.\?[[:space:]]*[[:digit:]][[:digit:]]*,/beq/' \ +sed -e '/\<__start_initialization_multiplatform>/d' \ + -e '/b.\?.\?ctr/d' \ + -e '/b.\?.\?lr/d' \ + -e 's/\bbt.\?[[:space:]]*[[:digit:]][[:digit:]]*,/beq/' \ -e 's/\bbf.\?[[:space:]]*[[:digit:]][[:digit:]]*,/bne/' \ -e 's/[[:space:]]0x/ /' \ -e 's/://' | awk '{ print $1 ":" $6 ":0x" $7 ":" $8 " "}' ) -for tuple in $BRANCHES -do +for tuple in $BRANCHES; do from=$(echo "$tuple" | cut -d':' -f1) branch=$(echo "$tuple" | cut -d':' -f2) to=$(echo "$tuple" | cut -d':' -f3 | sed 's/cr[0-7],//') sym=$(echo "$tuple" | cut -d':' -f4) - if (( to > end_intr )) - then + if (( to > end_intr )); then if [ -z "$bad_branches" ]; then echo "WARNING: Unrelocated relative branches" bad_branches="yes" From patchwork Tue Aug 11 14:04:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Rothwell X-Patchwork-Id: 1343335 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BQw4T4hwJz9sRN for ; Wed, 12 Aug 2020 00:21:29 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=Grmr7jWP; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BQw4S4SYszDqMl for ; Wed, 12 Aug 2020 00:21:28 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BQvjV5f32zDqKL for ; Wed, 12 Aug 2020 00:05:02 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=Grmr7jWP; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BQvjS2l0qz9sVL; Wed, 12 Aug 2020 00:05:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1597154700; bh=JEiCaCfC550qhQNVVm4H2GKmV7e20tndGX+reW9DYDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Grmr7jWPewoJ2wof6IdF8Wn2U4Lci+4zBbFGeW+dVdbMMEwtCRwJbKPgQMSCCLjEW 2M+qkMcJVeJT+Q+2+II4K7+Dsn2+EjoumMF2ZXIIxVulY9LGB6YCPsCs6Gh2JNtA9B uz1YIDdO2/0S1+t0x/BgoR5IUtqPQA/vxOyb6CDbT5Rx26zzVLwec/AbMCtL8VttA9 Tz6GST/JDnnbLO4zWhusFP6gcBlyUE0zmRr3Jfvbz2zk7MsyYVjmS80hipdyHMODTv Z/WCgKoFfae8P3iQn9UAUEvhL1k/ftoUrzB7bndXHzU2bxR3PVqItA+xDvhhGQna1l eF1pWJFzfhkng== From: Stephen Rothwell To: Michael Ellerman Subject: [PATCH 3/7] powerpc: unrel_branch_check.sh: simplify objdump's asm output Date: Wed, 12 Aug 2020 00:04:30 +1000 Message-Id: <20200811140435.20957-4-sfr@canb.auug.org.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200811140435.20957-1-sfr@canb.auug.org.au> References: <20200811140435.20957-1-sfr@canb.auug.org.au> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux PowerPC List , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" We don't use the raw hex instruction dump, so elide it and adjust the following expressions. Also use \s instead of [[:space:]] everywhere. Cc: Nicholas Piggin Signed-off-by: Stephen Rothwell --- arch/powerpc/tools/unrel_branch_check.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/tools/unrel_branch_check.sh b/arch/powerpc/tools/unrel_branch_check.sh index d735e3875b5e..7e936e2cf70d 100755 --- a/arch/powerpc/tools/unrel_branch_check.sh +++ b/arch/powerpc/tools/unrel_branch_check.sh @@ -26,16 +26,16 @@ awk '$2 == "<__end_interrupts>:" { print $1 }' ) BRANCHES=$( -$objdump -R -D --start-address="$kstart" --stop-address="$end_intr" "$vmlinux" | -grep -e "^c[0-9a-f]*:[[:space:]]*\([0-9a-f][0-9a-f][[:space:]]\)\{4\}[[:space:]]*b" | +$objdump -R -D --no-show-raw-insn --start-address="$kstart" --stop-address="$end_intr" "$vmlinux" | +grep -e "^c[0-9a-f]*:\s*b" | sed -e '/\<__start_initialization_multiplatform>/d' \ -e '/b.\?.\?ctr/d' \ -e '/b.\?.\?lr/d' \ - -e 's/\bbt.\?[[:space:]]*[[:digit:]][[:digit:]]*,/beq/' \ - -e 's/\bbf.\?[[:space:]]*[[:digit:]][[:digit:]]*,/bne/' \ - -e 's/[[:space:]]0x/ /' \ + -e 's/\bbt.\?\s*[[:digit:]][[:digit:]]*,/beq/' \ + -e 's/\bbf.\?\s*[[:digit:]][[:digit:]]*,/bne/' \ + -e 's/\s0x/ /' \ -e 's/://' | -awk '{ print $1 ":" $6 ":0x" $7 ":" $8 " "}' +awk '{ print $1 ":" $2 ":0x" $3 ":" $4 " "}' ) for tuple in $BRANCHES; do From patchwork Tue Aug 11 14:04:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Rothwell X-Patchwork-Id: 1343336 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BQw860S0qz9sTR for ; Wed, 12 Aug 2020 00:24:38 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=iUtJ4RJx; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BQw8565nxzDqRG for ; Wed, 12 Aug 2020 00:24:37 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BQvjb5ZQWzDqMm for ; Wed, 12 Aug 2020 00:05:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=iUtJ4RJx; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BQvjW73BGz9sVM; Wed, 12 Aug 2020 00:05:03 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1597154704; bh=9EKeGXcQiDn7VXvqw3APGDD4eXjF9RC6OJsE+q+2MWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iUtJ4RJxyMIeLsFxNlHwv37db+/Rt7K49575NUnmEGQ4LafzmcDyPJpd8Zh8pqv5x vD1ATKL1r7x4egBVFhDRmny+YVujKOlp+Jqmmg4EepozU2/V4qeSkDR8/wvpssIX/L 5I0vp+PGE5cDLzj1sp+Js6ekmQnwINtCwukPTPT4iqE6NYRtzE9cYlfzrUx8tzCIay 0k/xrdCqiK1yDIsHLs+SZU8FaUFX5ymsvo7SJEuLh6rMo1Te9uG6Mx3m5vksDlG5sG 74vMQ33mL7K6mg7BAbqKQcRyC//xnsH2rcC902HAfbjvuuo0BvdjFJfJwIqN+7o6cP SbWGcx6yVytKQ== From: Stephen Rothwell To: Michael Ellerman Subject: [PATCH 4/7] powerpc: unrel_branch_check.sh: convert grep | sed | awk to just sed Date: Wed, 12 Aug 2020 00:04:31 +1000 Message-Id: <20200811140435.20957-5-sfr@canb.auug.org.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200811140435.20957-1-sfr@canb.auug.org.au> References: <20200811140435.20957-1-sfr@canb.auug.org.au> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux PowerPC List , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Also start using sed -E and make all the separate expressions into a single one with comments. Pull the stripping of condition registers back into the sed command. Cc: Nicholas Piggin Signed-off-by: Stephen Rothwell --- arch/powerpc/tools/unrel_branch_check.sh | 30 ++++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/tools/unrel_branch_check.sh b/arch/powerpc/tools/unrel_branch_check.sh index 7e936e2cf70d..dc82289b2252 100755 --- a/arch/powerpc/tools/unrel_branch_check.sh +++ b/arch/powerpc/tools/unrel_branch_check.sh @@ -27,21 +27,31 @@ awk '$2 == "<__end_interrupts>:" { print $1 }' BRANCHES=$( $objdump -R -D --no-show-raw-insn --start-address="$kstart" --stop-address="$end_intr" "$vmlinux" | -grep -e "^c[0-9a-f]*:\s*b" | -sed -e '/\<__start_initialization_multiplatform>/d' \ - -e '/b.\?.\?ctr/d' \ - -e '/b.\?.\?lr/d' \ - -e 's/\bbt.\?\s*[[:digit:]][[:digit:]]*,/beq/' \ - -e 's/\bbf.\?\s*[[:digit:]][[:digit:]]*,/bne/' \ - -e 's/\s0x/ /' \ - -e 's/://' | -awk '{ print $1 ":" $2 ":0x" $3 ":" $4 " "}' +sed -E -n ' +# match lines that start with a kernel address +/^c[0-9a-f]*:\s*b/ { + # drop a target that we do not care about + /\<__start_initialization_multiplatform>/d + # drop branches via ctr or lr + /\ end_intr )); then From patchwork Tue Aug 11 14:04:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Rothwell X-Patchwork-Id: 1343340 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BQwCf4b33z9sRN for ; Wed, 12 Aug 2020 00:27:42 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=kSTtjXO3; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BQwCd47dBzDqS8 for ; Wed, 12 Aug 2020 00:27:41 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BQvjh2hXZzDqMm for ; Wed, 12 Aug 2020 00:05:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=kSTtjXO3; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BQvjc1fHYz9sTd; Wed, 12 Aug 2020 00:05:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1597154708; bh=Uc1DFmj6GDVlR0S2M6HTMamhLfv5jYMemm15PEIauk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kSTtjXO3FoiKxtQvLOkHcYdNtiIS6prr+GFclsMrf79a6P5W0OeeULiGKlaod5GA8 7li3Po61vMaKyhNmI4RzJUju3982Fx8zQI/JtQLTo3tRsPY0wKvKZvGHuJEk8PyobC RJ4X/asVsvByoHtZNhh6XnfGKwazPHQxKah9VOHDCq7ZWfEERn3ha9RCvZDJTTPsiD XszFnAzRhuOb0H2tBy7NYWd4tGs+fsUPaN3UzM23VrHXYNhXZQwV5BqxDgQDrpN6cq vqn589SAuUDVuagY7XG6KU2Z/ZhGgj1b/HjDBqlsxT8Bgc3HEmFHngntoYKfphtu3s fl9oQXmo6m9Vg== From: Stephen Rothwell To: Michael Ellerman Subject: [PATCH 5/7] powerpc: unrel_branch_check.sh: simplify and tidy up the final loop Date: Wed, 12 Aug 2020 00:04:32 +1000 Message-Id: <20200811140435.20957-6-sfr@canb.auug.org.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200811140435.20957-1-sfr@canb.auug.org.au> References: <20200811140435.20957-1-sfr@canb.auug.org.au> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux PowerPC List , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Cc: Nicholas Piggin Signed-off-by: Stephen Rothwell --- arch/powerpc/tools/unrel_branch_check.sh | 26 +++++++++--------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/tools/unrel_branch_check.sh b/arch/powerpc/tools/unrel_branch_check.sh index dc82289b2252..54ebd05615d4 100755 --- a/arch/powerpc/tools/unrel_branch_check.sh +++ b/arch/powerpc/tools/unrel_branch_check.sh @@ -25,7 +25,6 @@ $objdump -R -d --start-address="$kstart" --stop-address="$kend" "$vmlinux" | awk '$2 == "<__end_interrupts>:" { print $1 }' ) -BRANCHES=$( $objdump -R -D --no-show-raw-insn --start-address="$kstart" --stop-address="$end_intr" "$vmlinux" | sed -E -n ' # match lines that start with a kernel address @@ -45,24 +44,19 @@ sed -E -n ' # strip out condition registers s/:0xcr[0-7],/:0x/ p -}' -) - -for tuple in $BRANCHES; do - from=$(echo "$tuple" | cut -d':' -f1) - branch=$(echo "$tuple" | cut -d':' -f2) - to=$(echo "$tuple" | cut -d':' -f3) - sym=$(echo "$tuple" | cut -d':' -f4) +}' | { +all_good=true +while IFS=: read -r from branch to sym; do if (( to > end_intr )); then - if [ -z "$bad_branches" ]; then - echo "WARNING: Unrelocated relative branches" - bad_branches="yes" + if $all_good; then + printf '%s\n' 'WARNING: Unrelocated relative branches' + all_good=false fi - echo "$from $branch-> $to $sym" + printf '%s %s-> %s %s\n' "$from" "$branch" "$to" "$sym" fi done -if [ -z "$bad_branches" ]; then - exit 0 -fi +$all_good + +} From patchwork Tue Aug 11 14:04:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Rothwell X-Patchwork-Id: 1343345 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BQwJW4zPHz9sTv for ; Wed, 12 Aug 2020 00:31:55 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=FRFFB5+H; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BQwJV1m7fzDqJc for ; Wed, 12 Aug 2020 00:31:54 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BQvjj5D7bzDqPW for ; Wed, 12 Aug 2020 00:05:13 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=FRFFB5+H; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BQvjf6Ncmz9sTq; Wed, 12 Aug 2020 00:05:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1597154711; bh=IWg9J4dzmIU629G1TFBY3rxGgkOp982GZz/P7rTZ6/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRFFB5+HkSbwW+C4hJBgR8dQnrx0LAa9pXRkAFx+T+m8clXSojPEV727BYjf+3AKz zo2OedWLIO45SPtrRp+KJwTOyOt0XYAOa0nnKiS0/wutooQBbSjlrvDeWGUmhrm8Rp pvRoxmL8bZju2wEVhHN4MpJzuGJikgjeFw150hxHEZ+vQX8XjoHw7bMk4lb/rspJTi /BfJIMByfuZEuqvd30HLc+ClCCETHJz23/HgAxgcggoLu67TzOI+iFXImmzJvT51uz 4eNXdVvsnyfSDHluRdQij1kOQX8p/Z5RQbaSQOSHrBQyAHFpVfJ7o/5HiIaoub4Ejj q6A3ENvRMxNdg== From: Stephen Rothwell To: Michael Ellerman Subject: [PATCH 6/7] powerpc: unrel_branch_check.sh: fix up the file header Date: Wed, 12 Aug 2020 00:04:33 +1000 Message-Id: <20200811140435.20957-7-sfr@canb.auug.org.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200811140435.20957-1-sfr@canb.auug.org.au> References: <20200811140435.20957-1-sfr@canb.auug.org.au> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux PowerPC List , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Cc: Nicholas Piggin Signed-off-by: Stephen Rothwell --- arch/powerpc/tools/unrel_branch_check.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/tools/unrel_branch_check.sh b/arch/powerpc/tools/unrel_branch_check.sh index 54ebd05615d4..4489f16a443c 100755 --- a/arch/powerpc/tools/unrel_branch_check.sh +++ b/arch/powerpc/tools/unrel_branch_check.sh @@ -1,16 +1,9 @@ #!/bin/bash -# Copyright © 2016 IBM Corporation +# SPDX-License-Identifier: GPL-2.0+ +# Copyright © 2016,2020 IBM Corporation # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version -# 2 of the License, or (at your option) any later version. -# -# This script checks the relocations of a vmlinux for "suspicious" -# branches from unrelocated code (head_64.S code). - -# Turn this on if you want more debug output: -# set -x +# This script checks the unrelocated code of a vmlinux for "suspicious" +# branches to relocated code (head_64.S code). # Have Kbuild supply the path to objdump so we handle cross compilation. objdump="$1" From patchwork Tue Aug 11 14:04:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Rothwell X-Patchwork-Id: 1343347 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BQwNG5c7Nz9sRN for ; Wed, 12 Aug 2020 00:35:10 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=EOzWAm42; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BQwNG4ZlRzDqST for ; Wed, 12 Aug 2020 00:35:10 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BQvjk4wmczDqMm for ; Wed, 12 Aug 2020 00:05:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.a=rsa-sha256 header.s=201702 header.b=EOzWAm42; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BQvjj5BQ7z9sVP; Wed, 12 Aug 2020 00:05:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1597154713; bh=iSEKg+87jjDteWhaJ+qL8pbW2TiMt/xPx1qjGqylh1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EOzWAm42H4Zb8ogM3UfxNkjVXIkvl1oQaTcOt0kA2tYH60ufaO7yoPfy73rGokQCI yUPVDMITE0N49VGchPR8mti9LmO/wV9r7yYFTypboFc0vvMtzwT061cwnJHTUe5ikC p7XddWjjYY8ihkbdL7wOHwwn/1Nh7G+Rv1mU/diYA4qyFR2/B9XFbo6ZUsrLS8dwGq 9e/X++K1IxiZA5oSRf4wZApsMUAkB/UaX2GdKzaO7R39uYovkehWulVhrisqgPKlwh TmyJH7hpSAH1skBYhqkzIUfsbQC9zlaI6ew7EFQR+I9LRGVnm1DihBS/q7pvGx1rcm hbRADrgh55wJw== From: Stephen Rothwell To: Michael Ellerman Subject: [PATCH 7/7] powerpc: unrel_branch_check.sh: exit silently for early errors Date: Wed, 12 Aug 2020 00:04:34 +1000 Message-Id: <20200811140435.20957-8-sfr@canb.auug.org.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200811140435.20957-1-sfr@canb.auug.org.au> References: <20200811140435.20957-1-sfr@canb.auug.org.au> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux PowerPC List , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" If we can't find the address of __end_interrupts, then we still exit successfully as that is the current behaviour. Cc: Nicholas Piggin Signed-off-by: Stephen Rothwell --- arch/powerpc/tools/unrel_branch_check.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/tools/unrel_branch_check.sh b/arch/powerpc/tools/unrel_branch_check.sh index 4489f16a443c..70da90270c78 100755 --- a/arch/powerpc/tools/unrel_branch_check.sh +++ b/arch/powerpc/tools/unrel_branch_check.sh @@ -14,9 +14,12 @@ kstart=0xc000000000000000 printf -v kend '0x%x' $(( kstart + 0x10000 )) end_intr=0x$( -$objdump -R -d --start-address="$kstart" --stop-address="$kend" "$vmlinux" | +$objdump -R -d --start-address="$kstart" --stop-address="$kend" "$vmlinux" 2>/dev/null | awk '$2 == "<__end_interrupts>:" { print $1 }' ) +if [ "$end_intr" = "0x" ]; then + exit 0 +fi $objdump -R -D --no-show-raw-insn --start-address="$kstart" --stop-address="$end_intr" "$vmlinux" | sed -E -n '