Received: by 10.223.176.46 with SMTP id f43csp1162956wra; Fri, 19 Jan 2018 07:45:29 -0800 (PST) X-Google-Smtp-Source: ACJfBou1nmfbpPXZ62EflH7hBGRjWuTQVqIOi568yYLQv2+VH2K4p6QGE+zDs7fYJUhQnTZQVw3Q X-Received: by 10.98.160.25 with SMTP id r25mr32230504pfe.218.1516376729216; Fri, 19 Jan 2018 07:45:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516376729; cv=none; d=google.com; s=arc-20160816; b=frPhhGlqb5Mhs6G612c9VI0Q+PeGwB3XIpqHz71OkErIVcdyJH3Nz2RP6tGofl8yfj kirHpLZQjGtkoAa5RMnJt7UbHmDIhiyco+DdkX4XLsc+b9AmTIcQ0hQPuglOKw4RpE1q 89oADJ7qxkh/WqqggxfF0zOAb5kc7ppoaZXYnOo3bIvQOZQmxo9O/+nMu/LM8xjsnw7B BporBOisaayPdhwL/r3wdhLwN/M3NbT2z14uY2IFBPQ976Whf20RlqK33x/N1gw1SseY OxDhf32r/yhO7TGUpDzZpNKm3pUKPYHvpvJhhmThbxHUpkUarbhzLJpSiUKMrXUlB0wt w03Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=7VyYdwXbA726buQxedpQ1F6dF+NhU1YlHNyB3AX0nvI=; b=HMhBDgUu6GIa5t7H6q8lZ6yozaeJrI4oeXv9+W+pbzriqsjV86N4ta38hYEXQqFb48 oQdZx5ligXHnU8XSdJnNPchHtXAlnA4knodoEHvwm9Q41/so+iOeZzbpySL4o/4966Qr fDfCkF5LDzKE737wY9iRyiWMN7Neh51H7TSnQ2eEAwCpMYdc19Pn0nJEJFxocNJMYRsh 9Z50EeImFzj/p94g3VkOwyC30TCh3OddT7bBbi0k4JS1qSYitpzZeac3QwfbPcOtGXOq PZFOMblxrKD9yB/HYwEAb/W/B1uN8tWv1TW7v8ADOPFzXMzL3P+yoPGleq1+j70nJofj rj9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=a3nztqre; dkim=pass header.i=@codeaurora.org header.s=default header.b=a3nztqre; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v63si9499291pfd.399.2018.01.19.07.45.15; Fri, 19 Jan 2018 07:45:29 -0800 (PST) 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=@codeaurora.org header.s=default header.b=a3nztqre; dkim=pass header.i=@codeaurora.org header.s=default header.b=a3nztqre; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756037AbeASPop (ORCPT + 99 others); Fri, 19 Jan 2018 10:44:45 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:40552 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755749AbeASPoi (ORCPT ); Fri, 19 Jan 2018 10:44:38 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CF9706074C; Fri, 19 Jan 2018 15:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1516376677; bh=1Md3TdlnGE66Ni/V8cdYAubipB90LwVUi7ASpviQsck=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a3nztqreu/LjTlH2VF3SSGd20oL/Pmsa3dOpYcqeCHfmDouAYwTMmaJW7TDd4ausd ep+flebAR1kvFbHH5TRNvy3VzP/uKdotqM1iIAy0/bwnj5/XL+pn3gilVt5J/iTGOK qu1VS5MJh7Q/sP5p6cgUUQTgY291aFshtBVwOCqk= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: pkondeti@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BBACA605A4; Fri, 19 Jan 2018 15:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1516376677; bh=1Md3TdlnGE66Ni/V8cdYAubipB90LwVUi7ASpviQsck=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a3nztqreu/LjTlH2VF3SSGd20oL/Pmsa3dOpYcqeCHfmDouAYwTMmaJW7TDd4ausd ep+flebAR1kvFbHH5TRNvy3VzP/uKdotqM1iIAy0/bwnj5/XL+pn3gilVt5J/iTGOK qu1VS5MJh7Q/sP5p6cgUUQTgY291aFshtBVwOCqk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BBACA605A4 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=pkondeti@codeaurora.org Date: Fri, 19 Jan 2018 21:14:30 +0530 From: Pavan Kondeti To: Steven Rostedt Cc: williams@redhat.com, Ingo Molnar , LKML , Peter Zijlstra , Thomas Gleixner , bristot@redhat.com, jkacur@redhat.com, efault@gmx.de, hpa@zytor.com, torvalds@linux-foundation.org, swood@redhat.com, linux-tip-commits@vger.kernel.org Subject: Re: [tip:sched/core] sched/rt: Simplify the IPI based RT balancing logic Message-ID: <20180119154430.GC14011@codeaurora.org> References: <20170424114732.1aac6dc4@gandalf.local.home> <20180119100353.7f9f5154@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180119100353.7f9f5154@gandalf.local.home> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Steven, On Fri, Jan 19, 2018 at 10:03:53AM -0500, Steven Rostedt wrote: > On Fri, 19 Jan 2018 14:53:05 +0530 > Pavan Kondeti wrote: > > > I am seeing "spinlock already unlocked" BUG for rd->rto_lock on a 4.9 > > stable kernel based system. This issue is observed only after > > inclusion of this patch. It appears to me that rq->rd can change > > between spinlock is acquired and released in rto_push_irq_work_func() > > IRQ work if hotplug is in progress. It was only reported couple of > > times during long stress testing. The issue can be easily reproduced > > if an artificial delay is introduced between lock and unlock of > > rto_lock. The rq->rd is changed under rq->lock, so we can protect this > > race with rq->lock. The below patch solved the problem. we are taking > > rq->lock in pull_rt_task()->tell_cpu_to_push(), so I extended the same > > here. Please let me know your thoughts on this. > > As so rq->rd can change. Interesting. > > > > > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > > index d863d39..478192b 100644 > > --- a/kernel/sched/rt.c > > +++ b/kernel/sched/rt.c > > @@ -2284,6 +2284,7 @@ void rto_push_irq_work_func(struct irq_work *work) > > raw_spin_unlock(&rq->lock); > > } > > > > + raw_spin_lock(&rq->lock); > > > What about just saving the rd then? > > struct root_domain *rd; > > rd = READ_ONCE(rq->rd); > > then use that. Then we don't need to worry about it changing. > Yeah, it should work. I will give it a try and send the patch for review. -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.