From patchwork Wed Mar 11 12:36:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 448967 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 829C014016B for ; Wed, 11 Mar 2015 23:37:33 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 6956C1A09C3 for ; Wed, 11 Mar 2015 23:37:33 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 7B9A71A0997 for ; Wed, 11 Mar 2015 23:37:29 +1100 (AEDT) Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Mar 2015 22:37:25 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 11 Mar 2015 22:37:23 +1000 Received: from d23relay08.au.ibm.com (d23relay08.au.ibm.com [9.185.71.33]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 50F5F2BB004D for ; Wed, 11 Mar 2015 23:37:23 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t2BCbEao40566978 for ; Wed, 11 Mar 2015 23:37:23 +1100 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 t2BCanF2010487 for ; Wed, 11 Mar 2015 23:36:49 +1100 Received: from localhost.localdomain ([9.124.35.123]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t2BCalGV010330; Wed, 11 Mar 2015 23:36:47 +1100 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 11 Mar 2015 18:06:31 +0530 Message-ID: <20150311123614.10985.5187.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15031112-0021-0000-0000-000000E6056B Subject: [Skiboot] [PATCH 1/2] OPAL: Detect recursive poller entry from same CPU X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 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" Detect recursive opal poller call from same CPU. if it happens then abort(). Signed-off-by: Vasant Hegde --- core/opal.c | 10 ++++++++++ include/cpu.h | 1 + 2 files changed, 11 insertions(+) diff --git a/core/opal.c b/core/opal.c index 6fbbdde..fc0e7a5 100644 --- a/core/opal.c +++ b/core/opal.c @@ -285,6 +285,13 @@ void opal_run_pollers(void) struct opal_poll_entry *poll_ent; static int pollers_with_lock_warnings = 0; + /* Don't re-enter on this CPU */ + if (this_cpu()->in_poller) { + prlog(PR_ERR, "OPAL: Poller recursion detected.\n"); + abort(); + } + this_cpu()->in_poller = true; + if (this_cpu()->lock_depth && pollers_with_lock_warnings < 64) { prlog(PR_ERR, "Running pollers with lock held !\n"); backtrace(); @@ -301,6 +308,9 @@ void opal_run_pollers(void) list_for_each(&opal_pollers, poll_ent, link) poll_ent->poller(poll_ent->data); + /* Disable poller flag */ + this_cpu()->in_poller = false; + /* On debug builds, print max stack usage */ check_stacks(); } diff --git a/include/cpu.h b/include/cpu.h index 54e1b37..bb516f2 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -58,6 +58,7 @@ struct cpu_thread { uint32_t con_suspend; bool con_need_flush; bool in_mcount; + bool in_poller; uint32_t hbrt_spec_wakeup; /* primary only */ uint64_t save_l2_fir_action1; uint64_t current_token;