Received: by 10.192.165.148 with SMTP id m20csp4637031imm; Tue, 24 Apr 2018 06:09:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrNRMWd8PLQVgMBsNM3RvMvBC8XtMvf8J8J2mn1CD2RK/3BmGRenMehvHSITdeghJMNWoKG X-Received: by 2002:a17:902:728f:: with SMTP id d15-v6mr3753972pll.119.1524575362548; Tue, 24 Apr 2018 06:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524575362; cv=none; d=google.com; s=arc-20160816; b=OAn9HrD1NVQP/jdYmUD2h5Tenonu1HwO0NW8qCXxZgU/JKu/nfSWWEZrlL04mbuK1s YQnBLZmd9giu0FeHTd4ixm0Z9z4IRwozx7xEkDn3+xzPVrSwpOGrqpK+UyEtgfKBOrHj O3f721Eh1oJdiQzwlFHfkKbyEI85eHEIRl9HMOdm5h2jN/dKqzipn2AURCe/47xV5oRa VHJ62+s7F7iwJasbk4vEdveuWVPFseJuGUj8xIFcYmcwVfzohEZk64G7gsjGjwzlx6/O 4WO0Jf9k2pdBjx0i1hGK8h86aCEx/Dr78sjYzx6SqgQ6Vuk6d6MYdjM9PGUnU/OJ1HkY NsiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject:arc-authentication-results; bh=DNBOLh5/Syxb6QyCC1ooO4Fx3DOFI29Ms22kdGN8rgA=; b=r/GGGPmE1mAdK6I8ztHCoughA2CNMa3HdJXp5iDTlSKXaa4D8hdMa73UOUSN4ySnuk HgUVApd9xzP7uJ3DGWTnTQefcfyCM0ZFBguf6w6cDzplXhU8ORTUIxi64WTqPWRLJTci fB6OK6PAq0oATrWWCP6oDNGs5uBKBKzfDQu7Zye62Bcjndv9ecudMkcXp8OUTIjI3HhC yNElVmf99iQ40ez2JcNjtS9mKQ5Y8MEOFNf3Zt22zoSxnusGGni6hu7pGbFRk/mcd7K8 5Gen9SRFCeUrIYccowYBm1SFfdAyLnHLPbDOK0QdqH+VWmHVKItW5FYMGn7WJ5qz2xy/ 48GQ== 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 t3-v6si746387plq.547.2018.04.24.06.09.08; Tue, 24 Apr 2018 06:09:22 -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 S1757831AbeDXNHm (ORCPT + 99 others); Tue, 24 Apr 2018 09:07:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33120 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757808AbeDXNHh (ORCPT ); Tue, 24 Apr 2018 09:07:37 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3OCx81w020277 for ; Tue, 24 Apr 2018 09:07:37 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hj3wf47bx-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Apr 2018 09:07:37 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Apr 2018 14:07:34 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 24 Apr 2018 14:07:31 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3OD7U8g6291898; Tue, 24 Apr 2018 13:07:30 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 147544C058; Tue, 24 Apr 2018 13:59:52 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C98EE4C04A; Tue, 24 Apr 2018 13:59:51 +0100 (BST) Received: from [9.152.224.146] (unknown [9.152.224.146]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Apr 2018 13:59:51 +0100 (BST) Subject: Re: [PATCH 01/10] vfio: ccw: Moving state change out of IRQ context To: Cornelia Huck Cc: Dong Jia Shi , pasic@linux.vnet.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <1524149293-12658-1-git-send-email-pmorel@linux.vnet.ibm.com> <1524149293-12658-2-git-send-email-pmorel@linux.vnet.ibm.com> <20180424065442.GV12194@bjsdjshi@linux.vnet.ibm.com> <20180424115929.5b5e1ff0.cohuck@redhat.com> <20180424135533.2e9d03dc.cohuck@redhat.com> From: Pierre Morel Date: Tue, 24 Apr 2018 15:07:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180424135533.2e9d03dc.cohuck@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18042413-0012-0000-0000-000005CE3520 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18042413-0013-0000-0000-0000194AA72A Message-Id: <02ca116e-f20c-e59b-e609-70882d5f4afa@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-24_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804240126 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/04/2018 13:55, Cornelia Huck wrote: > On Tue, 24 Apr 2018 13:49:14 +0200 > Pierre Morel wrote: > >> On 24/04/2018 11:59, Cornelia Huck wrote: >>> On Tue, 24 Apr 2018 10:40:56 +0200 >>> Pierre Morel wrote: >>> >>>> On 24/04/2018 08:54, Dong Jia Shi wrote: >>>>> * Pierre Morel [2018-04-19 16:48:04 +0200]: >>>>> >>>>> [...] >>>>> >>>>>> @@ -94,9 +83,15 @@ 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)); >>>>>> + >>>>>> + WARN_ON(work_pending(&private->io_work)); >>>>> Hmm, why do we need this? >>>> The current design insure that we have not two concurrent SSCH requests. >>>> How ever I want here to track spurious interrupt. >>>> If we implement cancel, halt or clear requests, we also may trigger (AFAIU) >>>> a second interrupts depending on races between instructions, controller >>>> and device. >>> You won't get an interrupt for a successful cancel. If you do a >>> halt/clear, you will make the subchannel halt/clear pending in addition >>> to start pending and you'll only get one interrupt (if the I/O has >>> progressed far enough, you won't be able to issue a hsch). The >>> interesting case is: >>> - guest does a ssch, we do a ssch on the device >>> - the guest does a csch before it got the interrupt for the ssch >>> - before we do the csch on the device, the subchannel is already status >>> pending with completion of the ssch >>> - after we issue the csch, we get a second interrupt (for the csch) >> We agree. >> >>> I think we should present two interrupts to the guest in that case. >>> Races between issuing ssch/hsch/csch and the subchannel becoming status >>> pending happen on real hardware as well, we're just more likely to see >>> them with the vfio layer in between. >> Yes, agreed too. >> >>> (I'm currently trying to recall what we're doing with unsolicited >>> interrupts. These are fun wrt deferred cc 1; I'm not sure if there are >>> cases where we want to present a deferred cc to the guest.) >> This patch does not change the current functionalities, only >> consolidates the FSM. >> The current way to handle unsolicited interrupts is to report them to >> the guest >> along with the deferred code AFAIU. > My question was more along the line of "do we actually want to > _generate_ a deferred cc1 or unsolicited interrupt, based upon what we > do in our state machine". My guess is no, regardless of the changes you > do in this series. > >>> Also, doing a second ssch before we got final state for the first one >>> is perfectly valid. Linux just does not do it, so I'm not sure if we >>> should invest too much time there. >> I agree too, it would just make things unnecessary complicated. > I'm a big fan of just throwing everything at the hardware and let it > sort out any races etc. We just need to be sure we don't mix up > interrupts :) > OK, I understand, I can do somthing in the interrupt handler to make sure we do not loose interrupt IRQs. I make a proposition in V2. Thanks, Pierre -- Pierre Morel Linux/KVM/QEMU in Böblingen - Germany