Received: by 10.213.65.68 with SMTP id h4csp1691533imn; Mon, 19 Mar 2018 10:40:57 -0700 (PDT) X-Google-Smtp-Source: AG47ELsPY2l1pwgIxEk2mqyjhqA7ePEDqCWHt1EFs+gtEG8C6rnS7MNN70wRfde5INoOU5mn5uOA X-Received: by 2002:a17:902:7c15:: with SMTP id x21-v6mr13202508pll.3.1521481257564; Mon, 19 Mar 2018 10:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521481257; cv=none; d=google.com; s=arc-20160816; b=kr+NKSPVvdj8mBdMePfZU/7WYsYLW0w/r4ZNSJrNk4Waqez2ysmpte2jcWr4KRIews IMmMBIyW6ndY9l9KK4NrwMPSrXf1X7jq/isvmw2NiDtDFxrkgzHH6uS6OfqeymfyPFn4 OiJlhUgi9uq3kFP2C12U5Oi2B2Fmi2j1qCXIo9l9Jh32Q6Gt+78PrEsymJuJswOc1CHI eEgibo9aAnUjFV70DtaStVRh+B4ICcTCcxNhr5V54QtJNKqEhYg3O7+Rf4bAmgHuxU6c oqEt8ZbpnZFhdCBBzXhNaGuhPgueaNycvDAzxqLvLpbwjTdB4Tc4N/HNasxKgc4w7FEw PI1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=tpdgCxmtAceIB26kXtXHPhWL4H4JmCSzMclPi4qKeJk=; b=ZzoJUmcqxxWjPvmFwgr+AsxzAmauVMCikuFSaNeJdDjvdCw65K+JCb4alShwAv7fpq +mATOwYPiD6z5azJwV++4rN87hT2JJobk2uNUExZEr3OJfg9m3AF5p76ZrboX3ZOt01/ fYIbRJxTr56Y+5nleKdcIqCTtvh/rnwIHsfHjg6ZrWTwEfhQ3K5yyG6Edgx8EvFRuIWc oEoH9EJGWBH9OJzgkG87VCzdolONfas7hHV+cdJw7yT/De0IaczsFx3KtRkLC+u9RfwU Ojsm8MxJDmojmfiQPZMvt02x4oyShTegJMopvdPOHAUKPgwKQgMU2GOEq2ulVJtv5jTH +R7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=RAJ9X/uJ; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e2si264239pgr.242.2018.03.19.10.40.43; Mon, 19 Mar 2018 10:40:57 -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=@microsoft.com header.s=selector1 header.b=RAJ9X/uJ; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967371AbeCSRjB (ORCPT + 99 others); Mon, 19 Mar 2018 13:39:01 -0400 Received: from mail-by2nam03on0122.outbound.protection.outlook.com ([104.47.42.122]:28800 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965963AbeCSQGl (ORCPT ); Mon, 19 Mar 2018 12:06:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tpdgCxmtAceIB26kXtXHPhWL4H4JmCSzMclPi4qKeJk=; b=RAJ9X/uJ6nrXrpy6ySuSkAER2cdM1dpowsN/kVIh46I2JPxwy28hFSQtZw6FjresDgEjcOvRZGdGT33jU4C5zozEgB0VEWLo7WZlyNKhKyWaHO8XhYVURqPgRilYN0N0feRsJMODgm9KZJ7e6faDZTZFjNVJguQ8ZKyq3+S2ZTs= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0920.namprd21.prod.outlook.com (52.132.132.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:06:39 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:06:39 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Julia Cartwright , Shaohua Li , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 002/167] md/raid5: make use of spin_lock_irq over local_irq_disable + spin_lock Thread-Topic: [PATCH AUTOSEL for 4.4 002/167] md/raid5: make use of spin_lock_irq over local_irq_disable + spin_lock Thread-Index: AQHTv5wUA5j6AUp/bEimVjMaS8LAAg== Date: Mon, 19 Mar 2018 16:05:21 +0000 Message-ID: <20180319160513.16384-2-alexander.levin@microsoft.com> References: <20180319160513.16384-1-alexander.levin@microsoft.com> In-Reply-To: <20180319160513.16384-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0920;7:51iVXe5e6qrY6s2M4ET34pIvyKGuCA6Eoete0em9Mkx6AfeJOTM5PLuwEEQ7i1mn3LibPKXDLUdbeXV9Pf1/pvoj6RY2WMHtB8bN01moeRfGmNcVIVJkOTWKzyavKMll1AAZr3PIe5upGiExZJX4Tt2K7YCYZMw75gTvyXWXrX1vOekBdzCzmKR/GrnYNNglgFrkU+aHMizvnFVipmqSz1ciM8uKIBn7fix3hfe+I4CzBvJNauTC7An5D9ezXJl7;20:vq1FCuSDzbrWwOXPOSG2LCgjR39Rc05cmM6J9enc2LnFautn6gcm38dtJ8Mzq6ScBVgPjOMxCB5ejMFYv8lNAF9QrEXdyBkNedQpMPLVdZDygkOxOC5JoMlphKoa/I6n0uGqIUyeYYTGYXmoXMfXpypsp4+PmhSVOD1Q1Uc/MPE= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b9517fe7-82f3-496f-8302-08d58db36632 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0920; x-ms-traffictypediagnostic: DM5PR2101MB0920: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(67672495146484)(145744241990776); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0920;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0920; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39380400002)(396003)(376002)(39860400002)(366004)(51234002)(189003)(199004)(5890100001)(6512007)(14454004)(2906002)(2900100001)(8936002)(186003)(86362001)(5250100002)(316002)(97736004)(2501003)(6116002)(1076002)(3846002)(81166006)(6436002)(6506007)(59450400001)(6486002)(26005)(72206003)(81156014)(53936002)(102836004)(478600001)(10290500003)(8676002)(107886003)(6666003)(4326008)(3660700001)(66066001)(25786009)(2950100002)(86612001)(36756003)(54906003)(110136005)(3280700002)(7736002)(305945005)(5660300001)(4477795004)(76176011)(68736007)(22452003)(10090500001)(105586002)(106356001)(99286004)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0920;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: lWMnlA0AADFuFIzOS6rdhCd+RWM8MDwme528rAjjzAejyH7hFGU3psKiNhZ5CL2CDbQLZUa1iTxm3ESOLRVk50hGDeNv3RrVwhPZ3uW/EInZaBmF06jNn64dyd8mRCLPCgkWwbXoWgALldOk3blIfb2r2hsRIueM9ZHrkDMQahjSXKEAFCggw/fiQXRi3IP05tvoy0X+IVz93tSQCyqeKeVneYYUwAoTrK0zyr9bTxWixntBj0uLlJAZDd/qc9TVDARXr2lM6K55pxdcB0h7kfaAHlxeTc8SSusZS5SbvQ5imEKlJQc9MqcWTOx5zMAKK/EWKiA7Vju3j7z2yfOEuA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9517fe7-82f3-496f-8302-08d58db36632 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:05:21.2646 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0920 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julia Cartwright [ Upstream commit 3d05f3aed5d721c2c77d20288c29ab26c6193ed5 ] On mainline, there is no functional difference, just less code, and symmetric lock/unlock paths. On PREEMPT_RT builds, this fixes the following warning, seen by Alexander GQ Gerasiov, due to the sleeping nature of spinlocks. BUG: sleeping function called from invalid context at kernel/locking/rtm= utex.c:993 in_atomic(): 0, irqs_disabled(): 1, pid: 58, name: kworker/u12:1 CPU: 5 PID: 58 Comm: kworker/u12:1 Tainted: G W 4.9.20-rt16= -stand6-686 #1 Hardware name: Supermicro SYS-5027R-WRF/X9SRW-F, BIOS 3.2a 10/28/2015 Workqueue: writeback wb_workfn (flush-253:0) Call Trace: dump_stack+0x47/0x68 ? migrate_enable+0x4a/0xf0 ___might_sleep+0x101/0x180 rt_spin_lock+0x17/0x40 add_stripe_bio+0x4e3/0x6c0 [raid456] ? preempt_count_add+0x42/0xb0 raid5_make_request+0x737/0xdd0 [raid456] Reported-by: Alexander GQ Gerasiov Tested-by: Alexander GQ Gerasiov Signed-off-by: Julia Cartwright Signed-off-by: Shaohua Li Signed-off-by: Sasha Levin --- drivers/md/raid5.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 86ab6d14d782..0feffd3e29e7 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -110,8 +110,7 @@ static inline void unlock_device_hash_lock(struct r5con= f *conf, int hash) static inline void lock_all_device_hash_locks_irq(struct r5conf *conf) { int i; - local_irq_disable(); - spin_lock(conf->hash_locks); + spin_lock_irq(conf->hash_locks); for (i =3D 1; i < NR_STRIPE_HASH_LOCKS; i++) spin_lock_nest_lock(conf->hash_locks + i, conf->hash_locks); spin_lock(&conf->device_lock); @@ -121,9 +120,9 @@ static inline void unlock_all_device_hash_locks_irq(str= uct r5conf *conf) { int i; spin_unlock(&conf->device_lock); - for (i =3D NR_STRIPE_HASH_LOCKS; i; i--) - spin_unlock(conf->hash_locks + i - 1); - local_irq_enable(); + for (i =3D NR_STRIPE_HASH_LOCKS - 1; i; i--) + spin_unlock(conf->hash_locks + i); + spin_unlock_irq(conf->hash_locks); } =20 /* bio's attached to a stripe+device for I/O are linked together in bi_sec= tor @@ -726,12 +725,11 @@ static bool is_full_stripe_write(struct stripe_head *= sh) =20 static void lock_two_stripes(struct stripe_head *sh1, struct stripe_head *= sh2) { - local_irq_disable(); if (sh1 > sh2) { - spin_lock(&sh2->stripe_lock); + spin_lock_irq(&sh2->stripe_lock); spin_lock_nested(&sh1->stripe_lock, 1); } else { - spin_lock(&sh1->stripe_lock); + spin_lock_irq(&sh1->stripe_lock); spin_lock_nested(&sh2->stripe_lock, 1); } } @@ -739,8 +737,7 @@ static void lock_two_stripes(struct stripe_head *sh1, s= truct stripe_head *sh2) static void unlock_two_stripes(struct stripe_head *sh1, struct stripe_head= *sh2) { spin_unlock(&sh1->stripe_lock); - spin_unlock(&sh2->stripe_lock); - local_irq_enable(); + spin_unlock_irq(&sh2->stripe_lock); } =20 /* Only freshly new full stripe normal write stripe can be added to a batc= h list */ --=20 2.14.1