Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp835243imm; Thu, 5 Jul 2018 09:40:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfwr/2SJCDzGgIhygh+lAa+BwPWGoQLB+xOh3Qo9r3PFJoJEEXXwM9IF5H7/l6CHoSo0MNS X-Received: by 2002:a63:af49:: with SMTP id s9-v6mr6456618pgo.49.1530808832652; Thu, 05 Jul 2018 09:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530808832; cv=none; d=google.com; s=arc-20160816; b=Qi8PhLzztJxCDhtVRzMsiTQMCdr2Hc/ANEAfg71vpt3a97yfCjfbFWvJpEF7E/AGEA Y0vg3NNzBl2iSUDm+z9/L7xBKK9cA4arxrW2NyAJen7Zc5kedd56+TyE00ZSjDj7uZYv zjVh+j7zH9nWhbmF/HSszWaDIhIUUlMd7kRe2D3udhhmuTX8aOtxBM4lEYSYqni0eUws 6mPHZAGmiFj+lt4s6SNnArEhnNgHyqQHsw+9gjRsoaWK2zVT8jGLB6D7mz0P5OASqqDj ya9rfPMpu6UpFCoNWpca/QEgJpfutaS17m0Vverb/MBty78nIIpNnIqKq/Qf3Uv4OIRS ll+g== 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:arc-authentication-results; bh=r8qZJVC2lstPfFv1acY6lBq2vRn+7Rj7Vfr5BEtq/mA=; b=a35xyptWEuQri4KBRNmyNw7UW8eX1fSfE7aSCjeJZOYKiq3M8KBv2XNzSov3U4AYXx cd+vo6Xzp8FdkxVxvxNAAy5+7Bh4fgHZdsO/dve+zyXd+HJbX4XQxIsTcQw/y7scnh2s 2xc9fG+Gi+V0A6kdxMmhpq0Bjv1YBiE0+XMO45NXNgsdPsMn4N0taV9WeadPxfXZZU0T Oj0w9CKMMiFDro7VoV+EH0X0AnfmfV/K0lTLh8vwyNzmDKo1twU/HIS4GT512PVQ8w+u XyXu/vvAiUqAXTUzJm0vL5tviZnw3siiT2k42e+p4qOyo5z+p3BzPlBWERm98G0PnJWp HIvg== ARC-Authentication-Results: i=1; mx.google.com; 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 d14-v6si6170965pfo.339.2018.07.05.09.40.04; Thu, 05 Jul 2018 09:40:32 -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; 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 S1753802AbeGEQis (ORCPT + 99 others); Thu, 5 Jul 2018 12:38:48 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:51122 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753547AbeGEQir (ORCPT ); Thu, 5 Jul 2018 12:38:47 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1fb7HC-0007aK-HR; Thu, 05 Jul 2018 18:38:38 +0200 Date: Thu, 5 Jul 2018 18:38:38 +0200 From: Sebastian Andrzej Siewior To: Steven Rostedt Cc: Joe Korty , Julia Cartwright , tglx@linutronix.de, linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra Subject: Re: [PATCH RT] sched/migrate_disable: fallback to preempt_disable() instead barrier() Message-ID: <20180705163838.7ejxmlpdebuateuy@linutronix.de> References: <20180704173519.GA24614@zipoli.concurrent-rt.com> <20180705155034.s6q2lsqc3o7srzwp@linutronix.de> <20180705122300.42164577@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180705122300.42164577@gandalf.local.home> User-Agent: NeoMutt/20180512 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-07-05 12:23:00 [-0400], Steven Rostedt wrote: > [ Added Peter ] > > On Thu, 5 Jul 2018 17:50:34 +0200 > Sebastian Andrzej Siewior wrote: > > > migrate_disable() does nothing !SMP && !RT. This is bad for two reasons: > > - The futex code relies on the fact migrate_disable() is part of spin_lock(). > > There is a workaround for the !in_atomic() case in migrate_disable() which > > work-arounds the different ordering (non-atomic lock and atomic unlock). > > But isn't it only part of spin_lock() in the RT case? that is correct. so in the !RT case if it remains a barrier then nothing bad happens. So this should not affect futex case at all. Let me retry this (Joe also says that this patch does not fix it). > > > > - we have a few instances where preempt_disable() is replaced with > > migrate_disable(). > > What? Really? I thought we only replace preempt_disable() with a > local_lock(). Which gives annotation to why a preempt_disable() exists. > And on non-RT, local_lock() is preempt_disable(). KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch printk-rt-aware.patch upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch > > For both cases it is bad if migrate_disable() ends up as barrier() instead of > > preempt_disable(). Let migrate_disable() fallback to preempt_disable(). > > > > I still don't understand exactly what is "bad" about it. > > IIRC, I remember Peter not wanting any open coded "migrate_disable" > calls. It was to be for internal use cases only, and specifically, only > for RT. the futex code locks in !ATOMIC context and unlocks the same lock in ATOMIC context which is not balanced on RT. This is the only case where we do migrate_disable magic. > Personally, I think making migrate_disable() into preempt_disable() on > NON_RT is incorrect too. For the three patches I mentioned above, the migrate_disable() was preempt_disable() for !RT before the RT patch was applied. So nothing changes here. It should only matter for the case where migrate_disable() was used explicit. > -- Steve Sebastian