Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp22773ybh; Fri, 6 Mar 2020 15:04:59 -0800 (PST) X-Google-Smtp-Source: ADFU+vtZvepRTNPHkfHeboHxxfIG0c1yTAyRzcuTY4KkHBs3KmYzzZ1yY9jDfeEr6X07TyylNmMx X-Received: by 2002:a9d:907:: with SMTP id 7mr290434otp.278.1583535898889; Fri, 06 Mar 2020 15:04:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583535898; cv=none; d=google.com; s=arc-20160816; b=0JGpjfuHoFEgDnnZoA+7ivNC2vNCcGqNHqDjXga1hWD4Prwip2NoxlZ8+hbWjiZH33 zlABQlud8Zj2pcYu1um3wnWrbctR11TByB5jCLwI9kqSaVpdbJYuEBL5VV8M9FG8/gLY TV8DGTZNW7t5FuszhjFJwfcsC3As5lsFjcIMkJtCPepA8u0cMgLZJiQfL9Q+M+YVncZE sDlzAuWGlRloHRB5ml8jI8aZi1LvJvk6vIKxkRPCS8LdvjnQhwtTfmBTHprcsBIM/lgh xRwyAHa+Z9htbV4OFQkDyztMEKld94QhxE+Xp6rAi+U/VAWjA1hL3/QVFiONUeAY/HGK cBNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:to:from; bh=1qEa1fVBHWUfxu8gKGshiF/lhJTUiHNOnK9djFiLjIo=; b=QUVeCO98PQdR2xYMiJbVhsphkITbBje20hR8WhqyB+2vERTuExsUovC58RoC9UmBSG a3R4U/jO2IscbyFFF3RObXNLMa8KZ9QcNWP3z5lUO4+6NcKgsrzMYh2PdBDrdlBxDqqE O/kU6PZ28AfmCBzd1Vtuq8kffEsqntU4UfbdXmiiQXApObWgUxNoNgZc6OSCxxkCmq39 LWfF3HV0HkHMFZJD0oCKDkhTn0t/hXt0ZJbtgypTXKp3PzV16EpfME5jU5qnfcajTVyO 8XlxzgxUF3f/MAB/Jpcdrs3R66ZhHJSFa/rTLHKFBeEocfdOtsZXq7hLM+VxMAAqnbch pp4g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si462549oii.168.2020.03.06.15.04.47; Fri, 06 Mar 2020 15:04:58 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726397AbgCFXEa (ORCPT + 99 others); Fri, 6 Mar 2020 18:04:30 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:54634 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbgCFXEa (ORCPT ); Fri, 6 Mar 2020 18:04:30 -0500 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jAM0Y-0005gY-Ev; Sat, 07 Mar 2020 00:03:54 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id C92FA104088; Sat, 7 Mar 2020 00:03:52 +0100 (CET) From: Thomas Gleixner To: Anchal Agarwal , mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, boris.ostrovsky@oracle.com, jgross@suse.com, linux-pm@vger.kernel.org, linux-mm@kvack.org, kamatam@amazon.com, sstabellini@kernel.org, konrad.wilk@oracle.com, roger.pau@citrix.com, axboe@kernel.dk, davem@davemloft.net, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, peterz@infradead.org, eduval@amazon.com, sblbir@amazon.com, anchalag@amazon.com, xen-devel@lists.xenproject.org, vkuznets@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dwmw@amazon.co.uk, fllinden@amaozn.com, benh@kernel.crashing.org Subject: Re: [RFC PATCH v3 07/12] genirq: Shutdown irq chips in suspend/resume during hibernation In-Reply-To: Date: Sat, 07 Mar 2020 00:03:52 +0100 Message-ID: <87ftelaxwn.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Anchal Agarwal writes: > There are no pm handlers for the legacy devices, so during tear down > stale event channel <> IRQ mapping may still remain in the image and > resume may fail. To avoid adding much code by implementing handlers for > legacy devices, add a new irq_chip flag IRQCHIP_SHUTDOWN_ON_SUSPEND which > when enabled on an irq-chip e.g xen-pirq, it will let core suspend/resume > irq code to shutdown and restart the active irqs. PM suspend/hibernation > code will rely on this. > Without this, in PM hibernation, information about the event channel > remains in hibernation image, but there is no guarantee that the same > event channel numbers are assigned to the devices when restoring the > system. This may cause conflict like the following and prevent some > devices from being restored correctly. The above is just an agglomeration of words and acronyms and some of these sentences do not even make sense. Anyone who is not aware of event channels and whatever XENisms you talk about will be entirely confused. Changelogs really need to be understandable for mere mortals and there is no space restriction so acronyms can be written out. Something like this: Many legacy device drivers do not implement power management (PM) functions which means that interrupts requested by these drivers stay in active state when the kernel is hibernated. This does not matter on bare metal and on most hypervisors because the interrupt is restored on resume without any noticable side effects as it stays connected to the same physical or virtual interrupt line. The XEN interrupt mechanism is different as it maintains a mapping between the Linux interrupt number and a XEN event channel. If the interrupt stays active on hibernation this mapping is preserved but there is unfortunately no guarantee that on resume the same event channels are reassigned to these devices. This can result in event channel conflicts which prevent the affected devices from being restored correctly. One way to solve this would be to add the necessary power management functions to all affected legacy device drivers, but that's a questionable effort which does not provide any benefits on non-XEN environments. The least intrusive and most efficient solution is to provide a mechanism which allows the core interrupt code to tear down these interrupts on hibernation and bring them back up again on resume. This allows the XEN event channel mechanism to assign an arbitrary event channel on resume without affecting the functionality of these devices. Fortunately all these device interrupts are handled by a dedicated XEN interrupt chip so the chip can be marked that all interrupts connected to it are handled this way. This is pretty much in line with the other interrupt chip specific quirks, e.g. IRQCHIP_MASK_ON_SUSPEND. Add a new quirk flag IRQCHIP_SHUTDOWN_ON_SUSPEND and add support for it the core interrupt suspend/resume paths. Hmm? > Signed-off-by: Anchal Agarwal > Suggested-by: Thomas Gleixner Not that I care much, but now that I've written both the patch and the changelog you might change that attribution slightly. For completeness sake: Signed-off-by: Thomas Gleixner Thanks, tglx