Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp838274iob; Thu, 12 May 2022 05:52:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKSwoTLKHWW5rU1o87UMVSp5PXdNBNcm86KC3DqPboZV0YjHrGb6MK+O1LziWCStPD7u07 X-Received: by 2002:a05:6402:158a:b0:426:9efd:57a with SMTP id c10-20020a056402158a00b004269efd057amr34002530edv.85.1652359935035; Thu, 12 May 2022 05:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652359935; cv=none; d=google.com; s=arc-20160816; b=H5mGECTxNe7rpVNvRci/0xwT3vb9fqSCcnP0R6oJA/pdpke8JM94b1W5nno0s/J7a1 pOEXbDisnDnVnLogHIgIFgsJpq5J+jiLkqb7mqXctq9+0gzRTTlhFri103lF7QmWcVXk Wc1RtUw4qdqpCAfJaVctD+sOrtQJdmMG8cyKUWLjpJ/zudzqWnAfA3ITGF214UiBF/3O Y0OObVZfcAKu5+N2NIf9BbcdYI6s0DlZBH/5t1BWgRITsAIlhIkcQXMsWdQxV5Rcxi7p SfyqPhOJtXteWEsPAe8GnwObgwsbcOc7EYOBqt1td+T07AyABEjwI41YFPfpILdQj+yY ot5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oiuB6/1rpu58Tvln0nC0vsy2jP9iWIIb82ww3FDDrRc=; b=r49yyA2VmC9TzpSqZUleDo1jf6qUSV3P7zVp+b2+3FCyerK63EqwGO8xpl+qqKnayu u9zXzYmIpYs9V3yJssoZ0rPZX8IAu3Ifl4d2FX/p/XeGIIv7zTf1BUsMDYeUZLd1W7Rx aXUG6MxvDa4AL1tiboCVVPoUCrKQNWPioqetfY/VpvSgCRi/1/oApzIA4j3K2iwZDvc9 lWokqyzHVtVUElRn2gLzzzdHewwznqMGCbd8R2BHM/DoJ1S5e+g+gkTN4wrRKnaRlNoO WnBGKhScvUXbgSOHGZhrpE758cMr4BJVWtRAXMZ6Jcvg9TevETy8kaIa0cctrykc0g2B MnhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CzFUDnJD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr15-20020a1709073f8f00b006f39944bd6fsi5584798ejc.329.2022.05.12.05.51.49; Thu, 12 May 2022 05:52:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CzFUDnJD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245317AbiELD34 (ORCPT + 99 others); Wed, 11 May 2022 23:29:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238977AbiELD3y (ORCPT ); Wed, 11 May 2022 23:29:54 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1DF38694A0 for ; Wed, 11 May 2022 20:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652326192; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oiuB6/1rpu58Tvln0nC0vsy2jP9iWIIb82ww3FDDrRc=; b=CzFUDnJDGhEZEOgBrhOo53SWe0HaEhTrRxeluhaBRNGllZj28Gad+zdyPdoiMeZBKB6OuP lLx/nvg6HV3XtowELRx8UFJt4sOJiwuRUURx4hgdrDu3R7vm7kwkGWjw+oH8H1AvFBJ+pi QhUJ8ImLePAsxdSNSU3jVmRW5R/eOaA= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-446-4pvC43NQOcGaElhv1usf_Q-1; Wed, 11 May 2022 23:29:51 -0400 X-MC-Unique: 4pvC43NQOcGaElhv1usf_Q-1 Received: by mail-lf1-f71.google.com with SMTP id bq15-20020a056512150f00b00473a2e132a5so1632385lfb.10 for ; Wed, 11 May 2022 20:29:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oiuB6/1rpu58Tvln0nC0vsy2jP9iWIIb82ww3FDDrRc=; b=h3oB0kMhy5+ZZpbTQr7rRyInXBJYp0ZRTIqb5vpepAjP7ymMs0TT37qH9+Pwftj3fC uoMvMe6L4ubz0/dMvUuaQ9aqj9jddYgbSTvyTFMzsQMaj3/ganX9WUEbMRarX4uNu0VV XdZuVmhyvRfDwCDJTMVuTZNHlN30h3gT/rGvyxKWGBYjG9psFCM3f+fTUoPp+v2oKHXW S1Cf5AnZEWd3Z5cwlFE9TZIpJLInE+qeHGdafwj9i2fPOLPlZE8nSeym11UjEs9ENzMx r4wGDScCbIgjc117NqUHlgky0UeV0oQzkKKElP+ItVdoq7eXtnl2hxshj7euJ3kJYMdF Yrgw== X-Gm-Message-State: AOAM5320ox6w5o9wN5M0SHqKbZAXsQMtCIoae9lp7AAYy3eIrDU2H5qo 5EtI8AGfD3q9Bouc/2X5JQzWAqPdfOp8bfulBcO2Nj69f14ADkn12QX3khICUk0ZYMLESNljQ6a 768uwJUGoiKAp9EZmIOkTYgBtJSDC7Cfkppfk/Jlx X-Received: by 2002:a05:651c:89:b0:250:87c9:d4e6 with SMTP id 9-20020a05651c008900b0025087c9d4e6mr19554530ljq.315.1652326189666; Wed, 11 May 2022 20:29:49 -0700 (PDT) X-Received: by 2002:a05:651c:89:b0:250:87c9:d4e6 with SMTP id 9-20020a05651c008900b0025087c9d4e6mr19554516ljq.315.1652326189448; Wed, 11 May 2022 20:29:49 -0700 (PDT) MIME-Version: 1.0 References: <20220507071954.14455-1-jasowang@redhat.com> <20220507071954.14455-7-jasowang@redhat.com> <20220510072451-mutt-send-email-mst@kernel.org> <87r150bi0d.fsf@redhat.com> <87lev8bffh.fsf@redhat.com> In-Reply-To: From: Jason Wang Date: Thu, 12 May 2022 11:29:38 +0800 Message-ID: Subject: Re: [PATCH V4 6/9] virtio-ccw: implement synchronize_cbs() To: Vineeth Vijayan Cc: "Michael S. Tsirkin" , virtualization , linux-kernel , Thomas Gleixner , Peter Zijlstra , "Paul E. McKenney" , Marc Zyngier , Halil Pasic , eperezma , Cindy Lu , Stefano Garzarella , Xuan Zhuo , Peter Oberparleiter Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 11, 2022 at 10:52 PM Vineeth Vijayan wrote: > > On Wed, May 11, 2022 at 05:28:11PM +0800, Jason Wang wrote: > > On Wed, May 11, 2022 at 5:13 PM Cornelia Huck wrote: > > > > > > On Wed, May 11 2022, Jason Wang wrote: > > > > > > > On Wed, May 11, 2022 at 4:17 PM Cornelia Huck wrote: > > > >> > > > >> On Wed, May 11 2022, Jason Wang wrote: > > > >> > > > >> > On Tue, May 10, 2022 at 7:28 PM Michael S. Tsirkin wrote: > > > >> >> > > > >> >> On Sat, May 07, 2022 at 03:19:51PM +0800, Jason Wang wrote: > > > >> >> > @@ -1106,6 +1130,7 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev, > > > >> >> > vcdev->err = -EIO; > > > >> >> > } > > > >> >> > virtio_ccw_check_activity(vcdev, activity); > > > >> >> > + read_lock_irqsave(&vcdev->irq_lock, flags); > > > >> >> > for_each_set_bit(i, indicators(vcdev), > > > >> >> > sizeof(*indicators(vcdev)) * BITS_PER_BYTE) { > > > >> >> > /* The bit clear must happen before the vring kick. */ > > > >> >> > > > >> >> Cornelia sent a lockdep trace on this. > > > >> >> > > > >> >> Basically I think this gets the irqsave/restore logic wrong. > > > >> >> It attempts to disable irqs in the handler (which is an interrupt > > > >> >> anyway). > > > >> > > > > >> > The reason I use irqsave/restore is that it can be called from process > > > >> > context (if I was not wrong), e.g from io_subchannel_quiesce(). > > > >> > > > >> io_subchannel_quiesce() should disable interrupts, though? Otherwise, it > > > >> would be a bug. > > > > > > > > Right, it was protected by a spin_lock_irq(), but I can see other > > > > cdev->handler() in e.g device_fsm.c, the irq status is not obvious, do > > > > they have the same assumption which IRQ is disabled? > > > > > > Yes, that should be the case for any invocations via the fsm as well. > > > > > > > Ok. > > > > > It's been some time since I've worked on that part of the code, though, > > > so let's cc: the s390 cio maintainers so that they can speak up if I'm > > > wrong. > > > > Ok, I will do that. > > > > Thanks > > > > > > Thank you Corny to looking in to this. I agree, the cdev->handler is > called with lock held. And as you mentioned, in the fsm these handler > invocations are done with IRQ disabled, which will otherwise end up in a > deadlock. > thanks. > Thanks a lot for the confirmation, I will use spin_lock()/spin_unlock() in the next version.