Received: by 10.192.165.148 with SMTP id m20csp3924416imm; Mon, 30 Apr 2018 08:40:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo4YSVxmLGjywxG0oohtevxYx7fL/o0UgrSKRbZEbmQWSVzsnGnycGhd0kYzA/3mpR3jnK5 X-Received: by 2002:a63:bd1a:: with SMTP id a26-v6mr10527900pgf.157.1525102800093; Mon, 30 Apr 2018 08:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525102800; cv=none; d=google.com; s=arc-20160816; b=jOjBGwmA9UvcGL8JqiGkWe6KYWT54bAAH6HMQsVRoE7+XSHCSU7pgWEZWBSJeACjRy A8YqFK8ctDmuf6AzPfE8/trDJn8kBYobhKj/QvhBO4XKSoEfLruDO4hHhlUPQ3zmtbmv qDegfKHE6LFFerfNOt8o5PyzbRDKqIzKNJPo+PC+dprJ8RZPx0ihP31HEHGn1TevbwxB 0CF6bfSJNYUsWr0TdGyMTwzHumddd0IKR572NaolPTiCVlJ0GCk+gyMKCtU/V1fAOytG 65r2rXwunGNMuH/5FZzSUbCl8QDHeafTN98qRnIJGlr3pfJSQSZrXQTILvGSOq5lR3us ZDPw== 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=1ELa0+1CAQp2eJxM64uvf/n2oHlSgCHcYlxW9mUvsyE=; b=AdeBEGDfXjYZ+IY1+qKYaMTg0WvDpS6aQI7Mq88o2Ib6xeaFlUvDrX6PTeQNRWHpkD 2l/045XvYIKIS7fTYWX0XK1CJYp9A+TBwatkYlc05nQa0vCS2vd+4YVAJnLxfGZpGaWS CSs6K7zt0E8brhlaV6lXBnbG2OfIkc4DZ9T6feQYFZMK2GHOXExeBJJgfzG1VX/T+uRb mh2UlZOanKRB7oC3d4NWv8x3+0kYSx2cPCm2o4PnHkIv80Y7xhrPDBf0P82DeqfhCAVn jdICDVRBNRFe0LrXiJUnsdhhG4R2tNJhRzM7B7UJ4914e9BG6FWn69UNUBwtm0SEM3g0 COFw== 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 d12-v6si6359359pgt.175.2018.04.30.08.39.45; Mon, 30 Apr 2018 08:40:00 -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 S1754755AbeD3PjQ (ORCPT + 99 others); Mon, 30 Apr 2018 11:39:16 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34998 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753582AbeD3PjO (ORCPT ); Mon, 30 Apr 2018 11:39:14 -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 0C19C406C78A; Mon, 30 Apr 2018 15:39:14 +0000 (UTC) Received: from gondolin (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1078B2166BAD; Mon, 30 Apr 2018 15:39:12 +0000 (UTC) Date: Mon, 30 Apr 2018 17:39:10 +0200 From: Cornelia Huck To: Pierre Morel Cc: pasic@linux.vnet.ibm.com, bjsdjshi@linux.vnet.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH 07/10] vfio: ccw: Introduce the INIT event Message-ID: <20180430173910.31f13a3a.cohuck@redhat.com> In-Reply-To: <1524149293-12658-8-git-send-email-pmorel@linux.vnet.ibm.com> References: <1524149293-12658-1-git-send-email-pmorel@linux.vnet.ibm.com> <1524149293-12658-8-git-send-email-pmorel@linux.vnet.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.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 30 Apr 2018 15:39:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 30 Apr 2018 15:39:14 +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 On Thu, 19 Apr 2018 16:48:10 +0200 Pierre Morel wrote: > The VFIO_CCW_EVENT_INIT event allows to export the initial state > into the FSM. I don't know, that feels a bit unintuitive to me. I would naively expect initialization to be done _before_ we activate processing via the state machine. > > Signed-off-by: Pierre Morel > --- > drivers/s390/cio/vfio_ccw_drv.c | 26 +++++++++++--------------- > drivers/s390/cio/vfio_ccw_fsm.c | 21 +++++++++++++++++++++ > drivers/s390/cio/vfio_ccw_ops.c | 11 ----------- > drivers/s390/cio/vfio_ccw_private.h | 1 + > 4 files changed, 33 insertions(+), 26 deletions(-) > /* > * Device statemachine > */ > fsm_func_t *vfio_ccw_jumptable[NR_VFIO_CCW_STATES][NR_VFIO_CCW_EVENTS] = { > [VFIO_CCW_STATE_NOT_OPER] = { > + [VFIO_CCW_EVENT_INIT] = fsm_init, > [VFIO_CCW_EVENT_NOT_OPER] = fsm_nop, > [VFIO_CCW_EVENT_SSCH_REQ] = fsm_io_error, > [VFIO_CCW_EVENT_INTERRUPT] = fsm_disabled_irq, > [VFIO_CCW_EVENT_SCH_EVENT] = fsm_nop, > }, > [VFIO_CCW_STATE_STANDBY] = { > + [VFIO_CCW_EVENT_INIT] = fsm_nop, > [VFIO_CCW_EVENT_NOT_OPER] = fsm_notoper, > [VFIO_CCW_EVENT_SSCH_REQ] = fsm_io_error, > [VFIO_CCW_EVENT_INTERRUPT] = fsm_irq, > [VFIO_CCW_EVENT_SCH_EVENT] = fsm_sch_event, > }, > [VFIO_CCW_STATE_IDLE] = { > + [VFIO_CCW_EVENT_INIT] = fsm_nop, > [VFIO_CCW_EVENT_NOT_OPER] = fsm_notoper, > [VFIO_CCW_EVENT_SSCH_REQ] = fsm_io_request, > [VFIO_CCW_EVENT_INTERRUPT] = fsm_irq, > [VFIO_CCW_EVENT_SCH_EVENT] = fsm_sch_event, > }, > [VFIO_CCW_STATE_BOXED] = { > + [VFIO_CCW_EVENT_INIT] = fsm_nop, > [VFIO_CCW_EVENT_NOT_OPER] = fsm_notoper, > [VFIO_CCW_EVENT_SSCH_REQ] = fsm_io_busy, > [VFIO_CCW_EVENT_INTERRUPT] = fsm_irq, > [VFIO_CCW_EVENT_SCH_EVENT] = fsm_sch_event, > }, > [VFIO_CCW_STATE_BUSY] = { > + [VFIO_CCW_EVENT_INIT] = fsm_nop, > [VFIO_CCW_EVENT_NOT_OPER] = fsm_notoper, > [VFIO_CCW_EVENT_SSCH_REQ] = fsm_io_busy, > [VFIO_CCW_EVENT_INTERRUPT] = fsm_irq, ...especially as you only call it if in the NOT_OPER state. Why should this event be generated in any case but in the very beginning?