Received: by 10.192.165.156 with SMTP id m28csp743061imm; Fri, 13 Apr 2018 07:07:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx48KTfPibPMmE/q4KyNdve19gF60uPfduh2irg5ZfZwfxwc9v6vv+NpLk+gjkZWN/rn6XiiB X-Received: by 10.98.32.199 with SMTP id m68mr11690908pfj.218.1523628424095; Fri, 13 Apr 2018 07:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523628424; cv=none; d=google.com; s=arc-20160816; b=xNwSWD+ee5lHFjfVW3x2FGlD0Tuu4X8nuA70vaDy5fs0QS04EFaj4NKw1fnKab3l96 kO0vOooykSjBkz7HqfWzfe0nHaEPBraQqtVwibE90eEdysQxGe2HW2gvc4Tedqbe55+X 1MGpd+RQ96ZaQJmm69D6rU485i4JI+6OtDV0KkFRniBma9O3jPlUjOjOOFiWajLYZxzl UoBcz9RfYO0lwpbSUfJB+JnfhYiAUccPQD582Cg7HpzaHMD8//fhio+jo5HaUWhZGwAa ISzMTf9wRBfCLVEXlHyuaHQcX0PRlmi1RWfebmkPeIsGfysXlEHZUKpSEPPwojw6lbll K4zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=eHl2pxlMLa0U8+EH3w2mFu8rZCxLSow6feSZkd6IwLA=; b=yAVvFiJ5pqIqCdiNRoLKi4A/sSCWqKFx/0QdWeo5ZZ1pRw02WmKejIsVX225zODIqd fMuSPa+ZDoRsp5LcarwRIRcsoZyHVLGkCFG+jHgTFttMt+M+rT/J69+WP+R8TEnFT+m+ lT0CNWkoiOIpwTGZLVPhfzK9O1tNfPIudpy8PDLzOTBixvtx38pmmwDooDGrrnFRbs+k Xlgv2etr5xFRm5Dtrj5ttOoMwuol/kBgzR6xzxm9EgICQdYDMb2P6994eD5NLd/oz7tS oXOKLae320K4qK8y4QVLCqGlZmvqOGJPbwhFBb7JUcD5XvrPZwyNrEVWpf3b/OGOUIqX kJ9w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k70si4172053pga.118.2018.04.13.07.06.49; Fri, 13 Apr 2018 07:07:04 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755048AbeDMOFO (ORCPT + 99 others); Fri, 13 Apr 2018 10:05:14 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60766 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754086AbeDMOFN (ORCPT ); Fri, 13 Apr 2018 10:05:13 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98E4D722ED; Fri, 13 Apr 2018 14:05:12 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52A64215CDC8; Fri, 13 Apr 2018 14:05:12 +0000 (UTC) From: Cornelia Huck To: Dong Jia Shi , Halil Pasic Cc: linux-s390@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Cornelia Huck Subject: [PATCH] vfio-ccw: process ssch with interrupts disabled Date: Fri, 13 Apr 2018 16:05:09 +0200 Message-Id: <20180413140509.9042-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 13 Apr 2018 14:05:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 13 Apr 2018 14:05:12 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we call ssch, an interrupt might already be pending once we return from the START SUBCHANNEL instruction. Therefore we need to make sure interrupts are disabled until after we're done with our processing. Note that the subchannel lock is the same as the ccwdevice lock that is mentioned in the documentation for ccw_device_start() and friends. Signed-off-by: Cornelia Huck --- drivers/s390/cio/vfio_ccw_fsm.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c index ff6963ad6e39..3c800642134e 100644 --- a/drivers/s390/cio/vfio_ccw_fsm.c +++ b/drivers/s390/cio/vfio_ccw_fsm.c @@ -20,12 +20,12 @@ static int fsm_io_helper(struct vfio_ccw_private *private) int ccode; __u8 lpm; unsigned long flags; + int ret; sch = private->sch; spin_lock_irqsave(sch->lock, flags); private->state = VFIO_CCW_STATE_BUSY; - spin_unlock_irqrestore(sch->lock, flags); orb = cp_get_orb(&private->cp, (u32)(addr_t)sch, sch->lpm); @@ -38,10 +38,12 @@ static int fsm_io_helper(struct vfio_ccw_private *private) * Initialize device status information */ sch->schib.scsw.cmd.actl |= SCSW_ACTL_START_PEND; - return 0; + ret = 0; + break; case 1: /* Status pending */ case 2: /* Busy */ - return -EBUSY; + ret = -EBUSY; + break; case 3: /* Device/path not operational */ { lpm = orb->cmd.lpm; @@ -51,13 +53,16 @@ static int fsm_io_helper(struct vfio_ccw_private *private) sch->lpm = 0; if (cio_update_schib(sch)) - return -ENODEV; - - return sch->lpm ? -EACCES : -ENODEV; + ret = -ENODEV; + else + ret = sch->lpm ? -EACCES : -ENODEV; + break; } default: - return ccode; + ret = ccode; } + spin_unlock_irqrestore(sch->lock, flags); + return ret; } static void fsm_notoper(struct vfio_ccw_private *private, -- 2.14.3