Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752594AbdI2QGb (ORCPT ); Fri, 29 Sep 2017 12:06:31 -0400 Received: from mail-eopbgr00120.outbound.protection.outlook.com ([40.107.0.120]:20640 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752108AbdI2QG0 (ORCPT ); Fri, 29 Sep 2017 12:06:26 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Subject: [PATCH REBASED 3/6] s390: Add __down_read_killable() From: Kirill Tkhai To: linux-ia64@vger.kernel.org, avagin@virtuozzo.com, peterz@infradead.org, heiko.carstens@de.ibm.com, hpa@zytor.com, gorcunov@virtuozzo.com, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, mingo@redhat.com, mattst88@gmail.com, fenghua.yu@intel.com, arnd@arndb.de, ktkhai@virtuozzo.com, ink@jurassic.park.msu.ru, tglx@linutronix.de, rth@twiddle.net, tony.luck@intel.com, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, schwidefsky@de.ibm.com, davem@davemloft.net, rientjes@google.com, viro@zeniv.linux.org.uk Date: Fri, 29 Sep 2017 19:06:18 +0300 Message-ID: <150670117817.23930.13068785028558453848.stgit@localhost.localdomain> In-Reply-To: <150670038738.23930.7190484711222807884.stgit@localhost.localdomain> References: <150670038738.23930.7190484711222807884.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR02CA0007.eurprd02.prod.outlook.com (2603:10a6:6:15::20) To AM5PR0801MB1330.eurprd08.prod.outlook.com (2603:10a6:203:1f::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bf5855a0-a9fb-44b1-a162-08d50754076a X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075);SRVR:AM5PR0801MB1330; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB1330;3:v8gPxreY42K0FEMg+MUg2TwxLRLHF0UgjzZyt+ckTrJlBK65nPClo6v05RL/LB+nlkMVXwVkPZFo4f9CheJE9r5ayh2+4ei4tfgMQl/gGjPIbSNNs9ru2mpp/XvoIRlYApcuaNEtoTkmIumVRu3XxzkeCNXIT8UJad9tfTPLPXIEg+6wusSjviMdM/2c38p7D424Uxijiz1tKaI5cxB96Df3KrBOdR9BnVnu/UIYbwGswkziq/ONkR7vKDvxKRGw;25:njOehFDNMd1znv1DkyFYY1Hd89p62AU0uKIQ0rtag9VRnjm4bTeBhTU+6ZfWf9aFBOY9AIYFZ3NKPKY/lEpPx9Js5Fkg2T98pBvO1Ns2QCD5Irf3H7xi1j3wbJADlU+lGVjZmhaxksjyIdkLn3URkf8w+833NL4S7QkLbqsV3yujYZ7ON27ozAWeOgFIz2WiTrwS76+oFVFkSAHw62TmRUamCQMLXdkZQ5KpIhWPk/EVLF5QXpWLz2eq7GFuvoP46qBPpXWxpE4W/7D5IQYcVvdFdtRIiDbP5I39mxSiqI89tMKr9D+JiyHq6djUf1TGPg5T8I92GIQCi0iaz6N9Gg==;31:rXE4VmMEfCkbcqJHlTzwVlqtIr5m4UwUtV7wQyeffrK62xXhPjYxZ1AdE5K2qs0yZA387/rVG9gwXjWie0kot9udSrd85DJOlfB6ROsH1SmybjUmTbYZhjsQS9Tr8YNMhJlD1jDoRQYyN1Fy7ctFzfYXP2TJbBf4t4aQWiwTct586K1PzPAIo2JS1QFbKRgnlIYwKY2WmSh3C2zul/DTmCRrs1pS9OWlfB7TjaLZ/gA= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1330: X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB1330;20:2MmTTQNF0XU/U6t+OebljyRhUdPkUe5V0hvjLAbTouXbA0HCZpfXawSbH4qLwj8jDFCZ9Vz7OTXxBHP/GqCyGAkyexUB/hrXGAfEl7Bn1wtM4oHtQqUKHcdsg9Z5255ZRkdQQ+LC5JDfV13o540hWesbn9ipBcNCZOhsZIMvkL24NckNdh7mL642rUZyYRPKJQ6DIjkapsrjk2nqpEYZ8jnf7xdc2u9hF2mq2Oc3IECS/jJ1h361hBhdRQudU8RXp1YFo7IFs/nps5qDqZ3aodBn80lrY0Onszvv9h5Hlx8RyoM8k4dXrM8EttgVnQwtSggzNiT/U8ik5AKFLxB/4gnrmSqlB0qd8JxFjs1fdWZp0ss26/nqV56DNvTdiZ3PG0WducC/9n/niTGufEpwQBNw24klIhblado7az+XAfA=;4:Esu+F4PEfBmbHZlizTrlJYMlcB8lSTPBRpU/WELiAcDckqpzNuNpyWG0wK0mBP4yd7E/xUcFdwC8QgDofpcTDcoGG5zNgJ5aUw/oBvkGkw3mRVq0IKomiqK9JTyqlg/G/tuy+mxKSCyzEsGBoUdj9I8Y7FX4PECNlrDx0KIkQBa3Vy6Ooi0UzoNWLxBw7U3ZDF/TjHNQipV0EzXDfg+nfqrqAnkf+zWl6zsmlMds0FJARNKdB8D4ji1he8MyWV+S X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:AM5PR0801MB1330;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:AM5PR0801MB1330; X-Forefront-PRVS: 0445A82F82 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(6009001)(346002)(39830400002)(376002)(189002)(199003)(68736007)(83506001)(8676002)(101416001)(2906002)(106356001)(105586002)(103116003)(81166006)(478600001)(81156014)(7416002)(9686003)(33646002)(316002)(25786009)(6506006)(230700001)(305945005)(86362001)(47776003)(2950100002)(39060400002)(23676002)(16526017)(76176999)(54356999)(189998001)(50466002)(50986999)(5660300001)(53936002)(3846002)(8936002)(55016002)(66066001)(97736004)(7736002)(6116002)(58126008)(61506002)(921003)(1121003)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:AM5PR0801MB1330;H:localhost.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTVQUjA4MDFNQjEzMzA7MjM6b2JPODNCWFFUOUd0MU9Mc3NHWHlWU3o0?= =?utf-8?B?V0Q0S0J1aFdWMmVZSEhOaGpac3NKRy85OFdkT1J0VVR2QmFVQU42RTFsQ3g2?= =?utf-8?B?dHNYSzZWaVBHeVZRbWF1dHV4RDhoVnA1UTlDdVRDUE0zd2hWdW9DRk1GRVRL?= =?utf-8?B?VzlpY1R5akEwaUJIcGRGNzhNTjZjSVRaa0pCYnFabUZ2RURIMGk4eEVnSTBD?= =?utf-8?B?b0VYQ0hBa2VjNDJ0YXdadGxCenlTYzlGS3JqSzFmWUJiaWZtbHFYU294OEpL?= =?utf-8?B?YmMvTVVBMVJaMlRjVUpRQldaMTdIWUlob3BwbjJqV2h4L0ZlVElIanFTUDM3?= =?utf-8?B?WEMweWg2K1dCNk5YRXdseWdUelV6bG1RMk9md000ekh0ajV1cHRSbDBaS0tk?= =?utf-8?B?bFVYTjkvMks5M3BmTHNVMGc2NGF2QVo1WTRJa2hYNGJKY0xYT1kwcTJuUlN3?= =?utf-8?B?aXF2VWhRcjJKcE10SVNIOHBqZFE0MzBwamM4VTR6bmNkNU5HY0h6OXpMWVFM?= =?utf-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GfR38LvLZf8PNslxZlvsfY14/8Je5mVnyIX0oZYaEO78H2dGjHFSbZeTiHEg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB1330;20:zssjGoA/PKjJDOqQTVVs4S+GHa/HQRRB8RzbpSlmfjGcHbtm5w67UVsRe9rxKrCqw0XHSNOX89cpVVDh7UbyzUs9+kMI7CYKJXddPUWtykJeZj424Kp+PyBMRrYvuL4lZSNua5rE1iih8EtkayqzPbDmo2WVZr4wiCy2b/Eyooo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2017 16:06:20.4149 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1330 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1234 Lines: 46 Similar to __down_write_killable(), and read killable primitive. Signed-off-by: Kirill Tkhai --- arch/s390/include/asm/rwsem.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/s390/include/asm/rwsem.h b/arch/s390/include/asm/rwsem.h index 597e7e96b59e..6bef7d5fbf1c 100644 --- a/arch/s390/include/asm/rwsem.h +++ b/arch/s390/include/asm/rwsem.h @@ -49,7 +49,7 @@ /* * lock for reading */ -static inline void __down_read(struct rw_semaphore *sem) +static inline int ___down_read(struct rw_semaphore *sem) { signed long old, new; @@ -62,10 +62,24 @@ static inline void __down_read(struct rw_semaphore *sem) : "=&d" (old), "=&d" (new), "=Q" (sem->count) : "Q" (sem->count), "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory"); - if (old < 0) + return (old < 0); +} + +static inline void __down_read(struct rw_semaphore *sem) +{ + if (___down_read(sem)) rwsem_down_read_failed(sem); } +static inline int __down_read_killable(struct rw_semaphore *sem) +{ + if (___down_read(sem)) + if (IS_ERR(rwsem_down_read_failed_killable(sem))) + return -EINTR; + + return 0; +} + /* * trylock for reading -- returns 1 if successful, 0 if contention */