Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3157527pxy; Mon, 3 May 2021 17:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSlwaXscPSUazvfBkm4CldtNVZmpChnDk/ecGmzyd1d9r8hTXHlQ1i7nJHR8cbBpJswzb1 X-Received: by 2002:aa7:de02:: with SMTP id h2mr23001148edv.61.1620086504790; Mon, 03 May 2021 17:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620086504; cv=none; d=google.com; s=arc-20160816; b=wIAGeg9Qvme6WeqCaWIxo8TmTajiEathXkTBw1jEVEUpPR95B70MbV4sP0if/NJV25 +4LvWpESZjab+1Vt3qjbCrGkJBVYxWxndr8lXrq+dtHosVwNGpQswEYrctF6+Oz1Vt5l wpRmYWbrpzhv9p81oB0UzixXyVkXMu8k8IUlgVynfOKPgQD3rwUFaKgmpnKUM0Q/93mk SnayIs0hr/s1IKQ9FCXSmJJUihxRBbb+CoNsMK2QWRdwdFmr5zI0X+LhLqjU3HUHM2yh Pfpq84aDbJbe0fD/crL1EqqGt/NyXdCA96elVjRZ3B0y6flTO88Dp3Q7VverRcFdxQJb xadQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=piSiT9kDksxiHfZ76iqY3kE19gY3ObsqvOI9b3fVh1w=; b=myIC2r5nW0z8Dn27N+OP9Ej0RxyaiuXKpognTKXgB31D1K3Oe0vzvU2kRj6WAIdcvU bNhGX5FpqHXgkpWJDxBqP3eXzyx7QYbW8OAApdfIkEVeUPYTHa/FRxQSCJ4ZpGRmgnV7 pdxtXoNTBkKi3qHWDNRXpPNM1jDuwGcwboA5aXSLo9DotUBhqs1F2hUIhqiSg8dXlvGc /ybgRgfLhaGwnytNocT6A0PBkW0yxbkGd1PFxtDQHf1Pe9+5X6Q82dVqh7gJg9rXSnKK 0xIPJBhotHdxrZU7KSKqWTsguwTTyOdWw+acG93BXavkm51F2SRJgFKzZ2qnVth8XjR2 A02Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=Yk6vVwdo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l33si10959781ede.161.2021.05.03.17.01.06; Mon, 03 May 2021 17:01:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=Yk6vVwdo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbhECX5W (ORCPT + 99 others); Mon, 3 May 2021 19:57:22 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:17082 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbhECX5R (ORCPT ); Mon, 3 May 2021 19:57:17 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1620086183; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=piSiT9kDksxiHfZ76iqY3kE19gY3ObsqvOI9b3fVh1w=; b=Yk6vVwdoYXPCqUw4YvDD/cAmc6vpSIRWTe0uGeTvxVm0qtMvJU72E++pGVu60TTk29sNYJC0 ijltw4YQcgoMmiFuUqJjXOqA6JhZ8VxNL0B4lfKJSJPR9ppIMHluQOMwZH1BgtcB3C9fz+Nx sqIU0nTlAWdMs1eLnm4KhPhr8Ak= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 60908d912cbba88980d49b0f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 03 May 2021 23:56:01 GMT Sender: hemantk=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8DC79C433F1; Mon, 3 May 2021 23:56:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from [10.46.162.249] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: hemantk) by smtp.codeaurora.org (Postfix) with ESMTPSA id 78341C433F1; Mon, 3 May 2021 23:55:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 78341C433F1 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=hemantk@codeaurora.org Subject: Re: [PATCH] mhi: add MHI_STATE_M2 to resume success criteria To: Baochen Qiang , manivannan.sadhasivam@linaro.org Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, ath11k@lists.infradead.org References: <20210420035339.282963-1-bqiang@codeaurora.org> From: Hemant Kumar Message-ID: <11a51914-141d-24b6-cffa-4eb093aaea7f@codeaurora.org> Date: Mon, 3 May 2021 16:55:59 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210420035339.282963-1-bqiang@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/19/21 8:53 PM, Baochen Qiang wrote: > During system resume, mhi driver triggers M3->M0 transition and then waits > for target device to enter M0 state. Once done, the device queues a state > change event into ctrl event ring and notify mhi dirver by raising an > interrupt, where a tasklet is scheduled to process this event. In most cases, > the taklet is served timely and wait operation succeeds. > > However, there are cases where CPU is busy and can not serve this tasklet > for some time. Once delay goes long enough, the device moves itself to M1 > state and also interrupts mhi driver after inserting a new state change > event to ctrl ring. Later CPU finally has time to process the ring, however > there are two events in it now: > 1. for M3->M0 event, which is processed first as queued first, > tasklet handler updates device state to M0 and wakes up the task, > i.e., the mhi driver. > 2. for M0->M1 event, which is processed later, tasklet handler > triggers M1->M2 transition and updates device state to M2 directly, > then wakes up the mhi driver(if still sleeping on this wait queue). > Note that although mhi driver has been woken up while processing the first > event, it may still has no chance to run before the second event is processed. > In other words, mhi driver has to keep waiting till timeout cause the M0 state > has been missed. > > kernel log here: > ... > Apr 15 01:45:14 test-NUC8i7HVK kernel: [ 4247.911251] mhi 0000:06:00.0: Entered with PM state: M3, MHI state: M3 > Apr 15 01:45:14 test-NUC8i7HVK kernel: [ 4247.917762] mhi 0000:06:00.0: State change event to state: M0 > Apr 15 01:45:14 test-NUC8i7HVK kernel: [ 4247.917767] mhi 0000:06:00.0: State change event to state: M1 > Apr 15 01:45:14 test-NUC8i7HVK kernel: [ 4338.788231] mhi 0000:06:00.0: Did not enter M0 state, MHI state: M2, PM state: M2 > ... > > Fix this issue by simply adding M2 as a valid state for resume. > > Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 > > Signed-off-by: Baochen Qiang nice explanation of the issue! Reviewed-by: Hemant Kumar -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project