Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7791006ybi; Thu, 6 Jun 2019 01:22:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2jvx5nHVSUKs91C+bJQu71VxCMB8rQQkqvPzmVY8AVz+oxAdPpEYrZKcsab8ZZGR1zBPu X-Received: by 2002:a17:90a:2641:: with SMTP id l59mr24080643pje.55.1559809377674; Thu, 06 Jun 2019 01:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559809377; cv=none; d=google.com; s=arc-20160816; b=CDdqnvfFk0Ass3ThQyvcmu7Z/EdVBTqjLaq/5sMDdIAlcYqEwGIXm3v1c4MebSUkB1 M3VjifyOIyiW1yaUG+1v6nnLjqDF5wDyefAba4zWF3tUCw/jFlRnNi/Xtyg41YttEZZF c4VfHG0gKvwbWfNBOAV5G3vhz6Yi7ZeuuBTb+DfGCsT2n9qPTGbDq8c8p/1iNEM/m4I2 bzC4V58CmXDesFcJYrg3AToI9+Jt1RBoZPWObayPcLsoeoFH7ivjYs5R7SrgGhqBT3og N1Pfb5JeljeEJcawqZLq3nqkG24l9U8l73y3ADSAoO4pvQhF1IjLIoU+E+emosUlHmP4 dTTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:user-agent:in-reply-to:references:cc:to:subject:from :date; bh=NzSDGFuh56YzryIhMi4K4fcWqV3ykXPloPWDxxDuvmU=; b=wv+Dx30GVfscdTO26+EV44Cd71d67Okx9KnjkiINX6vasTLbQRlWEKL70bnpkrRCK7 d/OGKilPoEQoQ9nQeSsk7BnSMXcuim6PSqThlYMRFDBfeziAT+ZjkovBMWA4U/J+AjwV CXArRUFys4/PCF2xaFDOxDugOfzPabmqq662Tr90FJeJ7b5+aMvwIcWZU5yXxD5/YK4y OUOJP1BFY77eRRtezsBFE9GmRnEUXfWAi+slIQw/D3uqPxvxeehJ2UkeyrN7Wo3YD9ji JUv/AdZLFfMTbXtORtspWURs04jCwl2vT70kjYcElgAqwEapvQMDG734gLRVwD+brw1U TGYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14si1127326plr.187.2019.06.06.01.22.39; Thu, 06 Jun 2019 01:22:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727109AbfFFIV3 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 6 Jun 2019 04:21:29 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33276 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725267AbfFFIV3 (ORCPT ); Thu, 6 Jun 2019 04:21:29 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x568Idka111736 for ; Thu, 6 Jun 2019 04:21:27 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2sxx14usm7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 06 Jun 2019 04:21:27 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 6 Jun 2019 09:21:25 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 6 Jun 2019 09:21:22 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x568LLRj63045844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 Jun 2019 08:21:21 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B92C6A405B; Thu, 6 Jun 2019 08:21:21 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B507A4054; Thu, 6 Jun 2019 08:21:21 +0000 (GMT) Received: from localhost (unknown [9.122.211.182]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 6 Jun 2019 08:21:21 +0000 (GMT) Date: Thu, 06 Jun 2019 13:51:20 +0530 From: "Naveen N. Rao" Subject: Re: [PATCH] Powerpc/Watchpoint: Restore nvgprs while returning from exception To: mpe@ellerman.id.au, Ravi Bangoria Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, mahesh@linux.vnet.ibm.com, mikey@neuling.org, npiggin@gmail.com, paulus@samba.org References: <20190606072951.32116-1-ravi.bangoria@linux.ibm.com> In-Reply-To: <20190606072951.32116-1-ravi.bangoria@linux.ibm.com> User-Agent: astroid/0.14.0 (https://github.com/astroidmail/astroid) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 x-cbid: 19060608-4275-0000-0000-0000033F4CA3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19060608-4276-0000-0000-0000384F5055 Message-Id: <1559809100.x2v1my2997.naveen@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-06_07:,, 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=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906060061 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ravi Bangoria wrote: > Powerpc hw triggers watchpoint before executing the instruction. > To make trigger-after-execute behavior, kernel emulates the > instruction. If the instruction is 'load something into non- > volatile register', exception handler should restore emulated > register state while returning back, otherwise there will be > register state corruption. Ex, Adding a watchpoint on a list > can corrput the list: > > # cat /proc/kallsyms | grep kthread_create_list > c00000000121c8b8 d kthread_create_list > > Add watchpoint on kthread_create_list->next: > > # perf record -e mem:0xc00000000121c8c0 > > Run some workload such that new kthread gets invoked. Ex, I > just logged out from console: > > list_add corruption. next->prev should be prev (c000000001214e00), \ > but was c00000000121c8b8. (next=c00000000121c8b8). > WARNING: CPU: 59 PID: 309 at lib/list_debug.c:25 __list_add_valid+0xb4/0xc0 > CPU: 59 PID: 309 Comm: kworker/59:0 Kdump: loaded Not tainted 5.1.0-rc7+ #69 > ... > NIP __list_add_valid+0xb4/0xc0 > LR __list_add_valid+0xb0/0xc0 > Call Trace: > __list_add_valid+0xb0/0xc0 (unreliable) > __kthread_create_on_node+0xe0/0x260 > kthread_create_on_node+0x34/0x50 > create_worker+0xe8/0x260 > worker_thread+0x444/0x560 > kthread+0x160/0x1a0 > ret_from_kernel_thread+0x5c/0x70 > > Signed-off-by: Ravi Bangoria > --- > arch/powerpc/kernel/exceptions-64s.S | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Awesome catch - this one has had a glorious run... Fixes: 5aae8a5370802 ("powerpc, hw_breakpoints: Implement hw_breakpoints for 64-bit server processors") Reviewed-by: Naveen N. Rao - Naveen