Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1854283imm; Thu, 14 Jun 2018 05:05:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLhQT51wo5RuXOiQ2oYt/N1gifVfF+6ALkBvfPPIFUB7MMdeeqizTg/PkNJxWIslGPkDzuT X-Received: by 2002:a63:5f12:: with SMTP id t18-v6mr2032310pgb.81.1528977929241; Thu, 14 Jun 2018 05:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528977929; cv=none; d=google.com; s=arc-20160816; b=KpeXDmLKQvoq94TPDOMN26Gtg9Uq1LSM6ruaqe4WVm0y4fyIXlcctAIntIXLOVxuht w9AXbOjYpf8cjyqfC1VEHtO8Fvk5zsxuLy873Bf6JRj87Bxxy146mLiP4aMMxg5hn+6U hWkd9r1sdiWPwTvu8bUu6/VedHkH6+QzmS6MQMWNB6STHm/Fzbfkv38ZrKbZJAzgcCee lBl52k9aNh9gjFx+pADEuXZ3sITwVTkLp493W836o7Hz4UTHja42OV+fGvUOg78zPgRV QtsBf5nBFuNu8dMO8CrGsKjbvVmShnh1WZ0Q45qV6WtQCPumWBZiGXhOPuE/lASdj8nV r97g== 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-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=1/NenRArB12fyWuSAu1HjcC/RxGhxRFNIWX4LdEX41A=; b=gHj097+K/UMgnbbfsK51IAjjMWyN/HBoPv6sjaDwWomugVVsMXiWqLGfWt3i/5XEhz j5jaXNo9skDR8BM47MVf9oh4rAhnX7NGp8iicpELhchNIdl29V58NmgU0XPbg0AQoS9v uchcvRgggijZon3lC98mNgQggF/BxM0cPurpaC4XQ7RZZYk+kbpU/y8ta7WjUncjkZO2 wlekJZ94SbZR35kZHmNBmJVCqHFOpe/PaSG7aeaWb9pHu3NzwMsFm9okpSpJCK0acU/Q o7mW1ZTELOAixmnbbNgzOw59tB5TpsKSF8bZASiccasSizSNG3FtfhZ1IRpZVMKmfxwM OtKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vmware.com header.s=selector1 header.b=SewKX6Iq; 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=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7-v6si5282862pfl.122.2018.06.14.05.05.14; Thu, 14 Jun 2018 05:05:29 -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=@vmware.com header.s=selector1 header.b=SewKX6Iq; 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=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936003AbeFNMEt (ORCPT + 99 others); Thu, 14 Jun 2018 08:04:49 -0400 Received: from mail-eopbgr710067.outbound.protection.outlook.com ([40.107.71.67]:44049 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754966AbeFNMEq (ORCPT ); Thu, 14 Jun 2018 08:04:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1/NenRArB12fyWuSAu1HjcC/RxGhxRFNIWX4LdEX41A=; b=SewKX6IqyeZDCA1wWYiLYrMAG3cI0l34QHCBCscEn2pvSzkVimJ9lf1szeB3XWr/B0ZDswGNx+uCVnZyVU9UWL8wxCeBCKM5NUhZ2mcpcUOAnBCN6qQzen+sj7hUeFps1G6nP41zJJlAAyErrSOih4IKSWqlZXBw9KRyeq3laPE= Received: from localhost.localdomain (155.4.205.56) by DM6PR05MB4588.namprd05.prod.outlook.com (2603:10b6:5:9f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.12; Thu, 14 Jun 2018 12:04:39 +0000 Subject: Re: [PATCH v2 1/2] locking: Implement an algorithm choice for Wound-Wait mutexes To: Andrea Parri Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Jonathan Corbet , Gustavo Padovan , Maarten Lankhorst , Sean Paul , David Airlie , Davidlohr Bueso , "Paul E. McKenney" , Josh Triplett , Thomas Gleixner , Kate Stewart , Philippe Ombredanne , Greg Kroah-Hartman , linux-doc@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org References: <20180614072922.8114-1-thellstrom@vmware.com> <20180614072922.8114-2-thellstrom@vmware.com> <20180614103852.GA18216@andrea> <20180614114944.GA18651@andrea> From: Thomas Hellstrom Message-ID: Date: Thu, 14 Jun 2018 14:04:26 +0200 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: <20180614114944.GA18651@andrea> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: HE1PR0502CA0015.eurprd05.prod.outlook.com (2603:10a6:3:e3::25) To DM6PR05MB4588.namprd05.prod.outlook.com (2603:10b6:5:9f::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c69360f3-98d0-4bf7-ac36-08d5d1ef03a6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:DM6PR05MB4588; X-Microsoft-Exchange-Diagnostics: 1;DM6PR05MB4588;3:JrBjEawpQtywHdn20W0997UglVZ+GstdIld+jFM4AEsddAiaOVmnuejnebSSUtLC3slfeo/i3ysJxL3IChhuVs1RN249GHpsO+IhegXVPJi4oP8XAfY5fcSfoOP1cx8/lO93N3SAvAQL+rdqYT+4AcvmfiGA77mWTZ1S5nuV12klTRckOGvtUdO6apbYrW5Zhb8BC6g7kDp4dnqYevpoYCLDE/HB6/lE4hJY0kFZCT9+62HSazpBI8+FIoBPd+k4;25:sdDmdPSVJPOM7bFYvvh+whEDzTU1m1LEAKptNQiW/WrLZtGm2eN1NzF8m7dK/N8hcggiS9drWK3XGzQXEzUzMSABe45cXmZGQkv03A46P/oJ8hnJNT+Opyx3RrmxTEKDBCsXImYdlTvDEuHJpdav4bxjaW26zaO5RhHQ3pYADv3iahdwqBmdjKp7oqJQt428aPdPUCTwlyJeby/2QDNSAsIgxMva/hJLuaJsH11zMr/caeI+2lMlqaFqt+WQnWTA7iWu+7lAr2JpM2sfiMXocP9gS8umSJU2/6OdEz6v2Mb5RvLkT3n8pVQE9NoilAngIbIwSbCBuvEifXkLU+w2cg==;31:58yQ7UlJWBVS7d1fsTuHWOrcEKIneqx5ojCoEtotJbdZEcem+iZes2+CqhN7/56tp9sQ3lfeRzEbCxqXzIughlLwJzyLq0QONYzJ6ZOZi5S8lMeeHhtuUGtbD/UtFdMZXf/RxvaAFOteTR86aKrdAqCzo43S2cXhQ1NcJHhJMIt796KGBkSMfdR0RBGrAa0bwDoPSf7d7tg0GofheJhXPoBMe0uHbntjqFSvo9TZKRs= X-MS-TrafficTypeDiagnostic: DM6PR05MB4588: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=thellstrom@vmware.com; X-Microsoft-Exchange-Diagnostics: 1;DM6PR05MB4588;20:Q6sxW/d3ZfZNPIiAj6lq3IgQuG0Q0NyZ877qCY+NSpatecQ3ZCbWaztTPmBZWG6/X7Wl0DKx9YYGV6eAo/bF0Av9krJYnemZAJJRfE47jInpvy/Wcl09jYkPMHTd9zQQ6OBAtr7ZZ9odQs9T9o0AE7TjhRC5bHw4Dqp2XtL+8cMU/34UIBKwm6zlcmcOOApmJc+UwpeXgsFcLKB1s9cWPwGkkDiedbB9TDlljHJ+KgBNeAyKs1hnOXw7ePo9HrbLTucnKI6Ahwbh4ihhtRp6EG0GkKnffxd2bTMJPtbLPtHULyhnfsexrj1SdZ3P8CYOekEdvN3KGBmMqDm0vvkw/ihnDtHoIE1HGJIjeHNCCU7WkNmrwoCosPBaUZYHOvxblHY8BZ1UvXj53WJ0LPYKp8A7PaX+jPgl36B7kbDsrw/6QMUG6Jj7Og7vV/cwAjVO+2wIT3BBkXkbNl/sAGPuEPdMpTgnm0+t4MxAD2lOgsvDNNdug1SLvJeYaAV3C6yZ;4:8w5hqigf7pXPe2LsqyGl99Pihpzzdjubg0kpK12tbc9f1hTpXpRBI/LyPVKUQAnAM2wqEny3yOzzzaT8GeKZPAVjzFVsJ3zAPtR2weUoLN9wPt7D7xbHFFG4znvsizpBRvY8pEeRPsFrjhvNj6/tRgxLOaCts4+ffqlV5WYEYCK2ALkPN3wG2GjNwkZiPzBgorFwFL2oV/WICdt1XpuNSUX5+9KvzG2b2C+bIJd+dB1X8WKrMYgfxP9TLTXGhpxoeh/uTHhbVPiSZr0Rqx7npQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:DM6PR05MB4588;BCL:0;PCL:0;RULEID:;SRVR:DM6PR05MB4588; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(39860400002)(396003)(39380400002)(376002)(366004)(346002)(189003)(199004)(6486002)(6916009)(54906003)(6666003)(478600001)(36756003)(93886005)(86362001)(64126003)(31696002)(316002)(50466002)(8676002)(58126008)(7736002)(97736004)(2906002)(31686004)(305945005)(106356001)(105586002)(65826007)(229853002)(7416002)(5660300001)(956004)(2616005)(476003)(446003)(486006)(11346002)(65806001)(16526019)(59450400001)(6506007)(53546011)(386003)(25786009)(6246003)(26005)(4326008)(81166006)(186003)(81156014)(3846002)(230700001)(6116002)(8936002)(68736007)(23676004)(2486003)(67846002)(53936002)(65956001)(52146003)(52116002)(6512007)(66066001)(76176011)(47776003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR05MB4588;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTZQUjA1TUI0NTg4OzIzOkQzV0NGSW1pYWJ1aVNWeG55aUhIZUZQdE9Z?= =?utf-8?B?V1BjbEtGOWRvTjFkQXRBNWNzQnU2eHpndGFId2ZJWEJ2aE44ak5RWEMweU9Y?= =?utf-8?B?TzByMHYvVEhXbVZvb1NvSVk3Z1hod2ZRKzlwSDVYSnhDajdFNHRQVS9veVF6?= =?utf-8?B?MW1PTXI3OEJ4VmdBVnpSeWtSR0VHM28wbDc5NytIbld6eG40Z00zbUlzUGlq?= =?utf-8?B?cU5qNTdDQ3ZaeXJVcEVrTUN6a1pJd04wUjBTZC9LREt5QnNvRkFTVFZCMzlo?= =?utf-8?B?QkN1bzZPQU53MjVXSjd4SXh3Z05rT3JYVVBIL1YxMzJJTUdIUjFxNVN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sexyYu9r0XrNk88rghbt9N9Q7IA8NQ4tWQeeItPfHcMAYgl0fhLGu1B+UdGjYezEt/G4xu26DZt8HgM3zdleXQYAKi4EkdyKTbBMgvuHNlUje+3v9Zhs/GpELKl7Mc9rWScXSsTlLJzdRa5DBBJs6M7KSUSGcAcvSu6cQWg3rqRRFWpKUcF5LFC4u1BD9w07801cUny/VtVl1V9eqYMaUeDsfSJlt;20:EbOEfH3vSBMsAFt5FGXXyhH2Ipf5XRU/dB8rUCIeZQqZkYd1KSHEpKrWEID6wYPBh901fzEtIDpSC4R7xzfoLZxgBVc33OJ2Lgcgzhfyt36Zb/BQTVUKmTs6FKvNnNG3GrF76LMq1dJ/hr/UK70u5O/fu33zHUdkzBuepzxSjfk= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 12:04:39.4630 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c69360f3-98d0-4bf7-ac36-08d5d1ef03a6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4588 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/14/2018 01:49 PM, Andrea Parri wrote: > [...] > >>>> + /* >>>> + * wake_up_process() paired with set_current_state() inserts >>>> + * sufficient barriers to make sure @owner either sees it's >>>> + * wounded or has a wakeup pending to re-read the wounded >>>> + * state. >>> IIUC, "sufficient barriers" = full memory barriers (here). (You may >>> want to be more specific.) >> Thanks for reviewing! >> OK. What about if someone relaxes that in the future? > This is actually one of my main concerns ;-) as, IIUC, those barriers are > not only sufficient but also necessary: anything "less than a full barrier" > (in either wake_up_process() or set_current_state()) would _not_ guarantee > the "condition" above unless I'm misunderstanding it. > > But am I misunderstanding it? Which barriers/guarantee do you _need_ from > the above mentioned pairing? (hence my comment...) > > Andrea No you are probably not misunderstanding me at all. My comment originated from the reading of the kerneldoc of set_current_state() * set_current_state() includes a barrier so that the write of current->state * is correctly serialised wrt the caller's subsequent test of whether to * actually sleep: * * for (;;) { * set_current_state(TASK_UNINTERRUPTIBLE); * if (!need_sleep) * break; * * schedule(); * } * __set_current_state(TASK_RUNNING); * * If the caller does not need such serialisation (because, for instance, the * condition test and condition change and wakeup are under the same lock) then * use __set_current_state(). * * The above is typically ordered against the wakeup, which does: * * need_sleep = false; * wake_up_state(p, TASK_UNINTERRUPTIBLE); * * Where wake_up_state() (and all other wakeup primitives) imply enough * barriers to order the store of the variable against wakeup. And with ctx->wounded := !need_sleep this exactly matches what's happening in my code. So what I was trying to say in the comment was that this above contract is sufficient to guarantee the "condition" above, whitout me actually knowing exactly what barriers are required. Thanks, Thomas