All of lore.kernel.org
 help / color / mirror / Atom feed
From: micky <micky_ching@realsil.com.cn>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Chris Ball <chris@printf.net>, Wei WANG <wei_wang@realsil.com.cn>,
	Roger <rogerable@realtek.com>,
	devel@linuxdriverproject.org, Lee Jones <lee.jones@linaro.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH 2/2] mmc: rtsx: add support for async request
Date: Wed, 18 Jun 2014 09:17:19 +0800	[thread overview]
Message-ID: <53A0E89F.9010006@realsil.com.cn> (raw)
In-Reply-To: <CAPDyKFqK8mLGc82FfEoxdHG7mioX7JmtFDO=18XZRkwQ4ykU2g@mail.gmail.com>

On 06/17/2014 03:45 PM, Ulf Hansson wrote:
> On 17 June 2014 03:04, micky <micky_ching@realsil.com.cn> wrote:
>> On 06/16/2014 08:40 PM, Ulf Hansson wrote:
>>> On 16 June 2014 11:09, micky <micky_ching@realsil.com.cn> wrote:
>>>> On 06/16/2014 04:42 PM, Ulf Hansson wrote:
>>>>>> @@ -36,7 +37,10 @@ struct realtek_pci_sdmmc {
>>>>>>>           struct rtsx_pcr         *pcr;
>>>>>>>           struct mmc_host         *mmc;
>>>>>>>           struct mmc_request      *mrq;
>>>>>>> +       struct workqueue_struct *workq;
>>>>>>> +#define SDMMC_WORKQ_NAME       "rtsx_pci_sdmmc_workq"
>>>>>>>
>>>>>>> +       struct work_struct      work;
>>>>> I am trying to understand why you need a work/workqueue to implement
>>>>> this feature. Is that really the case?
>>>>>
>>>>> Could you elaborate on the reasons?
>>>> Hi Uffe,
>>>>
>>>> we need return as fast as possible in mmc_host_ops request(ops->request)
>>>> callback,
>>>> so the mmc core can continue handle next request.
>>>> when next request everything is ready, it will wait previous done(if not
>>>> done),
>>>> then call ops->request().
>>>>
>>>> we can't use atomic context, because we use mutex_lock() to protect
>>> ops->request should never executed in atomic context. Is that your
>>> concern?
>> Yes.
> Okay. Unless I missed your point, I don't think you need the work/workqueue.
any other method?
>
> Because, ops->request isn't ever executed in atomic context. That's
> due to the mmc core, which handles the async mechanism, are waiting
> for a completion variable in process context, before it invokes the
> ops->request() callback.
>
> That completion variable will be kicked, from your host driver, when
> you invoke mmc_request_done(), .
Sorry, I don't understand here, how kicked?

I think the flow is:
- not wait for first req
- init mrq->done
- ops->request()                         ---         A.rtsx: start queue 
work.
- continue fetch next req
- prepare next req ok,
- wait previous done.                --- B.(mmc_request_done() may be 
called at any time from A to B)
- init mrq->done
- ops->request()                         ---         C.rtsx: start queue 
next work.
...
and seems no problem.

Best Regards.
micky.
> Kind regards
> Uffe
>
>>>
>>>> resource, and we have to hold the lock during handle request.
>>>> So I use workq, we just queue a work and return in ops->request(),
>>>> The mmc core can continue without blocking at ops->request().
>>>>
>>>> Best Regards.
>>>> micky.
>>> Kind regards
>>> Uffe
>>> .
>>>
> .
>

WARNING: multiple messages have this Message-ID (diff)
From: micky <micky_ching@realsil.com.cn>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>, Chris Ball <chris@printf.net>,
	<devel@linuxdriverproject.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Roger <rogerable@realtek.com>, Wei WANG <wei_wang@realsil.com.cn>
Subject: Re: [PATCH 2/2] mmc: rtsx: add support for async request
Date: Wed, 18 Jun 2014 09:17:19 +0800	[thread overview]
Message-ID: <53A0E89F.9010006@realsil.com.cn> (raw)
In-Reply-To: <CAPDyKFqK8mLGc82FfEoxdHG7mioX7JmtFDO=18XZRkwQ4ykU2g@mail.gmail.com>

On 06/17/2014 03:45 PM, Ulf Hansson wrote:
> On 17 June 2014 03:04, micky <micky_ching@realsil.com.cn> wrote:
>> On 06/16/2014 08:40 PM, Ulf Hansson wrote:
>>> On 16 June 2014 11:09, micky <micky_ching@realsil.com.cn> wrote:
>>>> On 06/16/2014 04:42 PM, Ulf Hansson wrote:
>>>>>> @@ -36,7 +37,10 @@ struct realtek_pci_sdmmc {
>>>>>>>           struct rtsx_pcr         *pcr;
>>>>>>>           struct mmc_host         *mmc;
>>>>>>>           struct mmc_request      *mrq;
>>>>>>> +       struct workqueue_struct *workq;
>>>>>>> +#define SDMMC_WORKQ_NAME       "rtsx_pci_sdmmc_workq"
>>>>>>>
>>>>>>> +       struct work_struct      work;
>>>>> I am trying to understand why you need a work/workqueue to implement
>>>>> this feature. Is that really the case?
>>>>>
>>>>> Could you elaborate on the reasons?
>>>> Hi Uffe,
>>>>
>>>> we need return as fast as possible in mmc_host_ops request(ops->request)
>>>> callback,
>>>> so the mmc core can continue handle next request.
>>>> when next request everything is ready, it will wait previous done(if not
>>>> done),
>>>> then call ops->request().
>>>>
>>>> we can't use atomic context, because we use mutex_lock() to protect
>>> ops->request should never executed in atomic context. Is that your
>>> concern?
>> Yes.
> Okay. Unless I missed your point, I don't think you need the work/workqueue.
any other method?
>
> Because, ops->request isn't ever executed in atomic context. That's
> due to the mmc core, which handles the async mechanism, are waiting
> for a completion variable in process context, before it invokes the
> ops->request() callback.
>
> That completion variable will be kicked, from your host driver, when
> you invoke mmc_request_done(), .
Sorry, I don't understand here, how kicked?

I think the flow is:
- not wait for first req
- init mrq->done
- ops->request()                         ---         A.rtsx: start queue 
work.
- continue fetch next req
- prepare next req ok,
- wait previous done.                --- B.(mmc_request_done() may be 
called at any time from A to B)
- init mrq->done
- ops->request()                         ---         C.rtsx: start queue 
next work.
...
and seems no problem.

Best Regards.
micky.
> Kind regards
> Uffe
>
>>>
>>>> resource, and we have to hold the lock during handle request.
>>>> So I use workq, we just queue a work and return in ops->request(),
>>>> The mmc core can continue without blocking at ops->request().
>>>>
>>>> Best Regards.
>>>> micky.
>>> Kind regards
>>> Uffe
>>> .
>>>
> .
>


  reply	other threads:[~2014-06-18  1:17 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06  7:05 [PATCH 0/2] mmc: rtsx: add support for async request micky_ching
2014-06-06  7:05 ` micky_ching
2014-06-06  7:05 ` [PATCH 1/2] mfd: rtsx: add dma transfer function micky_ching
2014-06-06  7:05   ` micky_ching
2014-06-16 12:20   ` Lee Jones
2014-06-16 14:24     ` Ulf Hansson
2014-06-16 14:24       ` Ulf Hansson
2014-06-18  8:00       ` Lee Jones
2014-07-02  9:14         ` micky
2014-07-02  9:14           ` micky
2014-07-02 12:15           ` Lee Jones
2014-06-17  1:08     ` micky
2014-06-17  1:08       ` micky
2014-06-06  7:05 ` [PATCH 2/2] mmc: rtsx: add support for async request micky_ching
2014-06-06  7:05   ` micky_ching
2014-06-16  8:42   ` Ulf Hansson
2014-06-16  8:42     ` Ulf Hansson
2014-06-16  8:51     ` Arend van Spriel
2014-06-16  8:51       ` Arend van Spriel
2014-06-16  9:09     ` micky
2014-06-16  9:09       ` micky
2014-06-16 12:40       ` Ulf Hansson
2014-06-17  1:04         ` micky
2014-06-17  1:04           ` micky
2014-06-17  7:45           ` Ulf Hansson
2014-06-17  7:45             ` Ulf Hansson
2014-06-18  1:17             ` micky [this message]
2014-06-18  1:17               ` micky
2014-06-18  7:39               ` Ulf Hansson
2014-06-18  7:39                 ` Ulf Hansson
2014-06-18 10:08                 ` micky
2014-06-18 10:08                   ` micky
2014-06-18 11:03                   ` Ulf Hansson
2014-06-19  1:57                     ` micky
2014-06-19  1:57                       ` micky
2014-06-23  9:26                       ` micky
2014-06-23  9:26                         ` micky
2014-07-02  8:53   ` Ulf Hansson
2014-07-18  7:28 ` [PATCH 0/2] " Lee Jones
2014-07-18  7:28   ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53A0E89F.9010006@realsil.com.cn \
    --to=micky_ching@realsil.com.cn \
    --cc=chris@printf.net \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rogerable@realtek.com \
    --cc=sameo@linux.intel.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wei_wang@realsil.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.