Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3302949imm; Fri, 25 May 2018 03:25:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqORQyXqWbtQCE/eow9Q0z0hV4sf1FjEQ63IqTxXD72pu6MbjK1VgBxtKtqNmNzih2k+J/K X-Received: by 2002:a17:902:b696:: with SMTP id c22-v6mr2040213pls.262.1527243925367; Fri, 25 May 2018 03:25:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527243925; cv=none; d=google.com; s=arc-20160816; b=aMYI/l2WkkOTl0FfuL1bwUSms2eDbesCZH2VmmIG4w3D4O8QsgrMA0Of8RB7qHM+8h zSHA4IVdBPeTl4txCpammBDQItyJdLRetca/v/+g2Y/GNdK85piBHwVwHB7UBxBRiX4D vncLdhEh92r2lQnZDAm9kaBFpW+8zI0Q8a0ESWL5toEIjF1AGDcfWu1N45fPRGGP0Y2X 0nijI/R0uf2xL4E5tne5T5c80Q/SJa7HBw/OSue2WqzA2zq5C+UWHOXI5MrxD8A6aWAj lreV93Se2xFIjDAhyXRwS+tZmAU+pdkTGIJPaMAR84TkqKo6FRudKGRx3Bsb1ClLQktG 1LLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=a7tO4SA70v7kQPirKbRI/b6qO40sDRfY93ruSvwymJU=; b=FFxcru6nWr2Ao1dFYVMUioMQuow8meFPyIeIEFbd1Mm4jKRwpMui12XwTMaLDElFZi 8EOZyogRnHrjy8A6ffAGaCKZxkue/O27Ku/KtYPsQF+ggDOj7ijj5Sy8nLSde69DN747 fG455a5m5kE+UXopwBkD18KtOn4j6SgITQ6ad3zJzJv37AB+uKcQ+LFLrQ7jc7i7c2kD hXdPlRoZeFOvyGQ/i3ReU5wY0Ankz/5TjC8dgbHe8olEWzSHX9hTN1fEq2mtelFmoP6Z m8yDxyd9cf0g2pQQSc7TlusrT1sbzYmN/1mgJs6eiwNqqx3hawTv60m6wT5Rm6ExLgYN oKMw== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e20-v6si18089625pgn.130.2018.05.25.03.25.10; Fri, 25 May 2018 03:25:25 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965795AbeEYKV1 (ORCPT + 99 others); Fri, 25 May 2018 06:21:27 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34684 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965370AbeEYKVZ (ORCPT ); Fri, 25 May 2018 06:21:25 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4P9sMqZ194945 for ; Fri, 25 May 2018 06:21:24 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2j6es7w739-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 25 May 2018 06:21:24 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 25 May 2018 11:21:23 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 25 May 2018 11:21:21 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4PALKUB16187856; Fri, 25 May 2018 10:21:20 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 78D3EA4057; Fri, 25 May 2018 11:12:38 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C865A4040; Fri, 25 May 2018 11:12:38 +0100 (BST) Received: from morel-ThinkPad-W530.boeblingen.de.ibm.com (unknown [9.152.224.33]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 25 May 2018 11:12:38 +0100 (BST) From: Pierre Morel To: pasic@linux.vnet.ibm.com, bjsdjshi@linux.vnet.ibm.com Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, cohuck@redhat.com Subject: [PATCH v2 01/10] vfio: ccw: Moving state change out of IRQ context Date: Fri, 25 May 2018 12:21:09 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527243678-3140-1-git-send-email-pmorel@linux.vnet.ibm.com> References: <1527243678-3140-1-git-send-email-pmorel@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18052510-0012-0000-0000-000005DA7F8A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052510-0013-0000-0000-00001957D348 Message-Id: <1527243678-3140-2-git-send-email-pmorel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-25_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805250113 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let's move the state change from the IRQ routine to the workqueue callback. Signed-off-by: Pierre Morel --- drivers/s390/cio/vfio_ccw_drv.c | 20 +++++++------------- drivers/s390/cio/vfio_ccw_fsm.c | 14 ++++++++------ 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c index ea6a2d0..57ae1ab 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -70,20 +70,9 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch) static void vfio_ccw_sch_io_todo(struct work_struct *work) { struct vfio_ccw_private *private; - struct irb *irb; private = container_of(work, struct vfio_ccw_private, io_work); - irb = &private->irb; - - if (scsw_is_solicited(&irb->scsw)) { - cp_update_scsw(&private->cp, &irb->scsw); - cp_free(&private->cp); - } - memcpy(private->io_region.irb_area, irb, sizeof(*irb)); - - if (private->io_trigger) - eventfd_signal(private->io_trigger, 1); - + vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_INTERRUPT); if (private->mdev) private->state = VFIO_CCW_STATE_IDLE; } @@ -94,9 +83,14 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work) static void vfio_ccw_sch_irq(struct subchannel *sch) { struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev); + struct irb *irb = this_cpu_ptr(&cio_irb); inc_irq_stat(IRQIO_CIO); - vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_INTERRUPT); + memcpy(&private->irb, irb, sizeof(*irb)); + + queue_work(vfio_ccw_work_q, &private->io_work); + if (private->completion) + complete(private->completion); } static int vfio_ccw_sch_probe(struct subchannel *sch) diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c index 3c80064..24e1e04 100644 --- a/drivers/s390/cio/vfio_ccw_fsm.c +++ b/drivers/s390/cio/vfio_ccw_fsm.c @@ -172,14 +172,16 @@ static void fsm_io_request(struct vfio_ccw_private *private, static void fsm_irq(struct vfio_ccw_private *private, enum vfio_ccw_event event) { - struct irb *irb = this_cpu_ptr(&cio_irb); + struct irb *irb = &private->irb; - memcpy(&private->irb, irb, sizeof(*irb)); - - queue_work(vfio_ccw_work_q, &private->io_work); + if (scsw_is_solicited(&irb->scsw)) { + cp_update_scsw(&private->cp, &irb->scsw); + cp_free(&private->cp); + } + memcpy(private->io_region.irb_area, irb, sizeof(*irb)); - if (private->completion) - complete(private->completion); + if (private->io_trigger) + eventfd_signal(private->io_trigger, 1); } /* -- 2.7.4