Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp540936img; Mon, 18 Mar 2019 08:43:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXSrqzsELiWN0B7BOOVofSxst9+2ovK2dgITzGUTClLvALfA7n42LuZm1PlQCqZz2mrY/u X-Received: by 2002:aa7:8186:: with SMTP id g6mr19835111pfi.138.1552923786751; Mon, 18 Mar 2019 08:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552923786; cv=none; d=google.com; s=arc-20160816; b=dFReEcoligUuL/p9YSVfqccDICzZvrSVRcqjtKDXwh7UI63wpSKpV3V0i5hf2CKJaR ycyZNU51A2+BIeCE31GydvjfkwbZKSU/nAQbws/7KNffFmY55VTp+Xu2zIqjauo+hlfd WLL1jNRcAQWf24rq41GFSU7vB77+C47qtEdCHtLAS6bcchyi/TI9Unc4fHuwXfEJIUhu vk0Y9r8/l7nwgZt0HuNpzEV1qtpPJXU23i4mctkyhbsEich95tchSRm7YyHliCQJZCQs 0kvYzt6z5tl2iBsocOk2fWNP0sNdPMerU+JMpu+Jw1am47eDSF9LnLZ5HCqcPzOHVLVC whfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=ooNmMn2fOuE+lecLRch8pkBk7lzuBghGo9NoZBqRTLI=; b=At9OWmeAc/oA+gieRLnWqPY+Q1rNyKOVmLoU9zTXQsmQR/HOwkhNM6yVPUNIVV3SI9 jTLnbiJ6YqkoG0xLWTznE9Ja8n/UMm6dNJBv6RNMnnyxnbuLx82KNDaJHc7uB3ixVc2J g4GFwVhPGx0IMnO50JONbL9k1Jtgso3fplI2Cbp+0hRRDYMOSIW5GUronsPQwJsbAnb7 RIUa5X5DS+NflTnMn9bzXLAR3uxUvGwSrgfGmeGG8evr1m4fwG9HILluGBMwBh49D9kv qbgqP/zwbaDVOrXxNBvLf2o8V/3gCmDpumeiRNWOGSrY6YwHT5PprJfDMVgOjhZTBk6N 8Oug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digitalocean.com header.s=google header.b=g3pC5T8M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn8si9612180plb.321.2019.03.18.08.42.51; Mon, 18 Mar 2019 08:43:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@digitalocean.com header.s=google header.b=g3pC5T8M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727457AbfCRPmK (ORCPT + 99 others); Mon, 18 Mar 2019 11:42:10 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:35114 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727017AbfCRPmK (ORCPT ); Mon, 18 Mar 2019 11:42:10 -0400 Received: by mail-qt1-f194.google.com with SMTP id h39so18458710qte.2 for ; Mon, 18 Mar 2019 08:42:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digitalocean.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ooNmMn2fOuE+lecLRch8pkBk7lzuBghGo9NoZBqRTLI=; b=g3pC5T8MNy9cNdZu4u6GusZ6CHq22XglrW/V0414vQSRLbD7WAHSzj+zRbfo2yRAKW rxEACa61cpW4bfTsR4qebyCRZmgiii4lErBJD4w5bcFqx8BV0f32Na5lv5iKmXQ8QVfo H6nryKAPYlC2gAhvB3ZtwWYivKRghemsNSpzg= 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=ooNmMn2fOuE+lecLRch8pkBk7lzuBghGo9NoZBqRTLI=; b=kJZ56eiLIPn2nbYqeqO9ryAEvH9LSlLRiB5A9mKk+L75vrvRod9CaGVNDV75SfhlhX RJuFqNSa+f15MMRjqPpJuW9TSXlEBiqQv5Qw1JTLoxQx+JuTh/KfqFb7KOynYBSXStfo KRltp4n5hXs3y0L2BAfBqncXT04GN1G1XVfYe9s3/qkwn7/ga0zdVhVh0d9GSaJwZCJu WC+TSLnV08x2pO+Y4t04ghaurjlC0/WAL4b+Z/LOEjMbJlBpufe/PJwq3F1REj8UJfsX P/KOCeKkWYAYe014K9hV+N4SRsSvELnYFcIe3DF978ZwKKUSI9SdJ0FBXm++zCssRJ3q 8avA== X-Gm-Message-State: APjAAAVf/6a3yLrA6TMdAN4XE4512kBSOmiX+TujuhDawBvk+uI9slWo iHI7qxGKwyUs8fbCf2MSBNPoqA== X-Received: by 2002:a0c:9319:: with SMTP id d25mr724302qvd.99.1552923729078; Mon, 18 Mar 2019 08:42:09 -0700 (PDT) Received: from [192.168.1.240] (modemcable077.38-81-70.mc.videotron.ca. [70.81.38.77]) by smtp.gmail.com with ESMTPSA id p46sm3374740qtc.41.2019.03.18.08.42.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Mar 2019 08:42:08 -0700 (PDT) From: Julien Desfossez To: Peter Zijlstra , mingo@kernel.org, tglx@linutronix.de, pjt@google.com, tim.c.chen@linux.intel.com, torvalds@linux-foundation.org Cc: Julien Desfossez , linux-kernel@vger.kernel.org, subhra.mazumdar@oracle.com, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Vineeth Pillai , Nishanth Aravamudan Subject: Re: [RFC][PATCH 03/16] sched: Wrap rq::lock access Date: Mon, 18 Mar 2019 11:41:50 -0400 Message-Id: <1552923710-30933-1-git-send-email-jdesfossez@digitalocean.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20190218173514.064516553@infradead.org> References: <20190218173514.064516553@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The case where we try to acquire the lock on 2 runqueues belonging to 2 different cores requires the rq_lockp wrapper as well otherwise we frequently deadlock in there. This fixes the crash reported in 1552577311-8218-1-git-send-email-jdesfossez@digitalocean.com diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 76fee56..71bb71f 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2078,7 +2078,7 @@ static inline void double_rq_lock(struct rq *rq1, struct rq *rq2) raw_spin_lock(rq_lockp(rq1)); __acquire(rq2->lock); /* Fake it out ;) */ } else { - if (rq1 < rq2) { + if (rq_lockp(rq1) < rq_lockp(rq2)) { raw_spin_lock(rq_lockp(rq1)); raw_spin_lock_nested(rq_lockp(rq2), SINGLE_DEPTH_NESTING); } else { -- 2.7.4