From patchwork Tue Feb 12 17:47:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 1040749 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.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 (2048 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43zVW06Nktz9s7T for ; Wed, 13 Feb 2019 04:48:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43zVW04ZfczDqN7 for ; Wed, 13 Feb 2019 04:48:12 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=mahesh@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 (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 43zVVl1nx2zDqPK for ; Wed, 13 Feb 2019 04:47:59 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1CHe37u130093 for ; Tue, 12 Feb 2019 12:47:57 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qm0nrxqf2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Feb 2019 12:47:56 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Feb 2019 17:47:54 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 12 Feb 2019 17:47:53 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1CHlqZw47382766 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 12 Feb 2019 17:47:52 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 90D4EAE055 for ; Tue, 12 Feb 2019 17:47:52 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 40DDBAE04D for ; Tue, 12 Feb 2019 17:47:52 +0000 (GMT) Received: from [192.168.124.1] (unknown [9.199.37.208]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Tue, 12 Feb 2019 17:47:52 +0000 (GMT) From: Mahesh J Salgaonkar To: skiboot list Date: Tue, 12 Feb 2019 23:17:51 +0530 In-Reply-To: <154999364965.15699.16433974434315948459.stgit@jupiter> References: <154999364965.15699.16433974434315948459.stgit@jupiter> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19021217-0028-0000-0000-00000347C07E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021217-0029-0000-0000-00002405E167 Message-Id: <154999366409.15699.17713377911201959849.stgit@jupiter> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-12_09:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902120126 Subject: [Skiboot] [PATCH 2/3] opal/hmi: Don't retry TOD recovery if it is already in failed state. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Mahesh Salgaonkar On TOD failure, all cores/thread receives HMI and very first thread that gets interrupt fixes the TOD where as others just resets the respective HMER error bit and return. But when TOD is unrecoverable, all the threads try to do TOD recovery one by one causing threads to spend more time inside opal. Set a global flag when TOD is unrecoverable so that rest of the threads go back to linux immediately avoiding lock ups in system reboot/panic path. Signed-off-by: Mahesh Salgaonkar --- hw/chiptod.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/hw/chiptod.c b/hw/chiptod.c index 97c8b8dd6..668789ebe 100644 --- a/hw/chiptod.c +++ b/hw/chiptod.c @@ -227,6 +227,7 @@ static uint64_t base_tfmr; * take all of them for RAS cases. */ static struct lock chiptod_lock = LOCK_UNLOCKED; +static bool chiptod_unrecoverable; static void _chiptod_cache_tod_regs(int32_t chip_id) { @@ -1234,7 +1235,6 @@ static void chiptod_topology_switch_complete(void) static int chiptod_start_tod(void) { struct proc_chip *chip = NULL; - int rc = 1; /* Do a topology switch if required. */ if (is_topology_switch_required()) { @@ -1257,14 +1257,14 @@ static int chiptod_start_tod(void) if (!chiptod_backup_valid()) { prerror("Backup master is not enabled. " "Can not do a topology switch.\n"); - return 0; + goto error_out; } chiptod_stop_slave_tods(); if (xscom_write(mchip, TOD_TTYPE_1, PPC_BIT(0))) { prerror("XSCOM error switching primary/secondary\n"); - return 0; + goto error_out; } /* Update topology info. */ @@ -1278,7 +1278,7 @@ static int chiptod_start_tod(void) */ if (!chiptod_master_running()) { prerror("TOD is not running on new master.\n"); - return 0; + goto error_out; } /* @@ -1289,7 +1289,7 @@ static int chiptod_start_tod(void) */ if (xscom_writeme(TOD_TTYPE_2, PPC_BIT(0))) { prerror("XSCOM error enabling steppers\n"); - return 0; + goto error_out; } chiptod_topology_switch_complete(); @@ -1314,7 +1314,7 @@ static int chiptod_start_tod(void) /* Switch local chiptod to "Not Set" state */ if (xscom_writeme(TOD_LOAD_TOD_MOD, PPC_BIT(0))) { prerror("XSCOM error sending LOAD_TOD_MOD\n"); - return 0; + goto error_out; } /* @@ -1323,16 +1323,20 @@ static int chiptod_start_tod(void) */ if (xscom_writeme(TOD_TTYPE_3, PPC_BIT(0))) { prerror("XSCOM error sending TTYPE_3\n"); - return 0; + goto error_out; } /* Check if chip TOD is running. */ if (!chiptod_poll_running()) - rc = 0; + goto error_out; /* Restore the ttype4_mode. */ chiptod_set_ttype4_mode(chip, false); - return rc; + return 1; + +error_out: + chiptod_unrecoverable = true; + return 0; } static bool tfmr_recover_tb_errors(uint64_t tfmr) @@ -1533,6 +1537,15 @@ int chiptod_recover_tb_errors(bool *out_resynced) lock(&chiptod_lock); + /* + * Return if TOD is unrecoverable. + * The previous attempt to recover TOD has been failed. + */ + if (chiptod_unrecoverable) { + rc = 0; + goto error_out; + } + /* Get fresh copy of TFMR */ tfmr = mfspr(SPR_TFMR);