From patchwork Wed Mar 7 16:46:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Naveen N. Rao" X-Patchwork-Id: 882682 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zxKQw2kGVz9sdv for ; Thu, 8 Mar 2018 03:51:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zxKQw1S5NzF1pp for ; Thu, 8 Mar 2018 03:51:04 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=naveen.n.rao@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zxKL13WX6zF1nt for ; Thu, 8 Mar 2018 03:46:49 +1100 (AEDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w27GjBj9147155 for ; Wed, 7 Mar 2018 11:46:46 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gjjmrkph4-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 07 Mar 2018 11:46:46 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 7 Mar 2018 16:46:42 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 7 Mar 2018 16:46:39 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w27Gkdi128770458; Wed, 7 Mar 2018 16:46:39 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A3D4E11C04C; Wed, 7 Mar 2018 16:39:24 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 949B111C050; Wed, 7 Mar 2018 16:39:22 +0000 (GMT) Received: from naverao1-tp.ibm.com (unknown [9.79.190.201]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 7 Mar 2018 16:39:22 +0000 (GMT) From: "Naveen N. Rao" To: Benjamin Herrenschmidt , Michael Ellerman , Paul Mackerras , Steven Rostedt Subject: [RFC PATCH 1/1] powerpc/ftrace: Exclude real mode code from Date: Wed, 7 Mar 2018 22:16:19 +0530 X-Mailer: git-send-email 2.16.1 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 x-cbid: 18030716-0008-0000-0000-000004D8FE97 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030716-0009-0000-0000-00001E6C1AEE Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-07_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803070192 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, Anton Blanchard , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" We can't take a trap in most parts of real mode code. Instead of adding the 'notrace' annotation to all C functions that can be invoked from real mode, detect that we are in real mode on ftrace entry and return back. Signed-off-by: Naveen N. Rao --- This RFC only handles -mprofile-kernel to demonstrate the approach being considered. We will need to handle other ftrace entry if we decide to continue down this path. - Naveen arch/powerpc/kernel/trace/ftrace_64_mprofile.S | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S b/arch/powerpc/kernel/trace/ftrace_64_mprofile.S index 3f3e81852422..ecc0e8e38ead 100644 --- a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S +++ b/arch/powerpc/kernel/trace/ftrace_64_mprofile.S @@ -56,6 +56,21 @@ _GLOBAL(ftrace_caller) /* Load special regs for save below */ mfmsr r8 + + /* Only proceed if we are not in real mode and can take interrupts */ + andi. r9, r8, MSR_IR|MSR_DR|MSR_RI + cmpdi r9, MSR_IR|MSR_DR|MSR_RI + beq 1f + mflr r8 + mtctr r8 + REST_GPR(9, r1) + REST_GPR(8, r1) + addi r1, r1, SWITCH_FRAME_SIZE + ld r0, LRSAVE(r1) + mtlr r0 + bctr + +1: mfctr r9 mfxer r10 mfcr r11