Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752578AbdI2QGW (ORCPT ); Fri, 29 Sep 2017 12:06:22 -0400 Received: from mail-he1eur01on0100.outbound.protection.outlook.com ([104.47.0.100]:35394 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752113AbdI2QGQ (ORCPT ); Fri, 29 Sep 2017 12:06:16 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Subject: [PATCH REBASED 2/6] ia64: 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:07 +0300 Message-ID: <150670116749.23930.14976888440968191759.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: DB6PR02CA0019.eurprd02.prod.outlook.com (2603:10a6:6:15::32) To DB6PR0801MB1333.eurprd08.prod.outlook.com (2603:10a6:4:a::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 769bcc9d-3066-4510-aa1b-08d507540170 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075);SRVR:DB6PR0801MB1333; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1333;3:wwNXUYFrjGh9DAbQ/2UUQOHy/pVx1Y642a+eqdU+xmC+Au/x7EPuLJm1R/aZmBHz+08ZjfxaBu0LyQKtoViyFhJAIjVXsvvUAylwv9lzCJzVnpLl8n5vdd5XryyWuHQNSPnyIt0VuQMlCELFXWzA9Wzv1/XzAslMY08us2cnmp5Yc4LIxHSoDsZdZ+mv9bGyBhyW9/0e2Ib4A8EHUTruX93Xn4JsFIJoHrn77sav+S90lJj0DQ5ZI5dGvz3bUo7+;25:xKxlWG/bV8KRL2TJ4lq+sMT55tjYMWAzFLiUnHoYQaSM1G3htO5+K5Wyrjf5SGj5Rlrzv8Z3HSZk5ftfwgcw/+y9k4MKU1rsEOTgKZE2byfrudNWbgkZKHDISpnpEXBQDNw4s5Bklb/jOEIX8i2iH7/fwflub9XT/ETpq9n+7Vj2WMoHVsL2kOE4X2U9c/4XeD2i1KuMnK+4NOCVvtqcZaFt/E/+nV3+bdDuV/+yXfRfEEMSBUFlxmFulYJaBIfRQvoJUMdmuU4CjyKqYUrHMFx3FMMkKlp8vhY9THLacDv4OAjY47aOkBwTvgjLQp2YlNGSdevap+ONbV4OZLhiMw==;31:Nh/aO+yL7/NY/rzzb0neuNbPLYN8KErJCrtLdsCOztCbSCBi5nbGPqLShzlKw5IySNpnAogzGIpbzWRjRg5BkICCfoLyej8rp/71FWY3ooFDG3CFKwDSMiBMTwP+ek2Cfec8qwPTjO2AFZEbg7VqitoWJ4O3pO5HKh7fOvoZqyP8Dh7oXioH4X1ffON3zadcBvVeEsOSTg/O025axTlge55b2bI/ruHXj9fAvNMnLcc= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1333: X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1333;20:Cm6zv7CzK5FY1zA5q8xRyF9RoPbQKfIqaC/RfzfHJBmNze8fqeo4CWZTE3HsYcZSIFKOGlWexNBc4Qfn/BBi/X2POHTKKsyVBqTsi8wDme419S2SjLoVPQ0BM3m49c5qwtsaoeb/XJVUZI45OPPGSQxjQSRdGoglTZ49o4yUsTThE2GjD6eAY5wnUVnxrWOFsuad2hgQmPYo4776UpuierbYC/IsxEdavOG9mobkmuriAv3XyciFX87yuQfB5J5WMdnR4ejGxoBhewDGRGLc4s0NcTALMkcUOJi3zwhhQTyKFGpHhnzu2U1B27oKgJYSO13iDPsqe6sMIIWcpUJJEXCczFPdku8ZgZ/QQfXqJHRn0pdhpGv6Xcv68z08WORsCRfP/Xgr6n4F5k5C5zj4q5iu2yV2H+6Yy1I2EHa1p8w=;4:41tlekJANkTQSrx7SNvEYKPC9iKmKxxPUPxM7P6vHDbH4p1cvnB+rIVGRKBp2+guvTdxp1+pvw9sP3S44OgnZRKhH7QNPyEXe7NjLH3wnjHdnenCWJgTnboNx2UCky+p+HJIeETZArFxX434F5cG28i/eqbiuOWW5mDmuNrf7J5fsJzcUuAuu4d3pLqTWDNMbMVZzdTqxoz2khVI1OBl4ucASAC9Nc301FsXOYYuhJTQsWOoGE6+971oBltPT16D 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)(8121501046)(5005006)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(6041248)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB6PR0801MB1333;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB6PR0801MB1333; X-Forefront-PRVS: 0445A82F82 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(6069001)(346002)(39830400002)(376002)(199003)(189002)(189998001)(7416002)(7736002)(66066001)(39060400002)(47776003)(25786009)(9686003)(50466002)(8676002)(81156014)(55016002)(81166006)(8936002)(3846002)(230700001)(6116002)(53936002)(305945005)(2906002)(478600001)(103116003)(23676002)(101416001)(68736007)(76176999)(54356999)(105586002)(58126008)(6506006)(50986999)(6666003)(2950100002)(106356001)(61506002)(5660300001)(316002)(33646002)(16526017)(86362001)(83506001)(97736004)(921003)(217873001)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB1333;H:localhost.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjA4MDFNQjEzMzM7MjM6ZU1mZGd5RmZjVUlnUElCZ3lxdUdkMTg1?= =?utf-8?B?T09vaThDVldPNU1hV2IxOS9lcFlpRUlCZjlTMGJqT0ExbmhJNVFodFpVdmZj?= =?utf-8?B?aEk2Mm5Yc3VOU0IvVkJDa2VCTThvTGlWQUYwK2l1M1ZIc0lLRDlsbUJXNkg4?= =?utf-8?B?QThobGJJYXQ2cFNXZWRSUTd1NU1pYi9xNmxlY0RHTGVrbGFQYjd3YndxZmJy?= =?utf-8?B?eVNHWnY2b2VRV0FvZHRPY0VUNTN6elBJcTJXdEVtWEhTMGxRZGtSRTl5WUI2?= =?utf-8?B?OUhuR2h0blpsZEpMM1ZENjdtNkZYTjJHbkZ2bTV4aVlteGR1N0NXSzUwQlhP?= =?utf-8?B?ckFCY0F0RUtDVkpySy9yWjBBUzJ1aTdUNElDN2oxY2tzdGFhVVQ3Ym9BWCtF?= =?utf-8?B?NHJEM1hVNEJ6eUZOTUpZNHk2b29hWFVQck9lcVpOM3FDRnBILzkyNkNORE9t?= =?utf-8?B?UitDU2RMOVQySkd4djdQYklmTVg4UE85cEdjMWR5aU5oNTVXUlZpbVpM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QEDGAeEbxFSS3Y131usZSDlFVVbqRzu/ZZz+xB2kj/zaWL6U1RTTUKy3+b8ZdQOBadgQHAF8IhG3jOmE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1333;20:I4CsDCtxLInItYrIV4gU+9j/gb/M8UQ85V+2RKd4WfDlmspySznrdgFS0h9iui1+3vsmlOb310cFT7ac2eH57XFogd/UzCND8xJlzpYWnE/7P82kCDzSg27COPaWewyrESU3tdcVJ84JP+XOW7y93ds5k7af5KmAwbe82bwrhhM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2017 16:06:10.7631 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1333 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1060 Lines: 46 Similar to __down_write_killable(), and read killable primitive. Signed-off-by: Kirill Tkhai --- arch/ia64/include/asm/rwsem.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/arch/ia64/include/asm/rwsem.h b/arch/ia64/include/asm/rwsem.h index 8fa98dd303b4..1fb8b7cb1c98 100644 --- a/arch/ia64/include/asm/rwsem.h +++ b/arch/ia64/include/asm/rwsem.h @@ -37,15 +37,31 @@ /* * lock for reading */ -static inline void -__down_read (struct rw_semaphore *sem) +static inline int +___down_read (struct rw_semaphore *sem) { long result = ia64_fetchadd8_acq((unsigned long *)&sem->count.counter, 1); - if (result < 0) + return (result < 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; +} + /* * lock for writing */