Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp364086imm; Wed, 13 Jun 2018 01:28:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJeWjkS4qWF6ijmBpD/WSuqtpU0n6yl2PWnYK3opQreOjxm5iPnqHY2EKnLO9CWM+dlxvgR X-Received: by 2002:a63:6ecb:: with SMTP id j194-v6mr3303555pgc.158.1528878490938; Wed, 13 Jun 2018 01:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528878490; cv=none; d=google.com; s=arc-20160816; b=vo6G817JcHt1y3sKGpdIoSatTGYToAiSKDBulW6SZUH5j+aeiR3y8X3yzfi47LLJps OmqxVvcYmXCn+pHvMUIF3jgyNNZZA8KZJ0f44mIBiK7gM+Z6bWcw/+kHLCXQRdpy+yZ+ +B2Bf0LpQTMSirLrD0jnWvLAGZ3DDcUWFnYI16rqrKQVM9DmCCcdHSUVGVqaiTvwe622 mEQz0ThjMdoW+o6F4g73fTxKGIn68QmBIuQFSPOCaH7DEbxmK+QIb/6j5t0JYxAq6JS4 D2whHBRvFJAFcPDsARUkavkp+z9cTIXgDtUkfv/F4xHfhOl1pENxZ3y4wF8YuSRuYT+7 qbwg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=s6P1sc3mERdhXh+Ln6sgXLR+dCmLGzGyOKMeNMcoO90=; b=j4ZsJEkeVYVRQpsQFlPhutCYwQwhZylhYL0O6CcbzMZR4rc7SvqA5HZLRj1EbCtBf5 2Siq++m/8HPCpyFInYDaworKBpKIY24W4dibnr2Pi+vPzwoFoMkYn0bscu/7381mJddA OgeMNgCOiLT4+HeJ/Dra5wF8qF+VCJtuVG+pEQdR1I+wqTPafGw02hh5jMbFBNMUxVKp jX8iQRk4sBfZtsjzSI3t8Lk8tkfiGPLpZUtmgRU2TRKgfqaRcokrBpPdvEo4NGzBkZxz lraLr0m+xE3Z5gRDb0xySVZchtTh5tX8iheXNbhl7LpgTFOX59RwliMiRynF6cU3i8f1 OZhw== 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 m21-v6si1930324pgn.599.2018.06.13.01.27.56; Wed, 13 Jun 2018 01:28:10 -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; 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 S934619AbeFMIZr (ORCPT + 99 others); Wed, 13 Jun 2018 04:25:47 -0400 Received: from smtp.eu.citrix.com ([185.25.65.24]:27873 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934388AbeFMIZp (ORCPT ); Wed, 13 Jun 2018 04:25:45 -0400 X-IronPort-AV: E=Sophos;i="5.51,218,1526342400"; d="scan'208";a="74572845" Date: Wed, 13 Jun 2018 10:24:28 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Anchal Agarwal CC: , , , , , , , , , , , , , , , , , , , Subject: Re: [RFC PATCH 06/12] xen-blkfront: add callbacks for PM suspend and hibernation Message-ID: <20180613082428.bjdko4k6cnq6eid3@mac> References: <20180612205619.28156-1-anchalag@amazon.com> <20180612205619.28156-7-anchalag@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180612205619.28156-7-anchalag@amazon.com> User-Agent: NeoMutt/20180512 X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 12, 2018 at 08:56:13PM +0000, Anchal Agarwal wrote: > From: Munehisa Kamata > > Add freeze and restore callbacks for PM suspend and hibernation support. > The freeze handler stops a block-layer queue and disconnect the frontend > from the backend while freeing ring_info and associated resources. The > restore handler re-allocates ring_info and re-connect to the backedend, > so the rest of the kernel can continue to use the block device > transparently.Also, the handlers are used for both PM > suspend and hibernation so that we can keep the existing suspend/resume > callbacks for Xen suspend without modification. > If a backend doesn't have commit 12ea729645ac ("xen/blkback: unmap all > persistent grants when frontend gets disconnected"), the frontend may see > massive amount of grant table warning when freeing resources. > > [ 36.852659] deferring g.e. 0xf9 (pfn 0xffffffffffffffff) > [ 36.855089] xen:grant_table: WARNING: g.e. 0x112 still in use! > > In this case, persistent grants would need to be disabled. > > Ensure no reqs/rsps in rings before disconnecting. When disconnecting > the frontend from the backend in blkfront_freeze(), there still may be > unconsumed requests or responses in the rings, especially when the > backend is backed by network-based device. If the frontend gets > disconnected with such reqs/rsps remaining there, it can cause > grant warnings and/or losing reqs/rsps by freeing pages afterward. I'm not sure why having pending requests can cause grant warnings or lose of requests. If handled properly this shouldn't be an issue. Linux blkfront already does live migration (which also involves a reconnection of the frontend) with pending requests and that doesn't seem to be an issue. > This can lead resumed kernel into unrecoverable state like unexpected > freeing of grant page and/or hung task due to the lost reqs or rsps. > Therefore we have to ensure that there is no unconsumed requests or > responses before disconnecting. Given that we have multiqueue, plus multipage rings, I'm not sure waiting for the requests on the rings to complete is a good idea. Why can't you just disconnect the frontend and requeue all the requests in flight? When the frontend connects on resume those requests will be queued again. Thanks, Roger.