Received: by 10.192.165.148 with SMTP id m20csp2329564imm; Thu, 26 Apr 2018 09:13:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx49IIZZ6sByYKCmWkVdRLvZcKGYm8oLR7CSylTGFiy6Gi8l2N/DEKna8X/ivvqCEeZXxigQB X-Received: by 10.99.114.78 with SMTP id c14mr27021773pgn.199.1524759190414; Thu, 26 Apr 2018 09:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524759190; cv=none; d=google.com; s=arc-20160816; b=vrNTSS76LlsKG2pYA0gMcQVtO6Uw2JviaaCvnCuJhuQ52rsOZ6dxWcyb5c+JYghBsr jCNzIG6yJ76+QqtG7jUEwZQ4x0wPSti+ULdhSrp2Ph885nrezmHAtjpk+hCtvC6cTiNj u6DdN5QBWG2WQQxTRqz2pdNvBDth99/xl/1YO1Km9Cx9/F0w1HQJRilrv2qnNil0qBVL u+iySzJ+oVmmoubh0I8DLuy7UMos0XZB2KKzJQDmRrRou+SrzS9Y0LCf8vZ9X7URktEM rNhb6lLVXIyQA1z15RQdPn5uGchvp1h0s8XixDaI/b9ZFwJK5Tmr416osvaZvqsTs4YW 01Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=4TL8MxmRm2o0zP6IyNRm8VkA6Y+9DWYEYMuq2qzT5rQ=; b=EuwaWJrEhpAx4YCNAwztLXtbZoniMwNfoXQmbpxnlNc3i6+Hg1DcCkBe9liRywy+tg 7Srvd5c3gtI8lN9QAn8yl1gQji31nJttNFA/16B6EsW7MPPOpg0qaWReyOTiK1oNPXm+ Fk9Vx/KinCiYkj/xGCdrAERa9jJL44ZlPSCQ1Vw3XLMsQwcrbMbe5+/paLu/Ev8sSjkU V748OmPetrUklX7n9WMfva7ywpbO2SlWcBzu2s9kQHsjjRaloMCMN+A8BhYOO7HnB3vB pYdmPLloSc0f8G9pSfBJD8g1C4HLIDZhhK8lCkg6LAzv5BjPYBLhISV1w7Ke73N8rBGb ftSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=ayp6yi/X; 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=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i71si6310072pge.436.2018.04.26.09.12.55; Thu, 26 Apr 2018 09:13:10 -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=@virtuozzo.com header.s=selector1 header.b=ayp6yi/X; 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=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756742AbeDZQLv (ORCPT + 99 others); Thu, 26 Apr 2018 12:11:51 -0400 Received: from mail-he1eur01on0121.outbound.protection.outlook.com ([104.47.0.121]:45481 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756605AbeDZQLt (ORCPT ); Thu, 26 Apr 2018 12:11:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4TL8MxmRm2o0zP6IyNRm8VkA6Y+9DWYEYMuq2qzT5rQ=; b=ayp6yi/XlKZsIF9NZXr5XceS4nKIsWzhlvpbIlNPLDtNQ9jt/kSD6P6lbXZMkd3ZxJHqTJDL0NovTLbagtcI0mVIN1IT883mFZDVvxVwM5fG6eGUIZKrmLxd93I/v/OTkChWC8gzee7zZQmrSmGNODd8fqtPZBgRFlcTiGAzC+o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from [172.16.45.234] (195.214.232.6) by VI1PR0801MB1343.eurprd08.prod.outlook.com (2603:10a6:800:3b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.14; Thu, 26 Apr 2018 16:11:44 +0000 Subject: Re: [PATCH 4/4] exit: Lockless iteration over task list in mm_update_next_owner() To: Andrea Parri Cc: akpm@linux-foundation.org, peterz@infradead.org, oleg@redhat.com, viro@zeniv.linux.org.uk, mingo@kernel.org, paulmck@linux.vnet.ibm.com, keescook@chromium.org, riel@redhat.com, mhocko@suse.com, tglx@linutronix.de, kirill.shutemov@linux.intel.com, marcos.souza.org@gmail.com, hoeun.ryu@gmail.com, pasha.tatashin@oracle.com, gs051095@gmail.com, ebiederm@xmission.com, dhowells@redhat.com, rppt@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, Alan Stern , Will Deacon , Boqun Feng References: <152473763015.29458.1131542311542381803.stgit@localhost.localdomain> <152474046779.29458.5294808258041953930.stgit@localhost.localdomain> <20180426123542.GA819@andrea> <20180426152942.GA2737@andrea> From: Kirill Tkhai Message-ID: <21b98d67-9a8d-8c23-f55d-c324f67f4c86@virtuozzo.com> Date: Thu, 26 Apr 2018 19:11:42 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180426152942.GA2737@andrea> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0802CA0024.eurprd08.prod.outlook.com (2603:10a6:3:bd::34) To VI1PR0801MB1343.eurprd08.prod.outlook.com (2603:10a6:800:3b::7) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB1343; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1343;3:QSmo+T9hP/kI/rTgmCNiYzkbs836sg0lqgyulI89Ed91ZGfzpTrCGBXdH48Tib6cS4LknATVCnyS1gDuJaVVzonc15PiqeYlg3iID65yKMKh+3t5lkbzuORIPOg29Pvm+FoX0I8V5zeYWUmpYClz1RaRP5lXTAbjhF0FftQAqxXFptWx5yT8BysxN5+qyzDWtf+xCzADvdWOuQ7ssoWsbgZTurDrD9x1xnQwsgcRop6d2qHppK3t20hKElGCY4nh;25:F01tmyN6D5SsvYHxTlFkF5Ab4PfCzu3pmh1RPwT2R9Ew2V2BobxQC1zyKVsHm1NTBM/1jZU+rcEHqtVu00UNPKJ8HDfynJEANi/SXoizuFQk+i7ZoFxlgY/gQs3I63aKVwlLVY37ytdBqsEgqhoTIYNx3G9koSnM4c9Kt1aFn0ro6/HGtmO/XHv6GjEfZnFurSkuO+2DTWB0WtHSWbAbvrFkwlHh4w2dwJKpChAMjoXmGuZbzivrZBVU53cYOXz9Q03de/znJoMQ6s255XU/4WpwNUx7B1kk4WuHHlPM+ijebRtEgcymzaa4vcN6Gucaw+mYRxiJebo00QPsEiOzAw==;31:zCxVlyal+JeyhJZErs9L5AoPKFdqyDTKM6PirgyFiH1FsiEmvV92cP3feemNsK00dgVCvDC2CZUf9CtTDMkeOMH6SV1WZndAvFsBAlnHqgGoNTUzA1bFKQGsl1I5t9dUnWXt+maG7qtFcr+HmZpklPtQaefZXiH14ZKwsMUa9DeEMH6870HCy2nP/MfqgovVlLR/1r1aH5xC+VCqUBGUnUE1sFAyuzhKNFeRcVvq7pY= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1343: X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1343;20:Q0T7/AsmdFuI+qAlB+2R6DeRoVk8nnmHdd15oZNENLDjd+Xse2gybtqit2ckmDxDsRoasqdyxFoU405mRQ66sMKVdQuLpU2nghlhAQpGZg9iupWh3skKq444WAQqNCZFg9ajbmtPMCByhENysGkCWnytVcCRC42rRJw3qqGHwXEdwLVUxvqTlc5jhJ/sCrBOwHOTZPNJRHD6irVAoWw2vba1cIhmF1mm42xRgVdFJr4ogKG2bQX3uF4fvpEGF+JpthqfVVS3piafKmDx08eAkqi8jsuz/dMTAfLez+dspHi3udtHbXp5DizrwSijDl0yjAyGvcNBTkdgPZM/PgQzdOmc5/pzRlAmhezoOvxJZ1SeJcB0E9Jj7rKERG7w/KE6/dA423T97xIsD/T1y43eXZO98OfXYR0rmBZQ/Nt3jQ6rahTF0sQJtyc/yngjHOkOFXvwaEf297sgIxTZEbZLSuLDu2OzYN8bjLzY/agYgF0y75R8GBDazkyLGCBHVsch;4:DIvrDCjU+VuwJ04hP+aAoHSo4yM85ZxIFdtx34sU+yUdmVcD0fxzDRMDGkehgHi3xwhBH74zl9LZRTPknw5GWYVVrjEpmauojBTa0Tj7IT56z32l6OJESomZj9uSRo/DbxZkeMMlbBoRXkbmjUuQhDs1qhzbnXiUOecqvfr7INXtrEnBzrsN9uz626XCnTt+R6qadzypL0jZ1gKcax08VcCAIl74MVRNoiw2a8N9XSCDR3wr2iPnP5PlGzOfyr8h6fd9ZYdqLnmohywn5v4M6sUBz1XgyDwaVSfEifEAUMGKRAYv6BrAlogjDiSdtEYfXlLLL9qKBrIt4gESAhsKLmr8FT6Y0c7cw7ANSWYKm6M= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158)(42068640409301); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231232)(944501410)(52105095)(6041310)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:VI1PR0801MB1343;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB1343; X-Forefront-PRVS: 0654257CF5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(39380400002)(396003)(39850400004)(376002)(366004)(346002)(189003)(199004)(486006)(2486003)(31686004)(68736007)(25786009)(76176011)(4326008)(81156014)(81166006)(50466002)(52116002)(66066001)(31696002)(52146003)(23676004)(2906002)(65956001)(47776003)(65806001)(5660300001)(93886005)(16576012)(65826007)(8936002)(476003)(316002)(97736004)(58126008)(386003)(53546011)(966005)(305945005)(105586002)(478600001)(55236004)(59450400001)(325944009)(6486002)(106356001)(54906003)(26005)(77096007)(16526019)(6246003)(6116002)(186003)(7416002)(53936002)(6306002)(36756003)(3846002)(230700001)(2616005)(64126003)(229853002)(7736002)(575784001)(86362001)(6916009)(956004)(8676002)(11346002)(39060400002)(446003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB1343;H:[172.16.45.234];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA4MDFNQjEzNDM7MjM6azBIcU55ZVdVbHkwUHozZ3J0R1NSenlr?= =?utf-8?B?SUlDMWhrVE5IekJtaC9wajZ2bXF2dnJLQ0VScmZJOG1CZkN3RDEvemVYZmh3?= =?utf-8?B?Rk0xZVhkUWZ0VDJEeE5PQ2RMQXdiR2o0WGY0SEFiRExNSlJjMlF2Z3RPWWhm?= =?utf-8?B?dnRudmxjNVNQUno2elZYR0JIMFUwTDJ2RU1uVjN2dUw2ajdQR3VvVmpVQlli?= =?utf-8?B?RG82eG5FQWNOUHM3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VIqrEGYPahPK7QpMT5Zg4=;24:b/rS1W/7JSIHoU3peZFWKe+3NnQJj8RtzGvD0WyoSrC5LJVftkikEZw8k8YTsmsjC5LTQDXbAaoHVWIjM1Hg9Tl4EpFzA07v6ar+b46mw10= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1343;7:MKZu7A+B0VA+f9L5clVpMk4NKvLwownpEtKXfAlecxncJ8wWPJYLVezjp4yptx6y0DOB8fTudorBMBmqes1jF7PurTvsP7qnfWy83tTZTPuVwo7IXQ500JkBTK9/XCGxX0H/DRoZXOe6tJ3eUNEVycc7X5zziRHyVB38O5fofafJrPqskpRkvncf3a9nbZjcAJtOVBeGafdSmNMNI0BVnu9+GggY5qVHss0RzQfuhKkOqjTFEXn3hA84yIu8hQnE;20:DT1G62v5bgzwvywnOl+Y2Kx/+KTvJQyvCMk3f/n8U5BmDPaHaWqUynsw8ccTvPUhqOE24pCkNV2BrOlqx4opPQSLtZNcePdjSswJSkPee40n79YpxeXmqSJVAs5sHesX8qOlh9D2hvtniCtn+bbyV1XifFv5pWo7/JQZ6eKk1hY= X-MS-Office365-Filtering-Correlation-Id: 421d10e9-04e0-46e6-3266-08d5ab9068bf X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2018 16:11:44.6449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 421d10e9-04e0-46e6-3266-08d5ab9068bf X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1343 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26.04.2018 18:29, Andrea Parri wrote: > On Thu, Apr 26, 2018 at 04:52:39PM +0300, Kirill Tkhai wrote: >> On 26.04.2018 15:35, Andrea Parri wrote: > > [...] > >>> >>> Mmh, it's possible that I am misunderstanding this statement but it does >>> not seem quite correct to me; a counter-example would be provided by the >>> test at "tools/memory-model/litmus-tests/SB+mbonceonces.litmus" (replace >>> either of the smp_mb() with the sequence: >>> >>> spin_lock(s); spin_unlock(s); spin_lock(s); spin_unlock(s); ). >>> >>> BTW, your commit message suggests that your case would work with "imply >>> an smp_wmb()". This implication should hold "w.r.t. current implementa- >>> tions". We (LKMM people) discussed changes to the LKMM to make it hold >>> in LKMM but such changes are still in our TODO list as of today... >> >> I'm not close to LKMM, so the test you referenced is not clear for me. > > The test could be concisely described by: > > {initially: x=y=0; } > > Thread0 Thread1 > > x = 1; y = 1; > MB MB > r0 = y; r1 = x; > > Can r0,r1 be both 0 after joining? > > The answer to the question is -No-; however, if you replaced any of the > MB with the locking sequence described above, then the answer is -Yes-: > full fences on both sides are required to forbid that state and this is > something that the locking sequences won't be able to provide (think at > the implementation of these primitives for powerpc, for example). Ah, I see, thanks for clarifying this. >> Does LKMM show the real hardware behavior? Or there are added the most >> cases, and work is still in progress? > > Very roughly speaking, LKMM is an "envelope" of the underlying hardware > memory models/architectures supported by the Linux kernel which in turn > may not coincide with the observable behavior on a given implementation > /processor of that architecture. Also, LKMM doesn't aim to be a "tight" > envelope. I'd refer to the documentation within "tools/memory-model/"; > please let me know if I can provide further info. > > >> >> In the patch I used the logic, that the below code: >> >> x = A; >> spin_lock(); >> spin_unlock(); >> spin_lock(); >> spin_unlock(); >> y = B; >> >> cannot reorder much than: >> >> spin_lock(); >> x = A; <- this can't become visible later, that spin_unlock() >> spin_unlock(); >> spin_lock(); >> y = B; <- this can't become visible earlier, than spin_lock() >> spin_unlock(); >> >> Is there a problem? > > As mentioned in the previous email, if smp_wmb() is what you're looking > for then this should be fine (considering current implementations; LKMM > will likely be there soon...). > > BTW, the behavior in question has been recently discussed on the list; > c.f., for example, the test "unlock-lock-write-ordering" described in: > > http://lkml.kernel.org/r/1519301990-11766-1-git-send-email-parri.andrea@gmail.com > > as well as > > 0123f4d76ca63b7b895f40089be0ce4809e392d8 > ("riscv/spinlock: Strengthen implementations with fences") > > Andrea Yes, I'm looking for smp_wmb(). Read barrier is not required there. Thanks for referring this. Kirill