Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5705852ybf; Thu, 5 Mar 2020 05:39:47 -0800 (PST) X-Google-Smtp-Source: ADFU+vtF/vmljF5xA5FZPdiJS/F9y80CWccni3xBJe5YmrR2OCmxqnlQiCQkMKewXYz7Hn2WNfnt X-Received: by 2002:aca:47c8:: with SMTP id u191mr5765838oia.17.1583415587479; Thu, 05 Mar 2020 05:39:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583415587; cv=none; d=google.com; s=arc-20160816; b=MV1TXPewDaDdipxHdVSl5VN+jdjm+XRNd+fVdWLVMjV8kSSyn8OdSwuslQ4kyrPoTu yCWZ1WwCD5BdVhSCJ/xKIHCUVmW4LKTFboWSTHL3FJldYtpWlEB0d27CYOcVFA3ce8Zm tYMR6+2cfacr4CQpYlIWOUscMv2PBkbLvMYNPlT54BkBE9MWRbaMM2wCTzRFNHVjjjSC 31y8IqQmmaaNHLbViA1ziUJoJD/k6rHQOC4u54eekL+FfdE/b3uEYMrgjOtZ0eYCA71I 9HJQDnp7W9HS1Xu59pZFGjPGxpGNwGOi/gyFQwQB2lJlUFoJTTI6ca3hYwoI3ApxDwli DLXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:from; bh=QVLRP3l/XxhMlnjICUku5YN56J1gQxf9Fb5Wn4FomIY=; b=tghv/gzIT8d9V/CnF72Qc2TewYZbG0ocRuxEwkVbVGxyhs3aiKsLqFX71MB2vefkOq 3BcSHcixiPXXXfHEjFr7zA1dpwv/tJ46a1HdtT7WjGK0ZSFFk4z+2JkcqBM3Qx9gn8/S RWxuew6MFrG27u4+EpN3XAFhhHtkS57VqmLiqH72bJgDmzTwpb0yYgntT7uEXxMzEPzy MiuX5h34owSKKpo8wkL/vNR4E/ygY8/BgCF7GcFtCut0VKdRC2iCMj812OZkoAD1ymIX WgrvpRjGonpvlSFykJHOYLgggxLpTCi/CsKOYBZpX6yhdeuWbr84ftYl45l4QkpDpmTP feyA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x79si3411654oif.180.2020.03.05.05.39.34; Thu, 05 Mar 2020 05:39:47 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726090AbgCENix convert rfc822-to-8bit (ORCPT + 99 others); Thu, 5 Mar 2020 08:38:53 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:27632 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbgCENix (ORCPT ); Thu, 5 Mar 2020 08:38:53 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-8-FRg9kPztOJKu46TlEY-bkw-1; Thu, 05 Mar 2020 13:38:49 +0000 X-MC-Unique: FRg9kPztOJKu46TlEY-bkw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 5 Mar 2020 13:38:48 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Thu, 5 Mar 2020 13:38:48 +0000 From: David Laight To: "'zanussi@kernel.org'" , LKML , linux-rt-users , Steven Rostedt , Thomas Gleixner , Carsten Emde , "John Kacur" , Sebastian Andrzej Siewior , Daniel Wagner Subject: RE: [PATCH RT 21/23] sched: migrate_enable: Busy loop until the migration request is completed Thread-Topic: [PATCH RT 21/23] sched: migrate_enable: Busy loop until the migration request is completed Thread-Index: AQHV7XsS7F52Pb7Mok2qp7hxLysRG6g57Grw Date: Thu, 5 Mar 2020 13:38:48 +0000 Message-ID: <9003e4a9e5774ecfa377d218c71c2ad2@AcuMS.aculab.com> References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: zanussi@kernel.org > Sent: 27 February 2020 14:34 > [ Upstream commit 140d7f54a5fff02898d2ca9802b39548bf7455f1 ] > > If user task changes the CPU affinity mask of a running task it will > dispatch migration request if the current CPU is no longer allowed. This > might happen shortly before a task enters a migrate_disable() section. > Upon leaving the migrate_disable() section, the task will notice that > the current CPU is no longer allowed and will will dispatch its own > migration request to move it off the current CPU. > While invoking __schedule() the first migration request will be > processed and the task returns on the "new" CPU with "arg.done = 0". Its > own migration request will be processed shortly after and will result in > memory corruption if the stack memory, designed for request, was used > otherwise in the meantime. > > Spin until the migration request has been processed if it was accepted. What happens if the process changing the affinity mask is running at a higher RT priority than that of the task being changed and the new mask requires it run on the same cpu? David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)