Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3753425pxv; Mon, 19 Jul 2021 08:00:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUSnPUQWWWVQs0irrNM9rllUTqrEGUml2Nnz24tWDfvnUPIu8Gdc4akuTkhDNUgI9sGD9x X-Received: by 2002:a17:906:368e:: with SMTP id a14mr28230285ejc.60.1626706836698; Mon, 19 Jul 2021 08:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626706836; cv=none; d=google.com; s=arc-20160816; b=fRPad5u7+1nFgeErEu5B7CQ67YaWPFGuRNGnOTUnePTttItxJHgLVDcNqQHlX+47E5 QqPA2MwWbJ4iYho0J/BpoYS9c6k/cXj1DEZJX31+nblJEnt6gJdOSX4zAcAW51gauCAo 7N3JvuuRzPS0MQJF6YUuQZVGhetApq3dP3Qi3YIUK0UDEJVEzdQF4f+GRMW4gXlSRKFU bWsETItHpgfdfMh9tORJw/VUEDxrZ7sACXRRkxDuLbWCUz5mYQdH85R48jIWMHAfk0Gu SM4MAuBfnDe64+XKjk86psoWJ0kgbYz21MFhhqjLjHGoXXItfe8C2qiT2KGKGZeDhw2e XVjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KK7nODvl1YuiQvqqtEeD47b6J7cOAf+pJ2XIu0SS8ms=; b=feJD764eq5btiOyWZvuy3q6oD7pGYyGfX/Yoc3O2BeMojLADx8IAXZiN/7e9qWDasM Ys0tRZK1FQU/HgQ+1z2QTlTZ2amcUFXIQgD/Aqsr3ymkZf3iAHFjn0z8JcaAFsi4gNyQ 6B0FrMUIonOza7Im4qd65n2JM+ljYnRhvehKEO37b3ezEq1GVTEzjjltc+XGnWJobe4O T3j9YSUnHNZAPkhBCBvRzFFmlgxwQHTXQQbSwWwDWyaq2znAYooD5X327zo8mZji9RMe Hln8hroeQWQiHY77UzGqVmp82DLBBZxVPcHsLaQ1X9Rhc7UseQOt6MZGSL8M4zU9SGiU mLdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iZ1Y1E8R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si24655285ejo.634.2021.07.19.08.00.14; Mon, 19 Jul 2021 08:00:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iZ1Y1E8R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241492AbhGSOQP (ORCPT + 99 others); Mon, 19 Jul 2021 10:16:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:48086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241423AbhGSOQF (ORCPT ); Mon, 19 Jul 2021 10:16:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B0FB0610D2; Mon, 19 Jul 2021 14:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626706604; bh=8+2BrykEWigHVwQnm0K2TRZqy/GpLyJZlT6xrz3FGSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iZ1Y1E8RTEsbiXaZqERUQUvHu9bxVNPbKM80ChIwPy1hspt2bCEgrmpX/wq+nTPb3 iUV86z7S/huILLLjtHKHAPxskHKUcQaZp5pQyYdUJfAhnDGiN7A2kXf+fHYTqez5D9 6KQI1E366TV0j5B4Dyh0oLRKfC6Ao7u+HC/O0Qvg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Oberparleiter , Vineeth Vijayan , Vasily Gorbik Subject: [PATCH 4.4 018/188] s390/cio: dont call css_wait_for_slow_path() inside a lock Date: Mon, 19 Jul 2021 16:50:02 +0200 Message-Id: <20210719144917.313436170@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144913.076563739@linuxfoundation.org> References: <20210719144913.076563739@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vineeth Vijayan commit c749d8c018daf5fba6dfac7b6c5c78b27efd7d65 upstream. Currently css_wait_for_slow_path() gets called inside the chp->lock. The path-verification-loop of slowpath inside this lock could lead to deadlock as reported by the lockdep validator. The ccw_device_get_chp_desc() during the instance of a device-set-online would try to acquire the same 'chp->lock' to read the chp->desc. The instance of this function can get called from multiple scenario, like probing or setting-device online manually. This could, in some corner-cases lead to the deadlock. lockdep validator reported this as, CPU0 CPU1 ---- ---- lock(&chp->lock); lock(kn->active#43); lock(&chp->lock); lock((wq_completion)cio); The chp->lock was introduced to serialize the access of struct channel_path. This lock is not needed for the css_wait_for_slow_path() function, so invoke the slow-path function outside this lock. Fixes: b730f3a93395 ("[S390] cio: add lock to struct channel_path") Cc: Reviewed-by: Peter Oberparleiter Signed-off-by: Vineeth Vijayan Signed-off-by: Vasily Gorbik Signed-off-by: Greg Kroah-Hartman --- drivers/s390/cio/chp.c | 3 +++ drivers/s390/cio/chsc.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) --- a/drivers/s390/cio/chp.c +++ b/drivers/s390/cio/chp.c @@ -257,6 +257,9 @@ static ssize_t chp_status_write(struct d if (!num_args) return count; + /* Wait until previous actions have settled. */ + css_wait_for_slow_path(); + if (!strncasecmp(cmd, "on", 2) || !strcmp(cmd, "1")) { mutex_lock(&cp->lock); error = s390_vary_chpid(cp->chpid, 1); --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c @@ -769,8 +769,6 @@ int chsc_chp_vary(struct chp_id chpid, i { struct channel_path *chp = chpid_to_chp(chpid); - /* Wait until previous actions have settled. */ - css_wait_for_slow_path(); /* * Redo PathVerification on the devices the chpid connects to */