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=-5.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 AE60EC4363A for ; Fri, 30 Oct 2020 13:38:50 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 378102076E for ; Fri, 30 Oct 2020 13:38:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="hJZ1k7/s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 378102076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.15829.39035 (Exim 4.92) (envelope-from ) id 1kYUbz-00045j-CM; Fri, 30 Oct 2020 13:38:35 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 15829.39035; Fri, 30 Oct 2020 13:38:35 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kYUbz-00045c-8w; Fri, 30 Oct 2020 13:38:35 +0000 Received: by outflank-mailman (input) for mailman id 15829; Fri, 30 Oct 2020 13:38:34 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kYUby-00045X-1V for xen-devel@lists.xenproject.org; Fri, 30 Oct 2020 13:38:34 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0786d6d5-85f1-406e-808b-a9a1685f6020; Fri, 30 Oct 2020 13:38:32 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DDE2AB934; Fri, 30 Oct 2020 13:38:31 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kYUby-00045X-1V for xen-devel@lists.xenproject.org; Fri, 30 Oct 2020 13:38:34 +0000 X-Inumbo-ID: 0786d6d5-85f1-406e-808b-a9a1685f6020 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0786d6d5-85f1-406e-808b-a9a1685f6020; Fri, 30 Oct 2020 13:38:32 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1604065112; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CKj6V5floIGcrcmplI/6V41HCV/XZWSZHqvda5Hiav0=; b=hJZ1k7/sH1GrC2jU/LKEbizi6K3V3esYyFs0X+fzgHTgHcLl6zsdw9k3FjSlc/cG0lqTeN 28JuiFZzw6OY07ivCdzFssQSFKUdY8RwUnDZtFVYigIZcVFY63S8J2NTJBXdMYSsho9gqZ halLgp4U0AyFfcuedftr7R9gg15W3Qg= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DDE2AB934; Fri, 30 Oct 2020 13:38:31 +0000 (UTC) Subject: Re: [PATCH v2 5/8] evtchn: drop acquiring of per-channel lock from send_guest_{global,vcpu}_virq() To: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Cc: "xen-devel@lists.xenproject.org" , Andrew Cooper , George Dunlap , Ian Jackson , Wei Liu , Stefano Stabellini , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Julien Grall References: <19babf20-3649-5c63-44a9-7edfa81835aa@suse.com> <53eb30ca-9b3f-0ef4-bc90-e1c196b716b3@suse.com> <20201022160055.nlucvj2bsxolxd5o@Air-de-Roger> <2cfcda4c-4115-e057-f401-5103f5b5b8e8@suse.com> <08108cd3-530f-3fe9-e1b2-41c7da9f98b7@xen.org> <693bb422-ed13-9327-5f22-12bd6f192916@suse.com> <46d5f9cf-c01d-c0c2-777a-c97736633120@suse.com> <53b9685c-92ed-15a5-2ade-d17fd5d398c2@suse.com> From: Jan Beulich Message-ID: <23b3eb86-02c6-650c-d9a3-a3b40cb646c2@suse.com> Date: Fri, 30 Oct 2020 14:38:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 30.10.2020 14:02, Jürgen Groß wrote: > On 30.10.20 13:52, Jan Beulich wrote: >> On 30.10.2020 13:27, Jürgen Groß wrote: >>> On 30.10.20 12:55, Jan Beulich wrote: >>>> On 30.10.2020 12:15, Jürgen Groß wrote: >>>>> On 30.10.20 11:57, Julien Grall wrote: >>>>>> On 30/10/2020 10:49, Jan Beulich wrote: >>>>>>> On 30.10.2020 11:38, Julien Grall wrote: >>>>>>>> I think we should consider Juergen's series because the locking for the >>>>>>>> event channel is easier to understand. >>>>>>> >>>>>>> We should, yes. The one thing I'm a little uneasy with is the >>>>>>> new lock "variant" that gets introduced. Custom locking methods >>>>>>> also are a common source of problems (which isn't to say I see >>>>>>> any here). >>>>>> >>>>>> I am also unease with a new lock "variant". However, this is the best >>>>>> proposal I have seen so far to unblock the issue. >>>>>> >>>>>> I am open to other suggestion with simple locking discipline. >>>>> >>>>> In theory my new lock variant could easily be replaced by a rwlock and >>>>> using the try-variant for the readers only. >>>> >>>> Well, only until we would add check_lock() there, which I think >>>> we should really have (not just on the slow paths, thanks to >>>> the use of spin_lock() there). The read-vs-write properties >>>> you're utilizing aren't applicable in the general case afaict, >>>> and hence such checking would get in the way. >>> >>> No, I don't think so. >>> >>> As long as there is no read_lock() user with interrupts off we should be >>> fine. read_trylock() is no problem as it can't block. >> >> How would check_lock() notice the difference? It would be all the >> same for read and write acquires of the lock, I think, and hence >> it would still get unhappy about uses from IRQ paths afaict. > > check_lock() isn't applicable here, at least not without modification. > > I think our spinlock implementation is wrong in this regard in case a > lock is entered via spin_trylock(), BTW. Using spin_trylock() with > interrupts off for a lock normally taken with interrupts enabled is > perfectly fine IMO. Hmm, I think you're right, in which I case guess we ought to relax this. Jan