From patchwork Sun Jul 7 01:53:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 13725953 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCF8CEDC for ; Sun, 7 Jul 2024 01:53:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720317232; cv=none; b=prM8V3L8xN2qLy8WYoVnv4qYSgxcsgy9YkZpK955piDCxMBw6CKACXR9Y3fKlzspvqmTtPveoABnehWlhB5Fh+4ONez6mpI6WETeBAj0vfmvSGZJ1biRuS20HLfEEFYUPsGhJYYSTjDv8wDx9/IrcN4s07mnaGXv32bKoYdUB38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720317232; c=relaxed/simple; bh=QO1QfZmFH3nb7jOEf1BOZgRTSR0pQimUermeoLT/Udc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ipt26q87FfZ0aaxpeSekvXnHDx9fhNOroD+PxESJH8KJN7wk4aBEUzyipE0GHVK3RT5fU4iux/ZFdI+fwpZClwTs6Xqds/2fvBty0V5kOuoBvqmQCdTsMIIOk2yZVy1nwmlhcHbvmTKYr7otR/fPDoqeSQdpVLkSKUsXEUz1qoU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Icw52A9S; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Icw52A9S" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720317230; x=1751853230; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QO1QfZmFH3nb7jOEf1BOZgRTSR0pQimUermeoLT/Udc=; b=Icw52A9SRbZGx/IQlz+GkV9dOZGSvrwImOwPRO/fz5Tsii1w4hHVM8Y8 SHBFom/oThc64y+hlwQb7e6Zdj1HYD/Q3JAeBHHoMr0gV0NrWlA0ju6/e GGqRlXYUCcjuqQzcUMyQZ18XVHu5qMg86sUpWAyDww225B1E+M1u18M6/ newE+ApeEewkHoSMxNbQ2I3z0Ej3cSG4mJR2xi4N+rXfauTNipIOhln4A fjRIU1HM/0jP3EsZXeu2F7fCuK1/g8jw4FgSdLuD0ECCo+vu7Wyn44j2z TZBV7gBncDFpfpdffLtFx52uHpb18QE+EkhCWCc9IOjMvZKnjY4QcqSIt A==; X-CSE-ConnectionGUID: QM1mFvE/Toyia977LR1XTg== X-CSE-MsgGUID: a4cUnvkXSeqy6IXgWD3X7w== X-IronPort-AV: E=McAfee;i="6700,10204,11125"; a="17680732" X-IronPort-AV: E=Sophos;i="6.09,189,1716274800"; d="scan'208";a="17680732" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2024 18:53:49 -0700 X-CSE-ConnectionGUID: GY9wTxHVRdyNMPcNzjQ/4Q== X-CSE-MsgGUID: AUzRMtsgRlGyEtiJ2sH3ww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,189,1716274800"; d="scan'208";a="46948298" Received: from pgarg3-mobl.amr.corp.intel.com (HELO localhost) ([10.209.105.130]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2024 18:53:48 -0700 From: alison.schofield@intel.com To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams Cc: linux-cxl@vger.kernel.org, Xingtao Yao Subject: [PATCH v2 1/2] cxl/memdev: Replace ENXIO with EBUSY for inject poison limit reached Date: Sat, 6 Jul 2024 18:53:43 -0700 Message-Id: <825bd4c67fb55a4373c4182d999ad49d4e6b4fe7.1720316188.git.alison.schofield@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Alison Schofield The CXL driver provides a debugfs interface offering users the ability to inject and clear poison to a memdev. Once a user has injected up to the devices limit further injection requests fail with ENXIO until a clear poison is issued. Users may not have device specs in hand or may want to intentionally hit the limit and then clear. Replace the usual ENXIO return status with EBUSY so users can recognize this failure. Signed-off-by: Alison Schofield Tested-by: Xingtao Yao Reviewed-by: Dan Williams Reviewed-by: Davidlohr Bueso --- Documentation/ABI/testing/debugfs-cxl | 7 ++++--- drivers/cxl/cxlmem.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Documentation/ABI/testing/debugfs-cxl b/Documentation/ABI/testing/debugfs-cxl index c61f9b813973..12488c14be64 100644 --- a/Documentation/ABI/testing/debugfs-cxl +++ b/Documentation/ABI/testing/debugfs-cxl @@ -14,9 +14,10 @@ Description: event to its internal Informational Event log, updates the Event Status register, and if configured, interrupts the host. It is not an error to inject poison into an address that - already has poison present and no error is returned. The - inject_poison attribute is only visible for devices supporting - the capability. + already has poison present and no error is returned. If the + device returns 'Inject Poison Limit Reached' an -EBUSY error + is returned to the user. The inject_poison attribute is only + visible for devices supporting the capability. What: /sys/kernel/debug/memX/clear_poison diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h index 19aba81cdf13..942063c09459 100644 --- a/drivers/cxl/cxlmem.h +++ b/drivers/cxl/cxlmem.h @@ -161,7 +161,7 @@ struct cxl_mbox_cmd { C(FWRESET, -ENXIO, "FW failed to activate, needs cold reset"), \ C(HANDLE, -ENXIO, "one or more Event Record Handles were invalid"), \ C(PADDR, -EFAULT, "physical address specified is invalid"), \ - C(POISONLMT, -ENXIO, "poison injection limit has been reached"), \ + C(POISONLMT, -EBUSY, "poison injection limit has been reached"), \ C(MEDIAFAILURE, -ENXIO, "permanent issue with the media"), \ C(ABORT, -ENXIO, "background cmd was aborted by device"), \ C(SECURITY, -ENXIO, "not valid in the current security state"), \ From patchwork Sun Jul 7 01:53:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 13725954 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D87217F8 for ; Sun, 7 Jul 2024 01:53:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720317232; cv=none; b=N8oo2gAf1ghISbuE5/H2+V71g+Ww1oPW9c5XZySw4EEGWjqCY5RvR4Ql7naENeq2ByXi+ZkVAwgEs0mG42i+b47Tmhdr4gM9OwhGQXtqjzN7UepYOHqWtTQBsXtsBvw8oRtX2y/HS4/OQLm+3o5RvGffbq6IBwZbDKy2f2qX+6k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720317232; c=relaxed/simple; bh=HMN7EeUnBjxaKElfwy6Qc7ln9fYBBw14YAysyqF62Ec=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pHak243eRiPhTNH/TlfOBRtuTGEgpCt5GEMejxU370GvwxTiUQIy0UXakmlPhnAyvRtsh3sOaMlCalNtp/3o12yiqiyghF9TPp9LlgDBcNxNqcaUue1mZNzchMM4oQQrRjKT73DqKyx5oHK2u/5xaJxSUGiv6zmUygNVGcMQX54= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Jjnq8LD7; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Jjnq8LD7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720317231; x=1751853231; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HMN7EeUnBjxaKElfwy6Qc7ln9fYBBw14YAysyqF62Ec=; b=Jjnq8LD7G+aXETDBagoVbPJ/rhZJD99wwx91zocAB0mBPSi1JGiRQYGe nEqtle7kS1nrVntDF5nOd/+qIJgHZjGNVZx9MEcp5zIyaQ8tFPyD4kV3v Y+oNInDGTjw1BO6df7X/v+4QwjcbXHR5c5t5ujxekwWsl5IFCNB6qxHJN XBKFOuJdwaF4HRpH/Plm+xOZdLvZxg04864c8CrjFnHNM+Uq9GgYQN1/O ziuUx9eQ9Zcdc6Nf23Ua456NC6cjYj7TRb6JMXEEh4KWM5OxC7YZ5SFQo LBI0YLd4tie99pmyPDjQ2E0LnDcRtDHo5WhcShGQy2etTHyf2+uf1WrX7 Q==; X-CSE-ConnectionGUID: doLVzY73Tgyddta7ZdrYiA== X-CSE-MsgGUID: /T0AX84dTj604KqGU9X2mw== X-IronPort-AV: E=McAfee;i="6700,10204,11125"; a="17680741" X-IronPort-AV: E=Sophos;i="6.09,189,1716274800"; d="scan'208";a="17680741" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2024 18:53:50 -0700 X-CSE-ConnectionGUID: spGDXqYPS3W4ycBlNC+XCQ== X-CSE-MsgGUID: Yan12LlHRgCR4TriDcsSTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,189,1716274800"; d="scan'208";a="46948307" Received: from pgarg3-mobl.amr.corp.intel.com (HELO localhost) ([10.209.105.130]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2024 18:53:48 -0700 From: alison.schofield@intel.com To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams Cc: linux-cxl@vger.kernel.org, Xingtao Yao Subject: [PATCH v2 2/2] cxl/test: Replace ENXIO with EBUSY for inject poison limit reached Date: Sat, 6 Jul 2024 18:53:44 -0700 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Alison Schofield The CXL driver was recently updated to return EBUSY rather than ENXIO when the device reports that an injection request exceeds the device's limit. That change to EBUSY allows debug users to differentiate between limit reached and inject failures for any other reason. Change cxl-test to also return EBUSY and tidy up the dev_dbg() messaging to emit the correct limit. Reminder: the cxl-test per device injection limit is a configurable attribute: /sys/bus/platform/drivers/cxl_mock_mem/poison_inject_max Signed-off-by: Alison Schofield Tested-by: Xingtao Yao Reviewed-by: Dan Williams Reviewed-by: Davidlohr Bueso --- tools/testing/cxl/test/mem.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c index eaf091a3d331..8088f4255a66 100644 --- a/tools/testing/cxl/test/mem.c +++ b/tools/testing/cxl/test/mem.c @@ -1131,27 +1131,28 @@ static bool mock_poison_dev_max_injected(struct cxl_dev_state *cxlds) return (count >= poison_inject_dev_max); } -static bool mock_poison_add(struct cxl_dev_state *cxlds, u64 dpa) +static int mock_poison_add(struct cxl_dev_state *cxlds, u64 dpa) { + /* Return EBUSY to match the CXL driver handling */ if (mock_poison_dev_max_injected(cxlds)) { dev_dbg(cxlds->dev, "Device poison injection limit has been reached: %d\n", - MOCK_INJECT_DEV_MAX); - return false; + poison_inject_dev_max); + return -EBUSY; } for (int i = 0; i < MOCK_INJECT_TEST_MAX; i++) { if (!mock_poison_list[i].cxlds) { mock_poison_list[i].cxlds = cxlds; mock_poison_list[i].dpa = dpa; - return true; + return 0; } } dev_dbg(cxlds->dev, "Mock test poison injection limit has been reached: %d\n", MOCK_INJECT_TEST_MAX); - return false; + return -ENXIO; } static bool mock_poison_found(struct cxl_dev_state *cxlds, u64 dpa) @@ -1175,10 +1176,8 @@ static int mock_inject_poison(struct cxl_dev_state *cxlds, dev_dbg(cxlds->dev, "DPA: 0x%llx already poisoned\n", dpa); return 0; } - if (!mock_poison_add(cxlds, dpa)) - return -ENXIO; - return 0; + return mock_poison_add(cxlds, dpa); } static bool mock_poison_del(struct cxl_dev_state *cxlds, u64 dpa)