Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1859947imm; Thu, 14 Jun 2018 05:10:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLP+cj5DFmyO+yuSiMaHBJSeYaDeeMuhqF99IaOuReUsIfCz1OvOk7k6F9U0pvW9shvg8oa X-Received: by 2002:a17:902:6bc7:: with SMTP id m7-v6mr2830382plt.162.1528978208501; Thu, 14 Jun 2018 05:10:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528978208; cv=none; d=google.com; s=arc-20160816; b=VmX9dLiYvKzuA3i9qWiUAen8yAfiT9RI5AVhNT1alo/VW5uUfCzHX9pcx3/eQuutS9 EILIIY4TxYA5OCiWioDACdLLQp+VNX+fhEflRQgcPUCYnl3Irb4L4efm+6l/lajyK/KL DDo7hJMatF2FCETouoqaTkgvqhxuMrgZPlX1GsG5LSDkVHMdgn9zIOYz4w7HlVBbdm5r GvxQCw6QrWELRI89z3nCFPEpgJqG/WEnUBvuZgPwboksbaKAjPd1QeAeze0rCf2v6VHU q7E+7socMxeTCGPhGr/3BfuRlimeHvwE7OikPZu5Ep3doQ28dqemrUtj+HGJhjA3HoQz ig0w== 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:references:cc :to:subject:from:dkim-signature:arc-authentication-results; bh=8YXzBDk91JIzAN1N8F9rb+rI/mJutHBwMotwFrlEQUs=; b=vcYe83GJjZl46cimrZ+CZx+4TIkF4TPIonrGCzzeEoh+pDz30f6cmugO/JO7dzb2Jo kaxpR0q4WO9FdONs3PcVSWhTXd1j5YMWLV1J2jh3XwLBU/umS7Y6jw1EaGKRmXJIH/sj rV9kjuzYshwu6tGLDqa2tEZgcYRC26ctyjGfyQk+pUPyXmj+7HNWyEvqfOn28L41GOS5 CIMigChY/DENUE8Ooen26lwFTBVAVBpe14G5dAQhqfClst4dImBXSpFp7qNJ8PFFKZyi 2cTkz/7JEWUYw+swV+g7K4hUWF4Xjr1JQc5sB2bMpBWihR4dUnvAOXKMs7S3PGpJEr6V aS8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vmware.com header.s=selector1 header.b=mRrLaF5M; 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 q18-v6si4231995pgt.529.2018.06.14.05.09.54; Thu, 14 Jun 2018 05:10:08 -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=mRrLaF5M; 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 S936062AbeFNMJW (ORCPT + 99 others); Thu, 14 Jun 2018 08:09:22 -0400 Received: from mail-eopbgr730072.outbound.protection.outlook.com ([40.107.73.72]:7072 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754967AbeFNMJT (ORCPT ); Thu, 14 Jun 2018 08:09:19 -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=8YXzBDk91JIzAN1N8F9rb+rI/mJutHBwMotwFrlEQUs=; b=mRrLaF5MWOOOJ2YWugZ72JhXLldDBqVm+BLbTZ6/TeC3mvKgOKdKtQgg4gauNSB7foFrGH/4C+4INwCY0ZP+/nxAK5OxVheL5di4f24TDdNZeykVEJpy63D2jIR37nye0BSe7NVOLk6HInbYa4O1KbHJz6MsbnG/xK8EtePdZxI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=thellstrom@vmware.com; Received: from localhost.localdomain (155.4.205.56) by SN6PR05MB4589.namprd05.prod.outlook.com (2603:10b6:805:38::23) 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:09:12 +0000 From: Thomas Hellstrom 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> Message-ID: <9c2bdfa1-745a-e618-5429-4305a095847f@vmware.com> Date: Thu, 14 Jun 2018 14:08:54 +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-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: HE1PR05CA0137.eurprd05.prod.outlook.com (2603:10a6:7:28::24) To SN6PR05MB4589.namprd05.prod.outlook.com (2603:10b6:805:38::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e9ff8ab5-1e5c-4700-ca55-08d5d1efa692 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:SN6PR05MB4589; X-Microsoft-Exchange-Diagnostics: 1;SN6PR05MB4589;3:QWRaY+xWLj8TR47W5GkmREvuYLydo80LSfsxI15AtE1hkE1Wmu2McS99CTrFPIrsZ44BvRRvJC11FuSli5vR5jG8Gmmdmc1n/AUAycNmznJ+ixXb/A3XUxKpEpH6uShGaQGUpqepTBQ4+6CHn+JcLM+0odcBB7UafnSsi+vuk0kCGOgFLZfQFnjP7CN4EYnm2yfsDy/OhhS6pDEKqsUndsOIbhCnkRTm4tLnLqpqBImhHUtTsAGdEaAB7hveizzy;25:W0ITMbvhJCR7PVy3EOrUx3gjYPI0zl8EJqY1O2XdAZ5WS0znCLcwkKzgkgAQdr+X1VR9Xpi8O8utb08UYfsS6RiWyJfV9qJhUC14oS6Hn1coSnuVQ2IIknAu7Eazm33JS461lbZBoaQRsFl1GL0/u+6bgfYngOM6Yyp1UIVkaQXo4skHCM/GiSPKBB8tOnYppNNHCGV+6lDw8k0/9hzQpjqz8mKHtw73aukV0WUL1Kwxa4+z07UnQ7jCuKL7ZgX2/uoZL9DzKdImJSWkGtT89bCIEJ4WQRJBcuzvSi3VT5wmOfOIInKA88CV4fFqCzgCotIXuUqDwQsXFdAkBOdJew==;31:OexXrVThOrTAJIfV+psiCGC0Fl1mzsyg/wCwl182gH9bjuUQqFHxTb54V/h0nHyCs8qON4QLuC+ZTcTrekvxnyLqOjbrYdMCMTO92XbD9Ddf4klK+gFAWVnS9uDYaYE0XxqyCAkdjH1HWgUb0Q8O/V5DkMPgtxFIOxoVIRSvc9WMSCIHBuSbsSypqe5FM/G5O5GnksGl7u74gQNZYFZZ6FKP6eFXailR3f3ao0c2xH8= X-MS-TrafficTypeDiagnostic: SN6PR05MB4589: X-Microsoft-Exchange-Diagnostics: 1;SN6PR05MB4589;20:2lw4n4t1XWw3+50GK8Ug8+UxIwznMqKhhBnzTpbWIsFsg/JWOf3/Qnq/zPM/kMlrBoyTPGchK0NrjoIXleRGUETZIArQQaN8IsOhix8gieqbdq+VFIRgLUDDjnJ6XjDv7ygN960OMhDZAEq3VbX+YY7XVjT1Pkl6rGLh5jnAiNGxsf1u/OGzuWMVlEt4pQ7OTPTsVH+V64Im0hQGas18EiEe+gsxi4Q3IXgi34geWeOVIr+331DmdFTZ7WFLg3PQJ0Z9TF8K4wd4k6snS5KQq/rrNxvFmw00u2Gq+qWAOwLhA83q9Zw+rJCx4AiZ7syPV5rvbmQxoijvTauSvL3/bhH4k4nmuE2bgZhJN/0Th8UjXFv5WvUuqtZ0CAThutxzmT4HMnXi/1/sUAsKKeP+Z84yVv1sMzJ+L3kG0el01gBg8TUe2cXNKsMeyPgIitUSdXzyKrsAc99XyOa6+pUCFyK101snkigzMzPdc2Ma6Efa86zNqv7IdeJzs5ocYblc;4:RzFEoCY0WgNLLFo7x7Y2AX8Xj4i20ca1FvXwrVrORZadCOivPV4n6CUXFsqTagMt2Ef745pL2+mtnfgxfVCy7evWkk6fhMmOQ0xfaqz/gR+Y/1/SQOM4fxTxv4NSpXU76nxuArXUomt3fkUp0reE/CmP3WFSsgrgr9WL3NrAfLEBNBPeZ+xZ2gBBnEtnJ0GlDVj2+JJXAQqcccglj0pDI7NZ0G/SpNR3bZqNK0waAAxqwwnrNWSslgjzepPAqGUHCMIDXWO1L+5mTYbERnfrjg== 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)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:SN6PR05MB4589;BCL:0;PCL:0;RULEID:;SRVR:SN6PR05MB4589; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(39380400002)(39860400002)(376002)(396003)(366004)(346002)(189003)(199004)(53546011)(76176011)(31686004)(93886005)(97736004)(4326008)(65826007)(26005)(53936002)(386003)(186003)(105586002)(6506007)(68736007)(5660300001)(106356001)(2906002)(7416002)(6246003)(230700001)(16526019)(25786009)(47776003)(66066001)(8936002)(3846002)(65956001)(65806001)(6116002)(59450400001)(64126003)(81166006)(229853002)(446003)(11346002)(6916009)(486006)(305945005)(6666003)(36756003)(2616005)(8676002)(7736002)(6512007)(23676004)(58126008)(476003)(6486002)(86362001)(956004)(478600001)(31696002)(50466002)(316002)(52116002)(52146003)(54906003)(2486003)(67846002)(81156014);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR05MB4589;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?MTtTTjZQUjA1TUI0NTg5OzIzOmF6NTZUeHhkWlhoeUUvZXRYWnBiT2FNRjgw?= =?utf-8?B?NThKSis3T2FjMHJLTkcrRHFKY2FxakpXSFhIVXNhbjBJcHorTTliejNCRFFV?= =?utf-8?B?R3F3eS9qNmZya0ZyNTM3Q3ZqL0dhR1lsVzBGRFp0L05JZ1dNNit6N1lUYUt5?= =?utf-8?B?eVpScWlubXNvUTcyZjFSZHRpK0txYlN6UmV3VHNObHZiVkVmcUtIZURCMWRB?= =?utf-8?B?dVZ4S2x5RlM3M2ZORDNKMFNlOTRkaWx4Y1R1cDR0cm9TTGpuc09pZzFmSzI2?= =?utf-8?B?L1NhRUdOdVF2RkUw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Microsoft-Antispam-Message-Info: S5+srasDce8LZiAp0JAeIXTGgeRjYLXymzKU9UkQf2sD/YSKm8B6gIcpOhaRsFLa7daC+zYB0kJtrcp3CHJTrPMr1rYAdwFf1k5q7kYv0qNe8kR9gby/fF4j4fJP8TXrMOegtMnmWbFngcfEjZ1/mmiiwrBxZrvGG2B7uTEIcMhX8O2DWCpcOsTXUHp1pRPr X-Microsoft-Exchange-Diagnostics: 1;SN6PR05MB4589;6:cgXg/m2niyOgSTh/UL9D44xWfLPdJZ3kcI5YUAgBMFFs1yooKddsLlQWoFD4PNqBB9XiOcrdCM7Z4Y2mESRrA2heZWDTthMiEax9nNbTFc0WIuzNGULBuwLbkdxHlaOtFgMZksCvVsBINzKVJU7h/+kbYVmnWlZbw21sI9CbGByw+DzFJkvWUsh9RupcVSvl7wQcFJesUeei53P8qfpd5x9dZ2TL6p5Dk5PErn/XJNyuuAsnVsPtwDQea6vjn+R+Nz0jpvl2p4M6FCBK1CO1v4d3CyPmoVCz3puznLtLpD0w5RGoMFHUOfWl9Gqq9+B7i1jtQc0B4D808D1P3WT1ZcK6TSho63Gy3zFL+BtGB+CXHhTeIilVQ66L44jkiitZoy5Mj3h6Bl6KXk3Jagll4KGiZf38dmP2371j9cryoQ+xzVHO2glynk2YAdDcbbjyAHmuMlkRE1rbgSuztvx3Xw==;5:2BZJjECh/ZqyKf8JLxocDB2YGjAm3sMSXgSCGPLg8y1zu8c0ppc9RES+P85iqSVSpttUjIoXPLRUjjflLYHX+YxU3P0m2YF5zGZJ6pj6QSbazAeQw/A1MLWjWo1iH0vgOYB8GYWw/eFO9qU2weCG4necJqYE2PX/q/zU5rbTV0E=;24:E8IJlTMHjRGZKuZiMywOohbOoOvagqPNVw+u8MYUfMO1XEGSLjpCEtv9NUZzUuEUOsotJCe20sqxeOGlYYO6rFh9tyQFbclQ2P1gLghtNbA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN6PR05MB4589;7:bTFvq7KzV11L30y8+beQ+onr1vZeafXZMBbdz1K6sv3i71iQpcYsUsLt/xRykq3sEwcFMjgU2v+pbrosM1Ovj4akydqWSDg0qFlUjvZH7cGQEEDpYnIK1p9WhcqjnvpM7+m2wSvGGRBhOws+ZG+JRIREiM1RFlusv0n+4nJwLqv/LuDv32wMXUhrS6qhweDBRscSh11eqaObTOpLYCPdptFHm+bCa0BNxrSkOdk3T4QTmWupL7WLSn8pjaGxOdBp;20:OPyiZIhsPX4EG8u5koa7nrv56kHd2iJBwvfJucr2tQRa8y3rzU6vzPwtVFmqttrgRcQE8e871e6cRd4pvlts4oQ7F2VDSa0gB942KqGDAoztDnOHWTR2LMMu5uSu017J5pPA31EtKSgf1xg9SF8bV8qT0upAD+WRNvShC+Y0sbo= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 12:09:12.3570 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9ff8ab5-1e5c-4700-ca55-08d5d1efa692 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR05MB4589 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Resending hopefully better formatted.. 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