Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752558AbdI2QGM (ORCPT ); Fri, 29 Sep 2017 12:06:12 -0400 Received: from mail-eopbgr00120.outbound.protection.outlook.com ([40.107.0.120]:1152 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752405AbdI2QGG (ORCPT ); Fri, 29 Sep 2017 12:06:06 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Subject: [PATCH REBASED 1/6] alpha: 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:05:56 +0300 Message-ID: <150670115677.23930.5711263025537758463.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: DB6PR0801CA0055.eurprd08.prod.outlook.com (2603:10a6:4:2b::23) To AM5PR0801MB1330.eurprd08.prod.outlook.com (2603:10a6:203:1f::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3359b41a-ff76-462a-c480-08d50753fb21 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075);SRVR:AM5PR0801MB1330; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB1330;3:la1ZK68gjFXtw/+wmBu95qqYpQbLkDlqNGQidWWFCwmNROveknCM2LiC7oox1uznc7xwTLAj2/oXRnqrYu0iNVl+O9SB+B5MvCmxbv6lsuckWxWgvti9403X58EDLkAHjddRwqgWJU5+yUMOsu2a0P2FVrrXInW3IjS/yvZTFPN7mXKCYOxvts1rnD3Kr2JCH6fhGik1QrM6nYp+818HSievZupA+9kWkSGl3S8CXxenKcohWdW/fRsyGCc29/Cj;25:EKUXg9PvkicJ9Y37JxWOC/+AI36JSCWHBhSkvV7EWACPf8OgOuD9hy8sxWFRHbx6z/vPjp7iDHQxBLA8/5D50KwD3ioqWnnwvoIlFm9wenHtUiBpdwrPak3rYuL+Kg4k0YQd2BS8j80cbKkg+iMobdT9yMwpsLbiQy4rUxLS+wC16XN9nh1mjntf+CaDc18ElfFXHHhyHA4souTE5o0NEf1sU9PYTA/9kr+RFTtq+h/lRnLmnkLor5oqQdrlz/+eSJngPSqofvxpBZm91Nb+dxlcZTDCoJ6df106QGbueKEn4PIrh+CvQrlJnyKJVi97RRWZSbQBRpChuWL6xgHHBg==;31:HeRtdBwkOmJw8IKqZfRp0rzl6qSa5CfAG09dE6OmDGODXJZ3/ZYJqicdXK1bm5UQeNsYNJMoup5UhZzWBfFWL75mEW8NJVm2tjm/vziehaGGk2eVxJ1mdUm0JfmCMEwZ3SaHEKyJdQ3d8eDe42U1dFFMW5iy73OHDAJ/ggaqXHqbzW6QBbghLvHM/WA+0JFZVA8xY8tR6rWm21NfDowKqIlBYcToFootwuAhPehOSRg= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1330: X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB1330;20:LHwMw8UZNLg1/tlzgBuapmfTIhGG6Y5uP0lVp1vtzA7Z2kFwu+695pkTR6QTewnhKVTL5YZnKUFo2VFtVpEISp4HwupoQzfSpXlNHA5lFZVUL+N7CG2rgSD2vUr+tpXiuWhqihtkWQMrP0J7NzUJEV65Qf0TwpcpRlTIwa3XByquU9Q4jvNZQPVhDEPr6qQ7p4FADhO8657nVKN0+bFJyVyu7mnKGmi79MARyeJCqk27A/z+vd+5bSsPvYuihfmG1ors03i4xot37CjIFI7PdHIAAchRxIp6RKmNb+b9aL9FSDV3ZCJUUvB12teRVEhu57TmufKaQq9hlMDdpcCbmG4HP1sELwxTCaP4202wZh3xouzBQ/3pZlHfjHvEYBYUM5L4NHlt4Yio7O2/eJ3vxUOfgaJEj/eSarSreaBVo5I=;4:X7CAjLkPeY05tFN19Y5zOc90aj/Iy39VsmU3CHK1M1UiWpz0Q6WuijmgplceU/tiB9vYvjeb3zDL8WdUdjVJYXxRHI1A/LMd+clgXEx8UUQaFV6MEnfKtOrObUbnks9BhUg6lupauNZVwhCKTY+4nHhUrmtGehoEZhM5CQdDPoyWMkz7aHFc0rAZO/IQ8LIC0+PJ5vUvK+PviXzbflNwVWxW8eGWbwRaZSPpJRuRNELd+FpzDlikq8eribrhvK44 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)(575784001)(76176999)(54356999)(189998001)(50466002)(50986999)(5660300001)(53936002)(3846002)(6666003)(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?MTtBTTVQUjA4MDFNQjEzMzA7MjM6S014K3J2M1hBcy9yYW5nQm1hakJJZllw?= =?utf-8?B?bU5oYmRSeDliYlFBOVdYRHEzSG03MGVVSlZwM3hkVitheFM2TENlTHNic3da?= =?utf-8?B?UzlKZHRkdmNqd2xIQ0pKODREb0VrcitkdC9aYTdjRmE4WHpYNU1Xa3RSVG9v?= =?utf-8?B?U3RmQ29QN1V1TFk3REFrSDJCZGV3NG1WZnN6M2VSTWc4MEMwb3VZcDVUZGR0?= =?utf-8?B?ZWE5VGtlWnpBS3Jmc3owOUtzb1Z3WGdCT3h6bCsrdmJQanY1d0wvb0hlaFhL?= =?utf-8?B?bVg3SG5jcXNGTEhqY21GODJRUFlMNFlWTkpwZmp1Y2E5VHJtU0sraHIrZ09s?= =?utf-8?B?Sk5mOW15Vk52NjdCTlB0S2tla1lmcWJPdE9qMzI0SkR1ZUloREc2US9Nb2o1?= =?utf-8?B?RDV0enFPMk54a0ZaS0orRnVzOUc5cUJjeTRkeW52ZE02emNHYTQvRjdJdERp?= =?utf-8?B?ZXRoK3VqM2VaeHFQb015eXhsRm9vVVdJSTdreXRuNFdnclRDMDg3d05WUFlu?= =?utf-8?B?TDZFRmZYWGRoV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ff94WI4SZYRopzhzaipyo4B7FDqWfVqTY8F5CtphDYvi5F6Zcgp4Orm0pxit1tOdisHxfUiS025nmoUCAyT/5nofeSDO9pWA1Mto4A0a861Za4F7Es= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB1330;20:NMR/WdroWSmMPzgPK1loxlCIUya/ix2/9blMGwpXqDzUL3zkpzaZX41BmHTpiwyOWP+5zN7SoE4+Yn4uL6ACkmcAumd3rHj9PIFgAWCBiMGY11zwDeS96XIXMgTNFSQt20/SqYsmZhy9T18b3XXVh7CReh/Q0iflw4PeDCKTgP8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2017 16:05:59.6172 (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: 1390 Lines: 46 Similar to __down_write_killable(), and read killable primitive. Signed-off-by: Kirill Tkhai --- arch/alpha/include/asm/rwsem.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/alpha/include/asm/rwsem.h b/arch/alpha/include/asm/rwsem.h index 77873d0ad293..7118bd090085 100644 --- a/arch/alpha/include/asm/rwsem.h +++ b/arch/alpha/include/asm/rwsem.h @@ -21,7 +21,7 @@ #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -static inline void __down_read(struct rw_semaphore *sem) +static inline int ___down_read(struct rw_semaphore *sem) { long oldcount; #ifndef CONFIG_SMP @@ -41,10 +41,24 @@ static inline void __down_read(struct rw_semaphore *sem) :"=&r" (oldcount), "=m" (sem->count), "=&r" (temp) :"Ir" (RWSEM_ACTIVE_READ_BIAS), "m" (sem->count) : "memory"); #endif - if (unlikely(oldcount < 0)) + return (oldcount < 0); +} + +static inline void __down_read(struct rw_semaphore *sem) +{ + if (unlikely(___down_read(sem))) rwsem_down_read_failed(sem); } +static inline int __down_read_killable(struct rw_semaphore *sem) +{ + if (unlikely(___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 */