Received: by 10.213.65.68 with SMTP id h4csp542033imn; Fri, 23 Mar 2018 10:00:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELvdx0ePB6aKkabEn6XoSf8Nvqrjy+yPLhINuXhScWhf/ViL+mb8jFeombRUD06T6QBfPTKe X-Received: by 10.101.87.136 with SMTP id b8mr21259905pgr.282.1521824441283; Fri, 23 Mar 2018 10:00:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521824441; cv=none; d=google.com; s=arc-20160816; b=I/351yT9Bkv8L4Ro4/X+UufcU+xru08dmWMZlNrHpKqeqVZUfqEeOGHmVQNWiI5E8Y oWUSlsjuSv+GvQFEA6uO/aRqJfP+DpL8DwAy5uSiiK4JtAm2WtqrC432syvjnvu+03C+ OywuovJKZTxH9n/Hv0yBqidk2BwhjWjcVnS911b2Z/L/f0iynYftMOXnjGcmquZ3OeK6 xDmUsl/rNxMNLXR1LWJa+Torjn9fNAIohVTUwnFRCgteWrmokx9LudCZO/dYyq8g+Fzp t4GsLqqQXOiZ1wiOllNJbt4lWWNE9obPN/n8j0DmCShbi8337/ik4qtyFy+33yL09gxd CNRA== 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=tEy/Mt1oiBmiemswyx1kC068LCJokE9nz6dtQ48UlAQ=; b=UepaZKLPzbqYFdqqG7hKY+VvI6hcbnaDxECR9QAtdf8PEZESZ4/aaUjDnVFplKgccn KBtHpMdzaK771wRM3dkt9uRoi2qJm1wlWqgex6hrv3VBzYDYlyV8cNuw3fd2mTSWA6F1 iQaEan0qPBfngwO7CqoNzZgMiUvmd1ieX4aq021ciUIyVbaQIwF1T1596lSvtab3BTra n2sG469i6L98Q/IrST36eahExgEOkbVTbGmBlFcGl6/z5VjfFZuYVZRCu0QqpD707+ID xy1r0LHryfJBegKUuULU06ov4AJXyXA0qHV6JHz4No0/Wp0OvuyvIlh5knX2Mzwm0kFI Dbfg== 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 85si7039532pfz.271.2018.03.23.10.00.26; Fri, 23 Mar 2018 10:00:41 -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 S1752292AbeCWQ7h (ORCPT + 99 others); Fri, 23 Mar 2018 12:59:37 -0400 Received: from mx0a-00010702.pphosted.com ([148.163.156.75]:60244 "EHLO mx0b-00010702.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751668AbeCWQ7g (ORCPT ); Fri, 23 Mar 2018 12:59:36 -0400 Received: from pps.filterd (m0098780.ppops.net [127.0.0.1]) by mx0a-00010702.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2NGvw4Q012847; Fri, 23 Mar 2018 11:59:22 -0500 Received: from ni.com (skprod2.natinst.com [130.164.80.23]) by mx0a-00010702.pphosted.com with ESMTP id 2gv59bnbcd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Mar 2018 11:59:22 -0500 Received: from us-aus-exhub2.ni.corp.natinst.com (us-aus-exhub2.ni.corp.natinst.com [130.164.68.32]) by us-aus-skprod2.natinst.com (8.16.0.22/8.16.0.22) with ESMTPS id w2NGxLXR028858 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 23 Mar 2018 11:59:21 -0500 Received: from us-aus-exch3.ni.corp.natinst.com (130.164.68.13) by us-aus-exhub2.ni.corp.natinst.com (130.164.68.32) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Fri, 23 Mar 2018 11:59:21 -0500 Received: from us-aus-exhub2.ni.corp.natinst.com (130.164.68.32) by us-aus-exch3.ni.corp.natinst.com (130.164.68.13) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Fri, 23 Mar 2018 11:59:21 -0500 Received: from jcartwri.amer.corp.natinst.com (130.164.49.7) by us-aus-exhub2.ni.corp.natinst.com (130.164.68.32) with Microsoft SMTP Server id 15.0.1156.6 via Frontend Transport; Fri, 23 Mar 2018 11:59:21 -0500 Received: by jcartwri.amer.corp.natinst.com (Postfix, from userid 1000) id 812E2301944; Fri, 23 Mar 2018 11:59:21 -0500 (CDT) Date: Fri, 23 Mar 2018 11:59:21 -0500 From: Julia Cartwright To: Joe Korty CC: , , , , , Subject: Re: [PATCH RT] Defer migrate_enable migration while task state != TASK_RUNNING Message-ID: <20180323165921.GG10942@jcartwri.amer.corp.natinst.com> References: <20180323150959.GA16131@zipoli.concurrent-rt.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180323150959.GA16131@zipoli.concurrent-rt.com> User-Agent: Mutt/1.9.3 (2018-01-21) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-23_11:,, signatures=0 X-Proofpoint-Spam-Reason: safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey Joe- Thanks for the writeup. On Fri, Mar 23, 2018 at 11:09:59AM -0400, joe.korty@concurrent-rt.com wrote: > I see the below kernel splat in 4.9-rt when I run a test program that > continually changes the affinity of some set of running pids: > > do not call blocking ops when !TASK_RUNNING; state=2 set at ... > ... > stop_one_cpu+0x60/0x80 > migrate_enable+0x21f/0x3e0 > rt_spin_unlock+0x2f/0x40 > prepare_to_wait+0x5c/0x80 > ... This is clearly a problem. > The reason is that spin_unlock, write_unlock, and read_unlock call > migrate_enable, and since 4.4-rt, migrate_enable will sleep if it discovers > that a migration is in order. But sleeping in the unlock services is not > expected by most kernel developers, I don't buy this, see below: > and where that counts most is in code sequences like the following: > > set_current_state(TASK_UNINTERRUPIBLE); > spin_unlock(&s); > schedule(); The analog in mainline is CONFIG_PREEMPT and the implicit preempt_enable() in spin_unlock(). In this configuration, a kernel developer should _absolutely_ expect their task to be suspended (and potentially migrated), _regardless of the task state_ if there is a preemption event on the CPU on which this task is executing. Similarly, on RT, there is nothing _conceptually_ wrong on RT with migrating on migrate_enable(), regardless of task state, if there is a pending migration event. It's clear, however, that the mechanism used here is broken ... Julia