From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0024C10F13 for ; Thu, 11 Apr 2019 09:24:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3C65217D4 for ; Thu, 11 Apr 2019 09:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726636AbfDKJYx (ORCPT ); Thu, 11 Apr 2019 05:24:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56704 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726588AbfDKJYx (ORCPT ); Thu, 11 Apr 2019 05:24:53 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C84A81112; Thu, 11 Apr 2019 09:24:52 +0000 (UTC) Received: from gondolin (ovpn-204-124.brq.redhat.com [10.40.204.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D90418247; Thu, 11 Apr 2019 09:24:49 +0000 (UTC) Date: Thu, 11 Apr 2019 11:24:46 +0200 From: Cornelia Huck To: Halil Pasic Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org, Martin Schwidefsky , Sebastian Ott , virtualization@lists.linux-foundation.org, Christian Borntraeger , Viktor Mihajlovski , Vasily Gorbik , Janosch Frank , Claudio Imbrenda , Farhan Ali , Eric Farman Subject: Re: [RFC PATCH 10/12] virtio/s390: consolidate DMA allocations Message-ID: <20190411112446.013cad09.cohuck@redhat.com> In-Reply-To: <20190410194849.511ecc46@oc2783563651> References: <20190404231622.52531-1-pasic@linux.ibm.com> <20190404231622.52531-11-pasic@linux.ibm.com> <20190410104649.12cdbcba.cohuck@redhat.com> <20190410171254.71206015@oc2783563651> <20190410183643.694ccb85.cohuck@redhat.com> <20190410194849.511ecc46@oc2783563651> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 11 Apr 2019 09:24:52 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, 10 Apr 2019 19:48:49 +0200 Halil Pasic wrote: > On Wed, 10 Apr 2019 18:36:43 +0200 > Cornelia Huck wrote: > > > On Wed, 10 Apr 2019 17:12:54 +0200 > > Halil Pasic wrote: > > > > > On Wed, 10 Apr 2019 10:46:49 +0200 > > > Cornelia Huck wrote: > > > > > > > On Fri, 5 Apr 2019 01:16:20 +0200 > > > > Halil Pasic wrote: > > > > > > > diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c > > > > > index aa45a6a027ae..7268149f2ee8 100644 > > > > > --- a/drivers/s390/virtio/virtio_ccw.c > > > > > +++ b/drivers/s390/virtio/virtio_ccw.c > > > > > @@ -49,12 +49,12 @@ struct vq_config_block { > > > > > struct vcdev_dma_area { > > > > > unsigned long indicators; > > > > > unsigned long indicators2; > > > > > + struct vq_config_block config_block; > > > > > + __u8 status; /* TODO check __aligned(8); */ > > > > > > > > ...I think that needs attention. > > > > > > Yes I wanted to discuss this with you. I could not find anything > > > in the virtio spec that would put requirements on how this > > > status field needs to be aligned. But I did not look to hard. > > > > > > The ccw.cda can hold an arbitrary data address AFAIR (for indirect, > > > of course we do have alignment requirements). > > > > I think it needs to be doubleword aligned. > > > > I've re-read the part of the PoP that describes the ccw formats. And > it reinforced my position: for IDA and MIDA we need proper alignment, > but if the CCW ain't an indirect one there is no alignment requirement. > > QEMU also does not seem to check either. > > Can you double-check and provide me with a reference that proves me > wrong if I'm wrong. Ah, it was the ccw itself, not the cda. Indeed, there do not seem to be any requirements for direct addressing. > > > > > > > Apparently status used to be a normal field, and became a pointer with > > > 73fa21ea4fc6 "KVM: s390: Dynamic allocation of virtio-ccw I/O > > > data." (Cornelia Huck, 2013-01-07). I could not quite figure out why. > > > > In the beginning, the code used a below-2G-area for all commands. > > Rather than adding locking to avoid races there, that commit switches > > to allocating the needed structures individually. The status field > > needed to be below 2G, so it needed to be allocated separately. > > > > I get it now. The confusing part was that the field 'area' was about > holding the address of the also previously dynamically allocated > below 2G area that was used for talking to the hypervisor via CCW I/O. > > > > > > > So maybe dropping the TODO comment will do just fine. What do you think? > > > > I still think we just need to drop the comment, as we don't have to > align it. Agreed.