All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michal Wajdeczko" <michal.wajdeczko@intel.com>
To: "Michał Winiarski" <michal.winiarski@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 08/13] drm/i915/guc: Implement response handling in send_ct()
Date: Mon, 26 Mar 2018 18:39:22 +0200	[thread overview]
Message-ID: <op.zghsjwx7xaggs7@mwajdecz-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20180326152932.i7g4i52pzxf33njl@mwiniars-main.ger.corp.intel.com>

On Mon, 26 Mar 2018 17:29:32 +0200, Michał Winiarski  
<michal.winiarski@intel.com> wrote:

> On Fri, Mar 23, 2018 at 02:47:23PM +0000, Michal Wajdeczko wrote:
>> Instead of returning small data in response status dword,
>> GuC may append longer data as response message payload.
>> If caller provides response buffer, we will copy received
>> data and use number of received data dwords as new success
>> return value. We will WARN if response from GuC does not
>> match caller expectation.
>>
>> v2: fix timeout and checkpatch warnings (Michal)
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Oscar Mateo <oscar.mateo@intel.com>
>> Cc: Michel Thierry <michel.thierry@intel.com>
>> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_guc_ct.c | 137  
>> ++++++++++++++++++++++++++++++++----
>>  drivers/gpu/drm/i915/intel_guc_ct.h |   5 ++
>>  2 files changed, 128 insertions(+), 14 deletions(-)
>>
>
> [SNIP]
>
>> @@ -418,13 +499,15 @@ static int ctch_send(struct intel_guc *guc,
>>  static int intel_guc_send_ct(struct intel_guc *guc, const u32 *action,  
>> u32 len,
>>  			     u32 *response_buf, u32 response_buf_size)
>>  {
>> -	struct intel_guc_ct_channel *ctch = &guc->ct.host_channel;
>> +	struct intel_guc_ct *ct = &guc->ct;
>> +	struct intel_guc_ct_channel *ctch = &ct->host_channel;
>>  	u32 status = ~0; /* undefined */
>>  	int ret;
>>
>>  	mutex_lock(&guc->send_mutex);
>>
>> -	ret = ctch_send(guc, ctch, action, len, &status);
>> +	ret = ctch_send(ct, ctch, action, len, response_buf,  
>> response_buf_size,
>> +			&status);
>>  	if (unlikely(ret < 0)) {
>>  		DRM_ERROR("CT: send action %#X failed; err=%d status=%#X\n",
>>  			  action[0], ret, status);
>> @@ -503,8 +586,13 @@ static int ctb_read(struct intel_guc_ct_buffer  
>> *ctb, u32 *data)
>>  static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg)
>>  {
>>  	u32 header = msg[0];
>> +	u32 fence = msg[1];
>>  	u32 status = msg[2];
>>  	u32 len = ct_header_get_len(header) + 1; /* total len with header */
>> +	u32 payload_len = len - 3; /* len<3 is treated as protocol error */
>
> Magic numbers, please ether define 3 as min payload length or hide this  
> behind
> macro.

Well, it looks that detailed CTB documentation can't wait any more...
(simplified doc was already there:

	/* Response message shall at least include header, fence and status */

I'll try to include more docs in next series spin to make these numbers  
more
clear for everyone

>
>> +	struct ct_request *req;
>> +	bool found = false;
>> +	unsigned long flags;
>>
>>  	GEM_BUG_ON(!ct_header_is_response(header));
>>
>> @@ -518,8 +606,29 @@ static int ct_handle_response(struct intel_guc_ct  
>> *ct, const u32 *msg)
>>  		DRM_ERROR("CT: corrupted response %*phn\n", 4*len, msg);
>>  		return -EPROTO;
>>  	}
>> +	spin_lock_irqsave(&ct->lock, flags);
>
> Isn't this called from the irq? We can use plain spin_lock here.

yes, will update, thanks

>
>> +	list_for_each_entry(req, &ct->pending_requests, link) {
>> +		if (req->fence != fence) {
>> +			DRM_DEBUG_DRIVER("CT: request %u awaits response\n",
>> +					 req->fence);
>> +			continue;
>
> Is this expected?

rather not, tempting to mark that with 'unlikely'

> In other words - do we expect out of order responses?

not today, since we're using send_mutex to serialize all requests
(serialization was required for MMIO based comm, but not for CT)

> Can we extract this into a helper (find request)?

will try, but can't promise

thanks,
/m
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-03-26 16:39 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 14:47 [PATCH v4 00/13] drm/i915/guc: Support for Guc responses and requests Michal Wajdeczko
2018-03-23 14:47 ` [PATCH v4 01/13] drm/i915/guc: Add documentation for MMIO based communication Michal Wajdeczko
2018-03-23 21:29   ` Michel Thierry
2018-03-24  7:09     ` Michal Wajdeczko
2018-03-23 14:47 ` [PATCH v4 02/13] drm/i915/guc: Add support for data reporting in GuC responses Michal Wajdeczko
2018-03-23 21:33   ` Michel Thierry
2018-03-23 14:47 ` [PATCH v4 03/13] drm/i915/guc: Prepare send() function to accept bigger response Michal Wajdeczko
2018-03-23 21:48   ` Michel Thierry
2018-03-23 14:47 ` [PATCH v4 04/13] drm/i915/guc: Implement response handling in send_mmio() Michal Wajdeczko
2018-03-23 21:55   ` Michel Thierry
2018-03-24  7:09     ` Michal Wajdeczko
2018-03-23 14:47 ` [PATCH v4 05/13] drm/i915/guc: Make event handler a virtual function Michal Wajdeczko
2018-03-23 22:25   ` Michel Thierry
2018-03-24  7:14     ` Michal Wajdeczko
2018-03-23 14:47 ` [PATCH v4 06/13] drm/i915/guc: Prepare to handle messages from CT RECV buffer Michal Wajdeczko
2018-03-23 22:39   ` Michel Thierry
2018-03-23 14:47 ` [PATCH v4 07/13] drm/i915/guc: Use better name for helper wait function Michal Wajdeczko
2018-03-23 22:35   ` Michel Thierry
2018-03-23 14:47 ` [PATCH v4 08/13] drm/i915/guc: Implement response handling in send_ct() Michal Wajdeczko
2018-03-23 22:55   ` Michel Thierry
2018-03-26 15:29   ` Michał Winiarski
2018-03-26 15:35     ` Jani Nikula
2018-03-26 16:48       ` Michal Wajdeczko
2018-03-26 16:39     ` Michal Wajdeczko [this message]
2018-03-23 14:47 ` [PATCH v4 09/13] drm/i915/guc: Prepare to process incoming requests from CT Michal Wajdeczko
2018-03-23 23:23   ` Michel Thierry
2018-03-23 14:47 ` [PATCH v4 10/13] drm/i915/guc: Enable GuC interrupts when using CT Michal Wajdeczko
2018-03-23 23:02   ` Michel Thierry
2018-03-23 14:47 ` [PATCH v4 11/13] drm/i915/guc: Handle default action received over CT Michal Wajdeczko
2018-03-23 23:29   ` Michel Thierry
2018-03-23 14:47 ` [PATCH v4 12/13] drm/i915/guc: Trace messages from CT while in debug Michal Wajdeczko
2018-03-23 14:47 ` [PATCH v4 13/13] HAX: Enable GuC for CI Michal Wajdeczko
2018-03-23 16:43 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/guc: Support for Guc responses and requests (rev2) Patchwork
2018-03-23 16:47 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-03-23 16:58 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-23 19:32 ` ✗ Fi.CI.IGT: failure " Patchwork

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=op.zghsjwx7xaggs7@mwajdecz-mobl1.ger.corp.intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=michal.winiarski@intel.com \
    /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.