From patchwork Sun Oct 22 10:06:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 829017 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 3yKZvx14Dsz9sxR for ; Sun, 22 Oct 2017 21:07:25 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oSsHQykt"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yKZvw73MvzDqgT for ; Sun, 22 Oct 2017 21:07:24 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oSsHQykt"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::241; helo=mail-pf0-x241.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oSsHQykt"; dkim-atps=neutral Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yKZvc5qmvzDqgR for ; Sun, 22 Oct 2017 21:07:08 +1100 (AEDT) Received: by mail-pf0-x241.google.com with SMTP id p87so15047339pfj.3 for ; Sun, 22 Oct 2017 03:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Jv9o6OGhLtt+ZK6r9sLCi6oMP1JVFzCCO85Jg3g0heg=; b=oSsHQykt5pVW7OdsGrKv5TMub/aTRiwOBRDDSZRtXLh9pjZhud5ICPvcXi1vF6RuE+ VZVE/jbmGNdTNVSmRye8wiMCObA6pgqd+RVsrEqjHUZgdEz/W8sp9v9TOMaY238NNAYE PTBmftN+Fgb6QfC95DYhnmjrtzJV3qSliYiPObN07k66x7sPIDKegxNp0rp0ZdYpQjvJ N9BMMfh7w5NPV9l3XDFL4o7VBs1xFJh0L3m+bQIdS0SPu+QAHH0Rc4DoYbe+Ejw7ehkR LR7ZfAEEMrUu8F1uXLsHPwl1VGzRZoak4T6gWMgRnML6VfNZy1qNO95X804lmAHcQkJl h4PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Jv9o6OGhLtt+ZK6r9sLCi6oMP1JVFzCCO85Jg3g0heg=; b=YPb7XWR14um/zvZ6MRSNB2XGRflqaTKXd/3jFaQfGWFqikMbOL7nUWCmAZrNvmXH6o ybRugLjDzIF7XUIZcwdJaTddBgHNSWe+euyDEdnyqOGzJ77E/vNBSVNAvkVkcm6qghTe sbbxsDcZlZ/60xu0fCiVulv5z4VxEPEKZcaHtY4tG2mtVgub8oq0mjIfzfp0MhU6bXUG hNs4o57F+Z52M7ZSrf2c0v9tJhg+fA1rIR2Z2JJuICOKSuCayCvi561wl//08Rd1SOP7 eHeW4c/xmZVN0ahgdUovXhqEF3MfjyBiJgwK/p8DxpBuuOF4pGQBZ/vdLGOby5LdafvC s+TA== X-Gm-Message-State: AMCzsaVZJMl1L7//8YKXlNBhs9nj2QubAirugpZT5TpIPss/74VNX9xF NVVaHie3FnGCeMpD+5Jx2LhyPA== X-Google-Smtp-Source: ABhQp+T5sl8CGsmIOCEmUAn0nOMjnJAgeeiOKj05sdZEwTnEPYlf9tNAj/DtqlmpzrpKDU14ea6hmQ== X-Received: by 10.84.164.104 with SMTP id m37mr7855928plg.242.1508666825608; Sun, 22 Oct 2017 03:07:05 -0700 (PDT) Received: from roar.au.ibm.com (59-102-69-156.tpgi.com.au. [59.102.69.156]) by smtp.gmail.com with ESMTPSA id y10sm7692130pfl.186.2017.10.22.03.07.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Oct 2017 03:07:04 -0700 (PDT) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Sun, 22 Oct 2017 20:06:47 +1000 Message-Id: <20171022100648.1919-3-npiggin@gmail.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20171022100648.1919-1-npiggin@gmail.com> References: <20171022100648.1919-1-npiggin@gmail.com> Subject: [Skiboot] [RFC PATCH 2/3] core/lock: improve bust_locks 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" Prevent try_lock from modifying the lock state when bust_locks is set. unlock will not unlock it in that case, so locks will get taken and never released. --- core/lock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/lock.c b/core/lock.c index 916a0241..b5e3323f 100644 --- a/core/lock.c +++ b/core/lock.c @@ -93,6 +93,9 @@ bool try_lock(struct lock *l) { struct cpu_thread *cpu = this_cpu(); + if (bust_locks) + return true; + if (__try_lock(cpu, l)) { if (l->in_con_path) cpu->con_suspend++;