Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp177014ybp; Thu, 3 Oct 2019 11:54:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxRFqIoXQ4w5CbnPOzWJ5Y6ILDEofKEz1rJB9FuA061CS6RCqiQ/DjLIgHUnOKMhyIJNc2 X-Received: by 2002:a05:6402:1585:: with SMTP id c5mr11095505edv.66.1570128852353; Thu, 03 Oct 2019 11:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570128852; cv=none; d=google.com; s=arc-20160816; b=KMbJp0/0qMRQILHBueOljfn68Wro910RAw47LgysZee7cUteNyeCh6ooFlE6p13D43 c1YSAoCZzt66neQGNMihmIKbUbapOjiR/zhiAFlsPL4M0DHFeW9l4I9GqjzfNIItWkyN efbbod0kHRQE1zb58zvLKhQRqEZF2PY8K8vLBcHDx231MZS+Q4nZtlJ124vWa5UjUie9 2m04bILMyvPs/VScAQTcaXI6KFMAj6UJXavY9oPnC5beO/ugS2nUp8heXsosiCVjYoZD CBYprHk5OhF8YWozDFkQMu64lJE2MOCfr1n4TEKq6x03/pGq4soT3giwa34BxBsCE5+j a44A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cTaX338E0Xi7tlWl150QisR1sVTVGkEbaKzGC+/ciNs=; b=QkbF7R1p8uLmYsg8RomtzAMB5AKCJG9vE2cfIReNI2ZQ0407UCTb6Pxoqd/Rp8dpJ9 FD2a8mEKyRoDJpqJXl+5V4W6oqFQ0wwSev+2uN8qkk02PsaHUFUqsKdyki72v1N3XCtB +bzu0r511R+g7YwnqI7iwf755Q+sxTfRnCcls9CrVrTUhCLLGv9PT2LDwaECKHQ9rmMY 4sfrN+rMkgx5AY7FKRHSkVyR4Krwm7rtMEfPveMc9aI7s1wgQavwYtkzPCK+GtHn6xEW MrqflaHG5ZfsatOl88PyZGH0qAZ+6Cl+xBzaNZ29NOlcclQ7XwxeL7s/5nq8va1aqC9h zF4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QQcAnwxF; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d48si1940687eda.383.2019.10.03.11.53.47; Thu, 03 Oct 2019 11:54:12 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QQcAnwxF; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732380AbfJCRpg (ORCPT + 99 others); Thu, 3 Oct 2019 13:45:36 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37449 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730530AbfJCRpg (ORCPT ); Thu, 3 Oct 2019 13:45:36 -0400 Received: by mail-pf1-f196.google.com with SMTP id y5so2226517pfo.4; Thu, 03 Oct 2019 10:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=cTaX338E0Xi7tlWl150QisR1sVTVGkEbaKzGC+/ciNs=; b=QQcAnwxF76LQ1iEdNrNWVvOLiJ3Pv9O/72dUcsxjGOQigOb5iuS9UbQ7rLfUwzX/gJ jqBErtxrGhgaZLQE6p4fAEypMdxCOl9NmDvsjra8+YCjZ9Cr1uIn2Z2i/upxhdCIoGuI VT+tSQPPqcmRTKABq3cWVni37mU57j9Dc2jULLNkIMxitydg5/pSiHALAeYx3eDfESvl bCEttP6mG3DRJ+bY2mF/pIUSSZW3c/nWGer7SkCNfqOGkB5381hD1j1MbHzeKB3FKTi8 pR6Z3UvBLJWEMvU/VJCiiK3Rkr1RZqOWbRCVJH7E+OOwQFQ8JcjVv9jOINXvEsAMJw4i pkhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=cTaX338E0Xi7tlWl150QisR1sVTVGkEbaKzGC+/ciNs=; b=cC55GZ7dHncJe5qdRJdsHC/v1HWw7YtFe6fv+mzdS50Is0/Vs5HkKDtVRgo0CJPHja tCLZJiCjyYmd7DVeOI5JdvGEOLkyFPG84s+gj2jZIpRAJqESoHdCELeR6kvS/wAMkHEU 9g29EPpwcmFHf0WYJa837f9DaGQLHbIo1arG9uR1cDFI7DZEyeCi+jqgbmqHBpiR4vks d57idsNkHOA5LQ24x7nFS3O5VjfUDXHIbmO/x1mqQP9mYN+LiUW2yMlKTa4pzLg6benX bUWp32Ee7d3U9X03mbcgsueDznv7oKcZFfyT5KcBAyDdEH5K1MxKM8UPkmC3yeplAKmF x49w== X-Gm-Message-State: APjAAAVxh9sPCGgGZa9Uxgft2C7geoUZmKVhaBJ235PUh7KI/AQeQWIo 9aiP3KKCjr83xxkZMiailG0= X-Received: by 2002:a17:90a:be08:: with SMTP id a8mr11998250pjs.92.1570124733826; Thu, 03 Oct 2019 10:45:33 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id 7sm2799565pgj.35.2019.10.03.10.45.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2019 10:45:32 -0700 (PDT) Date: Thu, 3 Oct 2019 10:45:30 -0700 From: "dmitry.torokhov@gmail.com" To: Dexuan Cui Cc: KY Srinivasan , Haiyang Zhang , Stephen Hemminger , "sashal@kernel.org" , "linux-hyperv@vger.kernel.org" , "linux-input@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Michael Kelley Subject: Re: [PATCH] Input: hyperv-keyboard: Add the support of hibernation Message-ID: <20191003174530.GB22365@dtor-ws> References: <1568244975-66795-1-git-send-email-decui@microsoft.com> <20190919161752.GS237523@dtor-ws> <20190928003156.GU237523@dtor-ws> <20190930230652.GW237523@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 03, 2019 at 06:44:04AM +0000, Dexuan Cui wrote: > > From: Dexuan Cui > > Sent: Wednesday, October 2, 2019 10:35 PM > > > ... > > > > > > ¯\_(ツ)_/¯ If you do not want to implement hibernation properly in vmbus > > > code that is totally up to you (have you read in pm.h how freeze() is > > > different from suspend()?). > > > Dmitry > > > > I understand freeze() is different from suspend(). Here I treat suspend() as a > > heavyweight freeze() for simplicity and IMHO the extra cost of time is > > neglectable considering the long hibernation process, which can take > > 5~10+ seconds. > > > > Even if I implement all the pm ops, IMO the issue we're talking about > > (i.e. the hibernation process can be aborted by user's keyboard/mouse > > activities) still exists. Actually I think a physical Linux machine should have > > the same issue. > > > > In practice, IMO the issue is not a big concern, as the VM usually runs in > > a remote data center, and the user has no access to the VM's > > keyboard/mouse. :-) > > > > I hope I understood your comments. I'll post a v2 without the notifier. > > Please Ack the v2 if it looks good to you. > > > > -- Dexuan > > I think I understood now: it looks the vmbus driver should implement > a prepare() or freeze(), which calls the hyperv_keyboard driver's > prepare() or freeze(), which can set the flag or disable the keyboard > event handling. This way we don't need the notifier. Right. I think in practice the current suspend implementation can work as freeze() for the HV keyboard, because in suspend you shut off vmbus channel, so there should not be wakeup signals anymore. What you do not want is to have the current resume to be used in place of thaw(), as there you re-enable the vmbus channel and resume sending wakeup requests as you are writing out the hibernation image to storage. I think if vmbus allowed HV keyboard driver to supply empty thaw() and poweroff() implementations, while using suspend() as freeze() and resume() as restore(), it would solve the issue for you. Thanks. -- Dmitry