From patchwork Mon May 4 15:02:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Chartre X-Patchwork-Id: 11526497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA48014C0 for ; Mon, 4 May 2020 15:05:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B6910206D7 for ; Mon, 4 May 2020 15:05:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="a7NeuEIG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6910206D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EB92C8E0040; Mon, 4 May 2020 11:05:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E69268E0024; Mon, 4 May 2020 11:05:12 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D7E328E0040; Mon, 4 May 2020 11:05:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id BDDB98E0024 for ; Mon, 4 May 2020 11:05:12 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8AD75181AC9C6 for ; Mon, 4 May 2020 15:05:12 +0000 (UTC) X-FDA: 76779359664.03.shape06_679df44362561 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,alexandre.chartre@oracle.com,,RULES_HIT:30003:30054:30062:30064:30070:30089,0,RBL:141.146.126.78:@oracle.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: shape06_679df44362561 X-Filterd-Recvd-Size: 6471 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 15:05:11 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 044En9Cd024665; Mon, 4 May 2020 15:04:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2020-01-29; bh=9e36+98PNoowCUHFPdVfiZTA22EJNaHCMNF8Hj+ZaN8=; b=a7NeuEIG5wIhjV7s42Ng1bXBB4WfyQL2JTHR26de2E7aeI+r7+xRe6P1mOq7cQ1g9YRx 0THsLrZIdYzOXzJurJng8KPG9xCd5/ATvZTZzTPDjCiGWXKngKLfSspkGgqcnmaBUlNk UinL0di9n6odc5suJ6dQBkC7FeW22B74Yev8R1IZPeXrZnuPQykxAbyiCKDeH7ghndpU V7vrjvu7ibmv8vOCT1QqJiq3M2ojyyKi42ZR/z6CNXeo7yO3WgmrZNzSbE/6geuc/oOB BEdCLwEeeHV/sCCTj52hIonQ6P7ttbh4Gy4XC17aKRxJ7eh0bcgaKZPS6StcqnDYkQC6 bQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 30s0tm7euh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 May 2020 15:04:59 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 044EmVcH105622; Mon, 4 May 2020 15:04:59 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 30sjjw19k9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 May 2020 15:04:59 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 044F4vNG030629; Mon, 4 May 2020 15:04:57 GMT Received: from linux-1.home.com (/10.175.9.166) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 May 2020 08:04:57 -0700 From: Alexandre Chartre To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: pbonzini@redhat.com, konrad.wilk@oracle.com, jan.setjeeilers@oracle.com, liran.alon@oracle.com, junaids@google.com, graf@amazon.de, rppt@linux.vnet.ibm.com, kuzuno@gmail.com, mgross@linux.intel.com, alexandre.chartre@oracle.com Subject: [RFC v4][PATCH part-3 13/14] asidrv/asicmd: Add options to manage ASI page faults Date: Mon, 4 May 2020 17:02:34 +0200 Message-Id: <20200504150235.12171-14-alexandre.chartre@oracle.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20200504150235.12171-1-alexandre.chartre@oracle.com> References: <20200504150235.12171-1-alexandre.chartre@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9610 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005040123 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9610 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 suspectscore=0 phishscore=0 clxscore=1015 bulkscore=0 mlxlogscore=999 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005040123 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add options to the asicmd CLI to list and clear ASI page faults. Also add an option to enable/disable displaying stack trace on ASI page fault. Signed-off-by: Alexandre Chartre --- drivers/staging/asi/asicmd.c | 68 ++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/drivers/staging/asi/asicmd.c b/drivers/staging/asi/asicmd.c index 849fa09423e6..4d7bb9df0fcc 100644 --- a/drivers/staging/asi/asicmd.c +++ b/drivers/staging/asi/asicmd.c @@ -52,6 +52,10 @@ static void usage(void) printf("\n"); printf("Commands:\n"); printf(" all - run all tests\n"); + printf(" fault - list ASI faults\n"); + printf(" fltclr - clear ASI faults\n"); + printf(" stkon - show stack on ASI fault\n"); + printf(" stkoff - do not show stack on ASI fault\n"); printf("\n"); printf("Tests:\n"); for (i = 0; i < TEST_LIST_SIZE; i++) @@ -91,10 +95,45 @@ static void asidrv_run_test(int fd, struct asidrv_test *test) printf("TEST OK\n"); } +static int asidrv_fault_list(int fd) +{ + struct asidrv_fault_list *flist; + int i, rv; + + flist = malloc(sizeof(*flist) + + sizeof(struct asidrv_fault) * 10); + if (!flist) { + perror("malloc flist"); + return -1; + } + + flist->length = 10; + rv = ioctl(fd, ASIDRV_IOCTL_LIST_FAULT, flist); + if (rv < 0) { + perror("ioctl list fault"); + return -1; + } + + if (!flist->length) { + printf("ASI has no fault\n"); + return 0; + } + + printf("%-18s %5s %s\n", "ADDRESS", "COUNT", "SYMBOL"); + for (i = 0; i < flist->length && i < 10; i++) { + printf("%#18llx %5u %s\n", + flist->fault[i].addr, + flist->fault[i].count, + flist->fault[i].symbol); + } + + return 0; +} + int main(int argc, char *argv[]) { bool run_all, run; - int i, j, fd; + int i, j, fd, err; char *test; if (argc <= 1) { @@ -111,10 +150,33 @@ int main(int argc, char *argv[]) for (i = 1; i < argc; i++) { test = argv[i]; - if (!strcmp(test, "all")) + if (!strcmp(test, "fault")) { + asidrv_fault_list(fd); + continue; + + } else if (!strcmp(test, "fltclr")) { + err = ioctl(fd, ASIDRV_IOCTL_CLEAR_FAULT); + if (err) + perror("ioctl clear fault"); + continue; + + } else if (!strcmp(test, "stkon")) { + err = ioctl(fd, ASIDRV_IOCTL_LOG_FAULT_STACK, true); + if (err) + perror("ioctl log fault stack"); + continue; + + } else if (!strcmp(test, "stkoff")) { + err = ioctl(fd, ASIDRV_IOCTL_LOG_FAULT_STACK, false); + if (err) + perror("ioctl log fault sstack"); + continue; + + } else if (!strcmp(test, "all")) { run_all = true; - else + } else { run_all = false; + } run = false; for (j = 0; j < TEST_LIST_SIZE; j++) {