Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1242800rwo; Wed, 2 Aug 2023 10:46:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEF3pXg8+b7xKDthSuYco8SfhHROmwnItlUd3or2EPkQx6xF+VoGMzW8t7hGPC96qgmLu1t X-Received: by 2002:a17:906:51ca:b0:99c:56d1:7c71 with SMTP id v10-20020a17090651ca00b0099c56d17c71mr742812ejk.26.1690998382783; Wed, 02 Aug 2023 10:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690998382; cv=none; d=google.com; s=arc-20160816; b=sIU17CR1FtvsrKiyiGRL6i1of4xnGuhMHptiVM9ffs/0jexbjvlGiH2b4cERLh2Vk4 9ldii50t7+hAJjQ+JrFOp+FjZ3O877m12Kh5osCrmaXmBZs4+ffR1cqAsO2IOZIGiZ7y eVKF03zCq8/WEhxaKGXbYNCrODPZIM8+n4SDEWVWE5+id8sG2KhnmBsfAXKu9f9frKGK 10fyvEART99mDedOobAnq+gRtbvvoYXygKRd2zRSGZdk4rBfvxInOYyNmmCGH6JWmhlY hnmudL4rpib+BJOKhTDdrMxnmqC3fwcnsPT3mrgmhCfJrAId24w822NJUQUWS2f5ncLC A/Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Hld1H5Ct29P3BgDvtbzZet1F2/x8docmE26kgCV2OFI=; fh=wcZz8c2cWOhXmFdpqvTvm+8KalrW5IIs1CwPyYTzgHI=; b=Py0YXNTxVl4M/x1LbRk+NRsikSIk4G+O7FWggYaJhFegDqbs52ao0z91i32imv5Qod XM+LJvyeHmLxPx2NG+Tv8Bb9M33USY+GwXkqjwy7+p0+vNmlS85h7DrjPIBjss07kPGt 6+6+qfh2eQXBCKnYXVVXdWNHONMpT3wMen0EOjd+1pRadz4CqLNHQB9wNePCGTXfQpWD N2a9OISibXvRV6fWsUnVSqfL20v500lv6vn7zWh/5AwYK8y3VIY2BovjrV0fxRtHnWtF eknhQFZk/WbcHePf31f0QNRfaCtuUyP6Dy0teKOX9q2FAM2l9nkeaMSoEt0JH+bBlAdu EvjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nlgv+uvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by23-20020a170906a2d700b00993321873fesi7499450ejb.665.2023.08.02.10.45.56; Wed, 02 Aug 2023 10:46:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nlgv+uvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231709AbjHBRSg (ORCPT + 99 others); Wed, 2 Aug 2023 13:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbjHBRS3 (ORCPT ); Wed, 2 Aug 2023 13:18:29 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F112E64; Wed, 2 Aug 2023 10:18:27 -0700 (PDT) Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 372HCodA031066; Wed, 2 Aug 2023 17:18:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : reply-to : references : mime-version : content-type : in-reply-to; s=pp1; bh=Hld1H5Ct29P3BgDvtbzZet1F2/x8docmE26kgCV2OFI=; b=nlgv+uvBvsmq7pbHJQN7y4TsV//pEArTmMY6vVDaYnpQh9Q7JQDjbrmWwEAan9AxcF7Z Vb9Q0+geoSaUM+FLBnZmfFuORBTlxwglvXB0Lop3L7YWZzAOiV91npIKDz98E/yG81ot mSh7zQYBdo8BtkZPgwu/zTIcXj80PvUXkY8VOf4bQztydDI3AxWd840Eu8GcHR51jv8Y y0GhcvKQfYAhHb/PfrREEJI0veh14HXeIsjQ3hHCFSxykg+9MYilX60WpyyOwykOqKDI 2Sc9LZXMfCNitqeJuKpuzt3zvdG1N+kaa+lAFUcAsm9M1Mj3HnSs6VrqwcfMHNq2AXri kA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s7ubgg748-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Aug 2023 17:18:14 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 372HCsi3031240; Wed, 2 Aug 2023 17:18:14 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s7ubgg73j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Aug 2023 17:18:14 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 372G0aoc015471; Wed, 2 Aug 2023 17:18:13 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3s5e3n6cjh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Aug 2023 17:18:12 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 372HI9kf22807098 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Aug 2023 17:18:09 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC45B2004B; Wed, 2 Aug 2023 17:18:09 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0330720049; Wed, 2 Aug 2023 17:18:08 +0000 (GMT) Received: from in.ibm.com (unknown [9.171.36.141]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTPS; Wed, 2 Aug 2023 17:18:07 +0000 (GMT) Date: Wed, 2 Aug 2023 22:48:05 +0530 From: Mahesh J Salgaonkar To: Bjorn Helgaas Cc: Nathan Lynch , Tyrel Datwyler , linux-pci , Linux Kernel , linuxppc-dev , "Oliver O'Halloran" , Bjorn Helgaas Subject: Re: [PATCH v7 2/2] PCI: rpaphp: Error out on busy status from get-sensor-state Message-ID: Reply-To: mahesh@linux.ibm.com References: <169018891453.2762525.13358294392014600391.stgit@jupiter> <20230801213808.GA51837@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230801213808.GA51837@bhelgaas> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: oi1ZHy5CHZHfGTBp25QvCbdES6RcWKeG X-Proofpoint-ORIG-GUID: iSFkRKGGPq8spl_157sD-xFY3icVYu7Q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-02_13,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 phishscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308020151 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-08-01 16:38:08 Tue, Bjorn Helgaas wrote: > On Mon, Jul 24, 2023 at 02:25:19PM +0530, Mahesh Salgaonkar wrote: > > When certain PHB HW failure causes pHyp to recover PHB, it marks the PE > > state as temporarily unavailable until recovery is complete. This also > > triggers an EEH handler in Linux which needs to notify drivers, and perform > > recovery. But before notifying the driver about the PCI error it uses > > get_adapter_state()->get-sensor-state() operation of the hotplug_slot to > > determine if the slot contains a device or not. if the slot is empty, the > > recovery is skipped entirely. > > It's helpful to use the exact function name so it's greppable; I think > get_adapter_status() or rpaphp_get_sensor_state()? > > s/if the slot is empty,/If the slot is empty,/ Sure, will correct it in next revision. > > > However on certain PHB failures, the RTAS call get-sensor-state() returns > > extended busy error (9902) until PHB is recovered by pHyp. Once PHB is > > recovered, the get-sensor-state() returns success with correct presence > > status. The RTAS call interface rtas_get_sensor() loops over the RTAS call > > on extended delay return code (9902) until the return value is either > > success (0) or error (-1). This causes the EEH handler to get stuck for ~6 > > seconds before it could notify that the PCI error has been detected and > > stop any active operations. Hence with running I/O traffic, during this 6 > > seconds, the network driver continues its operation and hits a timeout > > (netdev watchdog). > > > > ------------ > > [52732.244731] DEBUG: ibm_read_slot_reset_state2() > > [52732.244762] DEBUG: ret = 0, rets[0]=5, rets[1]=1, rets[2]=4000, rets[3]=> > > [52732.244798] DEBUG: in eeh_slot_presence_check > > [52732.244804] DEBUG: error state check > > [52732.244807] DEBUG: Is slot hotpluggable > > [52732.244810] DEBUG: hotpluggable ops ? > > [52732.244953] DEBUG: Calling ops->get_adapter_status > > [52732.244958] DEBUG: calling rpaphp_get_sensor_state > > [52736.564262] ------------[ cut here ]------------ > > [52736.564299] NETDEV WATCHDOG: enP64p1s0f3 (tg3): transmit queue 0 timed o> > > [52736.564324] WARNING: CPU: 1442 PID: 0 at net/sched/sch_generic.c:478 dev> > > [...] > > [52736.564505] NIP [c000000000c32368] dev_watchdog+0x438/0x440 > > [52736.564513] LR [c000000000c32364] dev_watchdog+0x434/0x440 > > ------------ > > > > On timeouts, network driver starts dumping debug information to console > > (e.g bnx2 driver calls bnx2x_panic_dump()), and go into recovery path while > > pHyp is still recovering the PHB. As part of recovery, the driver tries to > > reset the device and it keeps failing since every PCI read/write returns > > ff's. And when EEH recovery kicks-in, the driver is unable to recover the > > device. This impacts the ssh connection and leads to the system being > > inaccessible. To get the NIC working again it needs a reboot or re-assign > > the I/O adapter from HMC. > > > > [ 9531.168587] EEH: Beginning: 'slot_reset' > > [ 9531.168601] PCI 0013:01:00.0#10000: EEH: Invoking bnx2x->slot_reset() > > [...] > > [ 9614.110094] bnx2x: [bnx2x_func_stop:9129(enP19p1s0f0)]FUNC_STOP ramrod failed. Running a dry transaction > > [ 9614.110300] bnx2x: [bnx2x_igu_int_disable:902(enP19p1s0f0)]BUG! Proper val not read from IGU! > > [ 9629.178067] bnx2x: [bnx2x_fw_command:3055(enP19p1s0f0)]FW failed to respond! > > [ 9629.178085] bnx2x 0013:01:00.0 enP19p1s0f0: bc 7.10.4 > > [ 9629.178091] bnx2x: [bnx2x_fw_dump_lvl:789(enP19p1s0f0)]Cannot dump MCP info while in PCI error > > [ 9644.241813] bnx2x: [bnx2x_io_slot_reset:14245(enP19p1s0f0)]IO slot reset --> driver unload > > [...] > > [ 9644.241819] PCI 0013:01:00.0#10000: EEH: bnx2x driver reports: 'disconnect' > > [ 9644.241823] PCI 0013:01:00.1#10000: EEH: Invoking bnx2x->slot_reset() > > [ 9644.241827] bnx2x: [bnx2x_io_slot_reset:14229(enP19p1s0f1)]IO slot reset initializing... > > [ 9644.241916] bnx2x 0013:01:00.1: enabling device (0140 -> 0142) > > [ 9644.258604] bnx2x: [bnx2x_io_slot_reset:14245(enP19p1s0f1)]IO slot reset --> driver unload > > [ 9644.258612] PCI 0013:01:00.1#10000: EEH: bnx2x driver reports: 'disconnect' > > [ 9644.258615] EEH: Finished:'slot_reset' with aggregate recovery state:'disconnect' > > [ 9644.258620] EEH: Unable to recover from failure from PHB#13-PE#10000. > > [ 9644.261811] EEH: Beginning: 'error_detected(permanent failure)' > > [...] > > [ 9644.261823] EEH: Finished:'error_detected(permanent failure)' > > > > Hence, it becomes important to inform driver about the PCI error detection > > as early as possible, so that driver is aware of PCI error and waits for > > EEH handler's next action for successful recovery. > > I don't really understand the connection between EEH and > get_adapter_status(), but I guess this probably refers to > arch/powerpc/kernel/eeh_driver.c, not the PCI core aer.c and err.c? Yup, EEH is an I/O error recovery mechanism on powerpc. On error during during I/O operations on the PCI bus, EEH handler makes sure that the error is not due to hotplug remove, before proceeding with recovery. Depending on whether device is present or hot removed, get_adapter_status() returns state as true or false respectively. Only in certain failure cases it returns BUSY error. eeh_event_handler() ->eeh_handle_normal_event() ->eeh_slot_presence_check() ->get_adapter_status(&state) skip recovery if state == false > > > Current implementation uses rtas_get_sensor() API which blocks the slot > > check state until RTAS call returns success. To avoid this, fix the PCI > > hotplug driver (rpaphp) to return an error (-EBUSY) if the slot presence > > state can not be detected immediately while PE is in EEH recovery state. > > Change rpaphp_get_sensor_state() to invoke rtas_call(get-sensor-state) > > directly only if the respective PE is in EEH recovery state, and take > > actions based on RTAS return status. This way EEH handler will not be > > blocked on rpaphp_get_sensor_state() and can immediately notify driver > > about the PCI error and stop any active operations. > > > > In normal cases (non-EEH case) rpaphp_get_sensor_state() will continue to > > invoke rtas_get_sensor() as it was earlier with no change in existing > > behavior. > > > > Signed-off-by: Mahesh Salgaonkar > > Reviewed-by: Nathan Lynch > > Seems like maybe both patches could go via a ppc tree since they seem > very ppc-specific? A couple minor comments below. > > Acked-by: Bjorn Helgaas > > > + * get_adapter_status() can be called by the EEH handler during EEH recovery. > > + * On certain PHB failures, the RTAS call get-seHsor-state() returns extended > > Looks like a typo in "get-seHsor-state"? ouch. Will fix it. > > > +static int __rpaphp_get_sensor_state(struct slot *slot, int *state) > > +{ > > +#ifdef CONFIG_EEH > > Is this #ifdef redundant? It looks like this file is only compiled > if CONFIG_EEH is set: Thansk for pointing this out. I missed this, yes it is redundant. Will remove it. > > config HOTPLUG_PCI_RPA > tristate "RPA PCI Hotplug driver" > depends on PPC_PSERIES && EEH > > obj-$(CONFIG_HOTPLUG_PCI_RPA) += rpaphp.o > > rpaphp-objs := rpaphp_core.o \ > rpaphp_pci.o \ > rpaphp_slot.o Thanks for your review. -Mahesh