diff mbox series

[4/4] drm/i915/guc: Inject probe errors for CT send

Message ID 20211011152106.3424810-5-thanneeru.srinivasulu@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/guc: Inject probe errors for MMIO send, CT send | expand

Commit Message

Thanneeru Srinivasulu Oct. 11, 2021, 3:21 p.m. UTC
Inject probe errors -ENXIO, -EBUSY for CT send.

Signed-off-by: Thanneeru Srinivasulu <thanneeru.srinivasulu@intel.com>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Matthew Brost Oct. 11, 2021, 6 p.m. UTC | #1
On Mon, Oct 11, 2021 at 08:51:06PM +0530, Thanneeru Srinivasulu wrote:
> Inject probe errors -ENXIO, -EBUSY for CT send.
> 
> Signed-off-by: Thanneeru Srinivasulu <thanneeru.srinivasulu@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
> index 83764db0fd6d..8ffef3abd3da 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
> @@ -765,6 +765,14 @@ int intel_guc_ct_send(struct intel_guc_ct *ct, const u32 *action, u32 len,
>  	u32 status = ~0; /* undefined */
>  	int ret;
>  
> +	ret = i915_inject_probe_error(ct_to_i915(ct), -ENXIO);
> +	if (ret)
> +		return ret;
> +

I don't see where -ENXIO is returned during an error that we handle
unless I am missing something. If we don't return -ENXIO anywhere else I
don't think we need to inject this error.

Matt 

> +	ret = i915_inject_probe_error(ct_to_i915(ct), -EBUSY);
> +	if (ret)
> +		return ret;
> +
>  	if (unlikely(!ct->enabled)) {
>  		struct intel_guc *guc = ct_to_guc(ct);
>  		struct intel_uc *uc = container_of(guc, struct intel_uc, guc);
> -- 
> 2.25.1
>
Michal Wajdeczko Oct. 12, 2021, 3:12 p.m. UTC | #2
On 11.10.2021 20:00, Matthew Brost wrote:
> On Mon, Oct 11, 2021 at 08:51:06PM +0530, Thanneeru Srinivasulu wrote:
>> Inject probe errors -ENXIO, -EBUSY for CT send.
>>
>> Signed-off-by: Thanneeru Srinivasulu <thanneeru.srinivasulu@intel.com>
>> ---
>>  drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
>> index 83764db0fd6d..8ffef3abd3da 100644
>> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
>> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
>> @@ -765,6 +765,14 @@ int intel_guc_ct_send(struct intel_guc_ct *ct, const u32 *action, u32 len,
>>  	u32 status = ~0; /* undefined */
>>  	int ret;
>>  
>> +	ret = i915_inject_probe_error(ct_to_i915(ct), -ENXIO);
>> +	if (ret)
>> +		return ret;
>> +
> 
> I don't see where -ENXIO is returned during an error that we handle
> unless I am missing something. If we don't return -ENXIO anywhere else I
> don't think we need to inject this error.

but the point of this exercise is not to handle such error but to
gracefully abort probe without panic or leaks. note that we are already
using -ENXIO in many other injected failure points (mostly in uc code)

thus for me above change is also fine and the whole series is:

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>

-Michal

> 
> Matt 
> 
>> +	ret = i915_inject_probe_error(ct_to_i915(ct), -EBUSY);
>> +	if (ret)
>> +		return ret;
>> +
>>  	if (unlikely(!ct->enabled)) {
>>  		struct intel_guc *guc = ct_to_guc(ct);
>>  		struct intel_uc *uc = container_of(guc, struct intel_uc, guc);
>> -- 
>> 2.25.1
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
index 83764db0fd6d..8ffef3abd3da 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
@@ -765,6 +765,14 @@  int intel_guc_ct_send(struct intel_guc_ct *ct, const u32 *action, u32 len,
 	u32 status = ~0; /* undefined */
 	int ret;
 
+	ret = i915_inject_probe_error(ct_to_i915(ct), -ENXIO);
+	if (ret)
+		return ret;
+
+	ret = i915_inject_probe_error(ct_to_i915(ct), -EBUSY);
+	if (ret)
+		return ret;
+
 	if (unlikely(!ct->enabled)) {
 		struct intel_guc *guc = ct_to_guc(ct);
 		struct intel_uc *uc = container_of(guc, struct intel_uc, guc);