From patchwork Tue Oct 10 09:37:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 823759 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.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 3yBBqm2Gmnz9sBW for ; Tue, 10 Oct 2017 20:38:12 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yBBqm17ZzzDr55 for ; Tue, 10 Oct 2017 20:38:12 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) 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 3yBBqg016lzDqlv for ; Tue, 10 Oct 2017 20:38:06 +1100 (AEDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9A9Y8K9092582 for ; Tue, 10 Oct 2017 05:38:04 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dgth9km7h-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 10 Oct 2017 05:38:03 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Oct 2017 10:38:02 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Oct 2017 10:37:59 +0100 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9A9bv3D22216916 for ; Tue, 10 Oct 2017 09:37:59 GMT Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v9A9bod0021471 for ; Tue, 10 Oct 2017 20:37:50 +1100 Received: from hegdevasant.in.ibm.com ([9.199.177.253]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v9A9bmq7021439; Tue, 10 Oct 2017 20:37:49 +1100 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 10 Oct 2017 15:07:45 +0530 X-Mailer: git-send-email 2.9.3 X-TM-AS-MML: disable x-cbid: 17101009-0016-0000-0000-000004F4419C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101009-0017-0000-0000-0000282F46C6 Message-Id: <20171010093748.26927-1-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-10_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710100134 Subject: [Skiboot] [PATCH v2 1/4] FSP/CONSOLE: Do not associate unavailable console X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Presently OPAL sends associate/unassociate MBOX command for all FSP serial console (like below OPAL message). We have to check console is available or not before sending this message. OPAL log: ------- [ 5013.227994012,7] FSP: Reassociating HVSI console 1 [ 5013.227997540,7] FSP: Reassociating HVSI console 2 Signed-off-by: Vasant Hegde Acked-by: Ananth N Mavinakayanahalli --- hw/fsp/fsp-console.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c index a855133..8ea4c16 100644 --- a/hw/fsp/fsp-console.c +++ b/hw/fsp/fsp-console.c @@ -92,6 +92,9 @@ static void fsp_console_reinit(void) for (i = 0; i < MAX_SERIAL; i++) { struct fsp_serial *fs = &fsp_serials[i]; + if (!fs->available) + continue; + if (fs->rsrc_id == 0xffff) continue; prlog(PR_DEBUG, "FSP: Reassociating HVSI console %d\n", i); @@ -903,6 +906,10 @@ static void reopen_all_hvsi(void) for (i = 0; i < MAX_SERIAL; i++) { struct fsp_serial *fs = &fsp_serials[i]; + + if (!fs->available) + continue; + if (fs->rsrc_id == 0xffff) continue; prlog(PR_NOTICE, "FSP: Deassociating HVSI console %d\n", i); @@ -911,6 +918,10 @@ static void reopen_all_hvsi(void) } for (i = 0; i < MAX_SERIAL; i++) { struct fsp_serial *fs = &fsp_serials[i]; + + if (!fs->available) + continue; + if (fs->rsrc_id == 0xffff) continue; prlog(PR_NOTICE, "FSP: Reassociating HVSI console %d\n", i); From patchwork Tue Oct 10 09:37:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 823760 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.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 3yBBr60hyWz9sBW for ; Tue, 10 Oct 2017 20:38:30 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yBBr56dD3zDr69 for ; Tue, 10 Oct 2017 20:38:29 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) 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 3yBBqj29g6zDqlv for ; Tue, 10 Oct 2017 20:38:09 +1100 (AEDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9A9Y7Vh009281 for ; Tue, 10 Oct 2017 05:38:06 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dgt5qmwhc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 10 Oct 2017 05:38:06 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Oct 2017 10:38:03 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Oct 2017 10:38:01 +0100 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9A9bxE123199876 for ; Tue, 10 Oct 2017 09:38:01 GMT Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v9A9bqsh021519 for ; Tue, 10 Oct 2017 20:37:52 +1100 Received: from hegdevasant.in.ibm.com ([9.199.177.253]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v9A9bmq8021439; Tue, 10 Oct 2017 20:37:51 +1100 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 10 Oct 2017 15:07:46 +0530 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171010093748.26927-1-hegdevasant@linux.vnet.ibm.com> References: <20171010093748.26927-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17101009-0020-0000-0000-000003BF4158 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101009-0021-0000-0000-00004252571E Message-Id: <20171010093748.26927-2-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-10_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710100134 Subject: [Skiboot] [PATCH v2 2/4] FSP/CONSOLE: Close SOL session during R/R X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Presently we are not closing SOL and FW console sessions during R/R. Host will continue to write to SOL buffer during FSP R/R. If there is heavy console write operation happening during FSP R/R (like running `top` command inside console), then at some point console buffer becomes full. fsp_console_write_buffer_space() returns 0 (or less than required space to write data) to host. While one thread is busy writing to console, if some other threads tries to write data to console we may see RCU stalls (like below) in kernel. kernel call trace: ------------------ [ 2082.828363] INFO: rcu_sched detected stalls on CPUs/tasks: { 32} (detected by 16, t=6002 jiffies, g=23154, c=23153, q=254769) [ 2082.828365] Task dump for CPU 32: [ 2082.828368] kworker/32:3 R running task 0 4637 2 0x00000884 [ 2082.828375] Workqueue: events dump_work_fn [ 2082.828376] Call Trace: [ 2082.828382] [c000000f1633fa00] [c00000000013b6b0] console_unlock+0x570/0x600 (unreliable) [ 2082.828384] [c000000f1633fae0] [c00000000013ba34] vprintk_emit+0x2f4/0x5c0 [ 2082.828389] [c000000f1633fb60] [c00000000099e644] printk+0x84/0x98 [ 2082.828391] [c000000f1633fb90] [c0000000000851a8] dump_work_fn+0x238/0x250 [ 2082.828394] [c000000f1633fc60] [c0000000000ecb98] process_one_work+0x198/0x4b0 [ 2082.828396] [c000000f1633fcf0] [c0000000000ed3dc] worker_thread+0x18c/0x5a0 [ 2082.828399] [c000000f1633fd80] [c0000000000f4650] kthread+0x110/0x130 [ 2082.828403] [c000000f1633fe30] [c000000000009674] ret_from_kernel_thread+0x5c/0x68 Hence lets close SOL (and FW console) during FSP R/R. CC: Benjamin Herrenschmidt Signed-off-by: Vasant Hegde --- hw/fsp/fsp-console.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c index 8ea4c16..d1996cc 100644 --- a/hw/fsp/fsp-console.c +++ b/hw/fsp/fsp-console.c @@ -122,9 +122,6 @@ static void fsp_close_consoles(void) if (!fs->available) continue; - if (fs->rsrc_id == 0xffff) /* Get clarity from benh */ - continue; - lock(&fsp_con_lock); if (fs->open) { fs->open = false; From patchwork Tue Oct 10 09:37:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 823761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.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 3yBBrL05pfz9tY3 for ; Tue, 10 Oct 2017 20:38:42 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yBBrK5zzbzDr5x for ; Tue, 10 Oct 2017 20:38:41 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) 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 3yBBqk4qjMzDqlv for ; Tue, 10 Oct 2017 20:38:10 +1100 (AEDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9A9aVjK117656 for ; Tue, 10 Oct 2017 05:38:08 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dgp2s7trq-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 10 Oct 2017 05:38:08 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Oct 2017 10:38:06 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Oct 2017 10:38:03 +0100 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9A9c1bX19791882 for ; Tue, 10 Oct 2017 09:38:02 GMT Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v9A9bsUx021561 for ; Tue, 10 Oct 2017 20:37:54 +1100 Received: from hegdevasant.in.ibm.com ([9.199.177.253]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v9A9bmq9021439; Tue, 10 Oct 2017 20:37:53 +1100 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 10 Oct 2017 15:07:47 +0530 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171010093748.26927-1-hegdevasant@linux.vnet.ibm.com> References: <20171010093748.26927-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17101009-0008-0000-0000-0000049E417E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101009-0009-0000-0000-00001E3045E6 Message-Id: <20171010093748.26927-3-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-10_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710100134 Subject: [Skiboot] [PATCH v2 3/4] FSP/CONSOLE: Fix fsp_console_write_buffer_space() call X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Kernel calls fsp_console_write_buffer_space() to check console buffer space availability. If there is enough buffer space to write data, then kernel will call fsp_console_write() to write actual data. In some extreme corner cases (like one explained in commit c8a7535f) console becomes full and this function returns 0 to kernel (or space available in console buffer < next incoming data size). Kernel will continue retrying until it gets enough space. So we will start seeing RCU stalls. This patch keeps track of previous available space. If previous space is same as current means not enough space in console buffer to write incoming data. It may be due to very high console write operation and slow response from FSP -OR- FSP has stopped processing data (ex: because of ipmi daemon died). At this point we will start timer with timeout of SER_BUFFER_OUT_TIMEOUT (10 secs). If situation is not improved within 10 seconds means something went bad. Lets return OPAL_RESOURCE so that kernel can drop console write and continue. CC: Ananth N Mavinakayanahalli CC: Stewart Smith Signed-off-by: Vasant Hegde --- Changes in v2: - Introduced buffer timeout -Vasant hw/fsp/fsp-console.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c index d1996cc..77eb69f 100644 --- a/hw/fsp/fsp-console.c +++ b/hw/fsp/fsp-console.c @@ -61,11 +61,15 @@ struct fsp_serial { struct fsp_msg *poke_msg; u8 waiting; u64 irq; + u16 out_buf_prev_len; + u64 out_buf_timeout; }; #define SER_BUFFER_SIZE 0x00040000UL #define MAX_SERIAL 4 +#define SER_BUFFER_OUT_TIMEOUT 10 + static struct fsp_serial fsp_serials[MAX_SERIAL]; static bool got_intf_query; static struct lock fsp_con_lock = LOCK_UNLOCKED; @@ -315,6 +319,8 @@ static void fsp_open_vserial(struct fsp_msg *msg) fs->in_buf->flags = fs->out_buf->flags = 0; fs->in_buf->reserved = fs->out_buf->reserved = 0; fs->in_buf->next_out = fs->out_buf->next_out = 0; + fs->out_buf_prev_len = 0; + fs->out_buf_timeout = 0; unlock(&fsp_con_lock); already_open: @@ -655,7 +661,29 @@ static int64_t fsp_console_write_buffer_space(int64_t term_number, % SER_BUF_DATA_SIZE; unlock(&fsp_con_lock); - return OPAL_SUCCESS; + /* Console buffer has enough space to write incoming data */ + if (*length != fs->out_buf_prev_len) { + fs->out_buf_prev_len = *length; + fs->out_buf_timeout = 0; + + return OPAL_SUCCESS; + } + + /* + * Buffer is full, start internal timer. We will continue returning + * SUCCESS until timeout happens, hoping FSP will consume data within + * timeout period. + */ + if (fs->out_buf_timeout == 0) { + fs->out_buf_timeout = mftb() + + secs_to_tb(SER_BUFFER_OUT_TIMEOUT); + } + + if (tb_compare(mftb(), fs->out_buf_timeout) != TB_AAFTERB) + return OPAL_SUCCESS; + + /* Timeout happened. Lets drop incoming data */ + return OPAL_RESOURCE; } static int64_t fsp_console_read(int64_t term_number, int64_t *length, From patchwork Tue Oct 10 09:37:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 823762 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yBBrb1S2Gz9tYB for ; Tue, 10 Oct 2017 20:38:55 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yBBrZ6Qq8zDr55 for ; Tue, 10 Oct 2017 20:38:54 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) 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 3yBBqk6QG8zDr4W for ; Tue, 10 Oct 2017 20:38:10 +1100 (AEDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9A9YGfJ066682 for ; Tue, 10 Oct 2017 05:38:08 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dgpxe5rh8-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 10 Oct 2017 05:38:08 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Oct 2017 10:38:06 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Oct 2017 10:38:05 +0100 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9A9c3kY9830524 for ; Tue, 10 Oct 2017 09:38:04 GMT Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v9A9bthn021604 for ; Tue, 10 Oct 2017 20:37:56 +1100 Received: from hegdevasant.in.ibm.com ([9.199.177.253]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v9A9bmqA021439; Tue, 10 Oct 2017 20:37:54 +1100 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 10 Oct 2017 15:07:48 +0530 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171010093748.26927-1-hegdevasant@linux.vnet.ibm.com> References: <20171010093748.26927-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17101009-0040-0000-0000-0000040141CB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101009-0041-0000-0000-000020A34689 Message-Id: <20171010093748.26927-4-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-10_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710100134 Subject: [Skiboot] [PATCH v2 4/4] FSP/CONSOLE: Limit number of error logging X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Commit c8a7535f (FSP/CONSOLE: Workaround for unresponsive ipmi daemon) added error logging when buffer is full. In some corner cases kernel may call this function multiple time and we may endup logging error again and again. This patch fixes it by generating error log only once. I think this is enough to indicate something went wrong. Also with previous patch, once console buffer is full, OPAL is returning error to payload from fsp_console_write_buffer_space(). So payload will never call fsp_console_write(). Hence move error logging logic to right place. Signed-off-by: Vasant Hegde --- Changes in v2: - Moved code from fsp_console_write() to fsp_console_write_buffer_space() -Vasant hw/fsp/fsp-console.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c index 77eb69f..1646f13 100644 --- a/hw/fsp/fsp-console.c +++ b/hw/fsp/fsp-console.c @@ -629,20 +629,13 @@ static int64_t fsp_console_write(int64_t term_number, int64_t *length, if (written) return OPAL_SUCCESS; - /* - * FSP is still active but not reading console data. Hence - * our console buffer became full. Most likely IPMI daemon - * on FSP is buggy. Lets log error and return OPAL_HARDWARE - * to payload (Linux). - */ - log_simple_error(&e_info(OPAL_RC_CONSOLE_HANG), "FSPCON: Console " - "buffer is full, dropping console data\n"); return OPAL_HARDWARE; } static int64_t fsp_console_write_buffer_space(int64_t term_number, int64_t *length) { + static bool elog_generated = false; struct fsp_serial *fs; struct fsp_serbuf_hdr *sb; @@ -682,6 +675,18 @@ static int64_t fsp_console_write_buffer_space(int64_t term_number, if (tb_compare(mftb(), fs->out_buf_timeout) != TB_AAFTERB) return OPAL_SUCCESS; + /* + * FSP is still active but not reading console data. Hence + * our console buffer became full. Most likely IPMI daemon + * on FSP is buggy. Lets log error and return OPAL_RESOURCE + * to payload (Linux). + */ + if (!elog_generated) { + elog_generated = true; + log_simple_error(&e_info(OPAL_RC_CONSOLE_HANG), "FSPCON: Console " + "buffer is full, dropping console data\n"); + } + /* Timeout happened. Lets drop incoming data */ return OPAL_RESOURCE; }