Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp543317imm; Wed, 23 May 2018 01:11:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp1wrwKszK82dGJqIyvmViCeRYWv07nYfw+dgR4wfyW4oIR0w/BjTTjLnedWsscHeVXCw52 X-Received: by 2002:a62:5d99:: with SMTP id n25-v6mr1873641pfj.143.1527063068506; Wed, 23 May 2018 01:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527063068; cv=none; d=google.com; s=arc-20160816; b=ejUfIe8qplI/6E6MM0wBclNlvX6v4b+mfZ4NBT6RSAMd7P3V7lrNrc0NWqGkgjxQkO 5peG7VAz8pulJ6fNQdkNubGtRAxowuz0RNa581Ag2ZpckTO69VJmLprb+xqZqlR0cjg+ FNFgpAtVKPNgK6M7IuQV/4eQjliDj3d/u/cVpZLSM4Q0MRdKzv1Yy3qM1VE0hpewkCoa 6UWBJ6n2l5TLTjOf9uE/u3ij3ElsAuA07Lt10lJtoUgGmC/tuO05FNoLfnZNmLKJMRdj EmZg2zoax/tBP/EYklnRlMRZ5l1tDTkMZpjkSgusJoxABUXqWiV3CKT5eRpPK/v9eyN8 KeIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=P/itVg5QmtDpKDhuAYPu9vqt8kmBV2zKnDY76tZcmCo=; b=0rOMRBmxAFC7GxXuELKVBCAqSH8ZLr/8p4iFFnqaYxui2KfRXTEiKwNp5IKxXB8D1P lvAq3ezcIMWEd1Igcg46Es28KQaS7W5yf4GE0LzflYEDbFPMy6UfC6XKQqfqu0cfG+xX UdRJM4NzjZ+aKn7XYqQ3Evuz/KlnLXT8hSege/cQo/lvPz7G2qUSaSk1zfiJ6uH0o+uA ysam7KVnIJyaMr/yfb7NjRQltSmnFy4XZhTkP2Kk21vIIWKhKqGMx3WDMVw1Ky1zhRAU aqdg3Hxa8o6fzSRx23dAuApT3i8aEGgNDFSO5PfNParTDIcLqfmVy3bruQ4x+OTJZ6yo Y2bQ== 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 j9-v6si2750467pgn.86.2018.05.23.01.10.53; Wed, 23 May 2018 01:11:08 -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 S1754200AbeEWIKh (ORCPT + 99 others); Wed, 23 May 2018 04:10:37 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57422 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754082AbeEWIKe (ORCPT ); Wed, 23 May 2018 04:10:34 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E917EEFDEE; Wed, 23 May 2018 08:10:33 +0000 (UTC) Received: from gondolin (ovpn-117-30.ams2.redhat.com [10.36.117.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4329D20244F2; Wed, 23 May 2018 08:10:32 +0000 (UTC) Date: Wed, 23 May 2018 10:10:29 +0200 From: Cornelia Huck To: Pierre Morel Cc: Pierre Morel , Dong Jia Shi , Dong Jia Shi , pasic@linux.vnet.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH 04/10] vfio: ccw: replace IO_REQ event with SSCH_REQ event Message-ID: <20180523101029.0f717f08.cohuck@redhat.com> In-Reply-To: <86a4be7f-6c4c-19db-f743-ed4af0173125@linux.ibm.com> References: <1524149293-12658-1-git-send-email-pmorel@linux.vnet.ibm.com> <1524149293-12658-5-git-send-email-pmorel@linux.vnet.ibm.com> <20180426073053.GZ12194@bjsdjshi@linux.vnet.ibm.com> <20180426074806.GB12194@bjsdjshi@linux.vnet.ibm.com> <20180430173305.632faa80.cohuck@redhat.com> <20180502074622.GV5428@bjsdjshi@linux.vnet.ibm.com> <5816643d-5406-06b9-0727-fdcd771aba63@linux.vnet.ibm.com> <20180504011916.GA26081@bjsdjshi@linux.ibm.com> <8c75acd1-c00b-4d7f-ea4b-d32e9b05989b@linux.vnet.ibm.com> <20180522174120.2a56adb7.cohuck@redhat.com> <86a4be7f-6c4c-19db-f743-ed4af0173125@linux.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 23 May 2018 08:10:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 23 May 2018 08:10:34 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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 On Wed, 23 May 2018 09:50:00 +0200 Pierre Morel wrote: > On 22/05/2018 17:41, Cornelia Huck wrote: > > On Fri, 4 May 2018 13:02:36 +0200 > > Pierre Morel wrote: > > > >> On 04/05/2018 03:19, Dong Jia Shi wrote: > >>> * Pierre Morel [2018-05-03 16:26:29 +0200]: > >>> > >>>> On 02/05/2018 09:46, Dong Jia Shi wrote: > >>>>> * Cornelia Huck [2018-04-30 17:33:05 +0200]: > >>>>> > >>>>>> On Thu, 26 Apr 2018 15:48:06 +0800 > >>>>>> Dong Jia Shi wrote: > >>>>>> > >>>>>>> * Dong Jia Shi [2018-04-26 15:30:54 +0800]: > >>>>>>> > >>>>>>> [...] > >>>>>>> > >>>>>>>>> @@ -179,7 +160,7 @@ static int fsm_irq(struct vfio_ccw_private *private, > >>>>>>>>> if (private->io_trigger) > >>>>>>>>> eventfd_signal(private->io_trigger, 1); > >>>>>>>>> > >>>>>>>>> - return private->state; > >>>>>>>>> + return VFIO_CCW_STATE_IDLE; > >>>>>>>> This is not right. For example, if we are in STANDBY state (subch driver > >>>>>>>> is probed, but mdev device is not created), we can not jump to IDLE > >>>>>>>> state. > >>>>>>> I see my problem, for STANDBY state, we should introduce another event > >>>>>>> callback for VFIO_CCW_EVENT_INTERRUPT. It doesn't make sense to call > >>>>>>> fsm_irq() which tries to signal userspace with interrupt notification > >>>>>>> when mdev is not created yet... So we'd need a separated fix for this > >>>>>>> issue too. > >>>>>> But how do we even get into that situation when we don't have an mdev > >>>>>> yet? > >>>>>> > >>>>> We cann't... So let's assign fsm_nop() as the interrupt callback for > >>>>> STANDBY state? > >>>>> > >>>> :) Isn't it exactly what my patch series handle? > >>> As far as I see, that's not true. ;) > >>> > >>> After this series applied, > >>> vfio_ccw_jumptable[VFIO_CCW_STATE_STANDBY][VFIO_CCW_EVENT_INTERRUPT] is > >>> still fsm_irq(). > >>> > >> > >> What I mean is, this code tries to handle design problems > >> without changing too much of the original code at first. > >> > >> The problem here is not that the fsm_irq function is called on interrupt, > >> if we have an interrupt it must be signaled to user land. > >> The problem is that this state is entered at the wrong moment. > >> > >> STANDBY should be entered, during the mdev_open when we realize the QEMU > >> device, > >> and not during the probe, in which we should stay in NOT_OPER until we > >> get the QEMU device. > >> > >> The probe() and mdev_open() function should be modified, not the state > >> table. > > So, the takeaway is that we should handle starting via the init > > callbacks and not via the state machine? > > > hum, sorry, I think that my previous answer was not completely right, > and did not really answer to Dong Jia comment, yes fsm_irq was not > at its place, thinking again about the comments of both of you > I think that we can suppress the INIT event. > > I would like to rebase the patch to include the comments you both did. > > Yes, a respin is probably best before we get confused even more :)