From: Christoph Manszewski <christoph.manszewski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
"Kamil Konieczny" <kamil.konieczny@linux.intel.com>,
"Dominik Grzegorzek" <dominik.grzegorzek@intel.com>,
"Maciej Patelczyk" <maciej.patelczyk@intel.com>,
"Dominik Karol Piątkowski" <dominik.karol.piatkowski@intel.com>,
"Pawel Sikora" <pawel.sikora@intel.com>,
"Andrzej Hajda" <andrzej.hajda@intel.com>,
"Kolanupaka Naveena" <kolanupaka.naveena@intel.com>,
"Mika Kuoppala" <mika.kuoppala@intel.com>,
"Gwan-gyeong Mun" <gwan-gyeong.mun@intel.com>,
"Christoph Manszewski" <christoph.manszewski@intel.com>
Subject: [PATCH 04/66] lib/xe_eudebug: Add exec_queue support
Date: Mon, 29 Jul 2024 18:00:57 +0200 [thread overview]
Message-ID: <20240729160159.37036-5-christoph.manszewski@intel.com> (raw)
In-Reply-To: <20240729160159.37036-1-christoph.manszewski@intel.com>
From: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Add support for exec_queue events to eudebug library.
Check event specific fields in post mortem log check. (Christoph)
Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Cc: Christoph Manszewski <christoph.manszewski@intel.com>
---
lib/xe/xe_eudebug.c | 188 +++++++++++++++++++++++++++++++++++++++++++-
lib/xe/xe_eudebug.h | 5 +-
2 files changed, 189 insertions(+), 4 deletions(-)
diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
index 70769e532..ca030704b 100644
--- a/lib/xe/xe_eudebug.c
+++ b/lib/xe/xe_eudebug.c
@@ -20,6 +20,17 @@ struct event_trigger {
struct igt_list_head link;
};
+struct seqno_list_entry {
+ struct igt_list_head link;
+ uint64_t seqno;
+};
+
+struct match_dto {
+ struct drm_xe_eudebug_event *target;
+ struct igt_list_head *seqno_list;
+ uint64_t client_handle;
+};
+
#define CLIENT_PID 1
#define CLIENT_RUN 2
#define CLIENT_FINI 3
@@ -41,6 +52,8 @@ static const char *type_to_str(unsigned int type)
return "client";
case DRM_XE_EUDEBUG_EVENT_VM:
return "vm";
+ case DRM_XE_EUDEBUG_EVENT_EXEC_QUEUE:
+ return "exec_queue";
}
return "UNKNOWN";
@@ -83,6 +96,15 @@ static const char *event_members_to_str(struct drm_xe_eudebug_event *e, char *b)
evm->client_handle, evm->vm_handle);
break;
}
+ case DRM_XE_EUDEBUG_EVENT_EXEC_QUEUE: {
+ struct drm_xe_eudebug_event_exec_queue *ee = (void *)e;
+
+ sprintf(b, "client_handle=%llu, vm_handle=%llu, "
+ "exec_queue_handle=%llu, engine_class=%d, exec_queue_width=%d",
+ ee->client_handle, ee->vm_handle,
+ ee->exec_queue_handle, ee->engine_class, ee->width);
+ break;
+ }
default:
strcpy(b, "<...>");
}
@@ -309,6 +331,34 @@ static int match_type_and_flags(struct drm_xe_eudebug_event *a, void *data)
return 0;
}
+static int match_fields(struct drm_xe_eudebug_event *a, void *data)
+{
+ struct drm_xe_eudebug_event *b = data;
+ int ret = 0;
+
+ ret = match_type_and_flags(a, data);
+ if (!ret)
+ return ret;
+
+ ret = 0;
+
+ switch (a->type) {
+ case DRM_XE_EUDEBUG_EVENT_EXEC_QUEUE: {
+ struct drm_xe_eudebug_event_exec_queue *ae = (void *)a;
+ struct drm_xe_eudebug_event_exec_queue *be = (void *)b;
+
+ if (ae->engine_class == be->engine_class && ae->width == be->width)
+ ret = 1;
+ break;
+ }
+ default:
+ ret = 1;
+ break;
+ }
+
+ return ret;
+}
+
static int match_client_handle(struct drm_xe_eudebug_event *e, void *data)
{
uint64_t h = *(uint64_t *)data;
@@ -328,6 +378,13 @@ static int match_client_handle(struct drm_xe_eudebug_event *e, void *data)
return 1;
break;
}
+ case DRM_XE_EUDEBUG_EVENT_EXEC_QUEUE: {
+ struct drm_xe_eudebug_event_exec_queue *ee = (struct drm_xe_eudebug_event_exec_queue *)e;
+
+ if (ee->client_handle == h)
+ return 1;
+ break;
+ }
default:
break;
}
@@ -365,12 +422,43 @@ static int match_opposite_resource(struct drm_xe_eudebug_event *e, void *data)
return 1;
break;
}
+ case DRM_XE_EUDEBUG_EVENT_EXEC_QUEUE: {
+ struct drm_xe_eudebug_event_exec_queue *ee = (void *)e;
+ struct drm_xe_eudebug_event_exec_queue *filter = (struct drm_xe_eudebug_event_exec_queue *)data;
+
+ if (ee->exec_queue_handle == filter->exec_queue_handle)
+ return 1;
+ break;
+ }
default:
break;
}
return 0;
}
+static int match_full(struct drm_xe_eudebug_event *e, void *data)
+{
+ struct seqno_list_entry *sl;
+
+ struct match_dto *md = (void *)data;
+ int ret = 0;
+
+ ret = match_client_handle(e, &md->client_handle);
+ if (!ret)
+ return 0;
+
+ ret = match_fields(e, md->target);
+ if (!ret)
+ return 0;
+
+ igt_list_for_each_entry(sl, md->seqno_list, link) {
+ if (sl->seqno == e->seqno)
+ return 0;
+ }
+
+ return 1;
+}
+
static struct drm_xe_eudebug_event *
event_type_match(struct xe_eudebug_event_log *l,
struct drm_xe_eudebug_event *filter,
@@ -395,6 +483,21 @@ opposite_event_match(struct xe_eudebug_event_log *l,
return event_cmp(l, current, match_opposite_resource, filter);
}
+static struct drm_xe_eudebug_event *
+event_match(struct xe_eudebug_event_log *l,
+ struct drm_xe_eudebug_event *target,
+ uint64_t client_handle,
+ struct igt_list_head *seqno_list)
+{
+ struct match_dto md = {
+ .target = target,
+ .client_handle = client_handle,
+ .seqno_list = seqno_list,
+ };
+
+ return event_cmp(l, NULL, match_full, &md);
+}
+
static void compare_client(struct xe_eudebug_event_log *c, struct drm_xe_eudebug_event *_ce,
struct xe_eudebug_event_log *d, struct drm_xe_eudebug_event *_de)
{
@@ -402,6 +505,9 @@ static void compare_client(struct xe_eudebug_event_log *c, struct drm_xe_eudebug
struct drm_xe_eudebug_event_client *de = (void *)_de;
struct drm_xe_eudebug_event *hc, *hd;
+ struct igt_list_head matched_seqno_list;
+ struct seqno_list_entry *entry, *tmp;
+
igt_assert(ce);
igt_assert(de);
@@ -409,13 +515,14 @@ static void compare_client(struct xe_eudebug_event_log *c, struct drm_xe_eudebug
hc = NULL;
hd = NULL;
+ IGT_INIT_LIST_HEAD(&matched_seqno_list);
do {
hc = client_match(c, ce->client_handle, hc);
if (!hc)
break;
- hd = client_match(d, de->client_handle, hd);
+ hd = event_match(d, hc, de->client_handle, &matched_seqno_list);
igt_assert_f(hd, "%s (%llu): no matching event type %u found for client %llu\n",
c->name,
@@ -426,9 +533,18 @@ static void compare_client(struct xe_eudebug_event_log *c, struct drm_xe_eudebug
igt_debug("comparing %s %llu vs %s %llu\n",
c->name, hc->seqno, d->name, hd->seqno);
- igt_assert_eq(hc->type, hd->type);
- igt_assert_eq(hc->flags, hd->flags);
+ /*
+ * Store the seqno of the event that was matched above,
+ * inside 'matched_seqno_list', to avoid it getting matched
+ * by subsequent 'event_match' calls.
+ */
+ entry = malloc(sizeof(*entry));
+ entry->seqno = hd->seqno;
+ igt_list_add(&entry->link, &matched_seqno_list);
} while (hc);
+
+ igt_list_for_each_entry_safe(entry, tmp, &matched_seqno_list, link)
+ free(entry);
}
/*
@@ -1196,6 +1312,25 @@ static void vm_event(struct xe_eudebug_client *c, uint32_t flags, int client_fd,
xe_eudebug_event_log_write(c->log, (void *)&evm);
}
+static void exec_queue_event(struct xe_eudebug_client *c, uint32_t flags,
+ int client_fd, uint32_t vm_id,
+ uint32_t exec_queue_handle, uint16_t class,
+ uint16_t width)
+{
+ struct drm_xe_eudebug_event_exec_queue ee;
+
+ base_event(c, to_base(ee), DRM_XE_EUDEBUG_EVENT_EXEC_QUEUE,
+ flags, sizeof(ee));
+
+ ee.client_handle = client_fd;
+ ee.vm_handle = vm_id;
+ ee.exec_queue_handle = exec_queue_handle;
+ ee.engine_class = class;
+ ee.width = width;
+
+ xe_eudebug_event_log_write(c->log, (void *)&ee);
+}
+
/* Eu debugger wrappers around resource creating xe ioctls. */
/**
@@ -1268,3 +1403,50 @@ void xe_eudebug_client_vm_destroy(struct xe_eudebug_client *c, int fd, uint32_t
xe_vm_destroy(fd, vm);
vm_event(c, DRM_XE_EUDEBUG_EVENT_DESTROY, fd, vm);
}
+
+/**
+ * xe_eudebug_client_exec_queue_create:
+ * @c: pointer to xe_eudebug_client structure
+ * @fd: xe client
+ * @create: exec_queue create drm struct
+ *
+ * Calls xe exec queue create ioctl and logs the corresponding event in
+ * client's event log.
+ *
+ * Returns: valid exec queue handle
+ */
+uint32_t xe_eudebug_client_exec_queue_create(struct xe_eudebug_client *c, int fd,
+ struct drm_xe_exec_queue_create *create)
+{
+ uint16_t class = ((struct drm_xe_engine_class_instance *)(create->instances))[0].engine_class;
+
+ igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, create), 0);
+
+ if (class == DRM_XE_ENGINE_CLASS_COMPUTE || class == DRM_XE_ENGINE_CLASS_RENDER)
+ exec_queue_event(c, DRM_XE_EUDEBUG_EVENT_CREATE, fd, create->vm_id,
+ create->exec_queue_id, class, create->width);
+
+ return create->exec_queue_id;
+}
+
+/**
+ * xe_eudebug_client_exec_queue_destroy:
+ * @c: pointer to xe_eudebug_client structure
+ * @fd: xe client
+ * @create: exec_queue create drm struct which was used for creation
+ *
+ * Calls xe exec_queue destroy ioctl and logs the corresponding event in
+ * client's event log.
+ */
+void xe_eudebug_client_exec_queue_destroy(struct xe_eudebug_client *c, int fd,
+ struct drm_xe_exec_queue_create *create)
+{
+ struct drm_xe_exec_queue_destroy destroy = { .exec_queue_id = create->exec_queue_id, };
+ uint16_t class = ((struct drm_xe_engine_class_instance *)(create->instances))[0].engine_class;
+
+ if (class == DRM_XE_ENGINE_CLASS_COMPUTE || class == DRM_XE_ENGINE_CLASS_RENDER)
+ exec_queue_event(c, DRM_XE_EUDEBUG_EVENT_DESTROY, fd, create->vm_id,
+ create->exec_queue_id, class, create->width);
+
+ igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_DESTROY, &destroy), 0);
+}
diff --git a/lib/xe/xe_eudebug.h b/lib/xe/xe_eudebug.h
index 5ec63e46b..8dc153d27 100644
--- a/lib/xe/xe_eudebug.h
+++ b/lib/xe/xe_eudebug.h
@@ -138,6 +138,10 @@ void xe_eudebug_client_close_driver(struct xe_eudebug_client *c, int fd);
uint32_t xe_eudebug_client_vm_create(struct xe_eudebug_client *c, int fd,
uint32_t flags, uint64_t ext);
void xe_eudebug_client_vm_destroy(struct xe_eudebug_client *c, int fd, uint32_t vm);
+uint32_t xe_eudebug_client_exec_queue_create(struct xe_eudebug_client *c, int fd,
+ struct drm_xe_exec_queue_create *create);
+void xe_eudebug_client_exec_queue_destroy(struct xe_eudebug_client *c, int fd,
+ struct drm_xe_exec_queue_create *create);
struct xe_eudebug_session *xe_eudebug_session_create(int fd,
xe_eudebug_client_work_fn work,
@@ -146,4 +150,3 @@ struct xe_eudebug_session *xe_eudebug_session_create(int fd,
void xe_eudebug_session_destroy(struct xe_eudebug_session *s);
void xe_eudebug_session_run(struct xe_eudebug_session *s);
void xe_eudebug_session_check(struct xe_eudebug_session *s, bool match_opposite);
-
--
2.34.1
next prev parent reply other threads:[~2024-07-29 16:02 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-29 16:00 [PATCH 00/66] Test coverage for GPU debug support Christoph Manszewski
2024-07-29 16:00 ` [PATCH 01/66] tests/xe_eudebug: Test eudebug connection Christoph Manszewski
2024-07-30 7:58 ` Zbigniew Kempczyński
2024-07-30 9:42 ` Manszewski, Christoph
2024-07-29 16:00 ` [PATCH 02/66] lib/xe_eudebug: Introduce eu debug testing framework Christoph Manszewski
2024-07-29 16:00 ` [PATCH 03/66] lib/xe_eudebug: Allow client to wait for debugger Christoph Manszewski
2024-07-29 16:00 ` Christoph Manszewski [this message]
2024-07-29 16:00 ` [PATCH 05/66] lib/xe_eudebug: Add attention events support Christoph Manszewski
2024-07-29 16:00 ` [PATCH 06/66] lib/xe_ioctl: Add wrapper with vm_bind_op extension parameter Christoph Manszewski
2024-07-29 16:01 ` [PATCH 07/66] lib/xe_eudebug: Add support for vm_bind events Christoph Manszewski
2024-07-29 16:01 ` [PATCH 08/66] lib/xe_eudebug: Add metadata support Christoph Manszewski
2024-07-29 16:01 ` [PATCH 09/66] lib/xe_eudebug: Add support for user fence acking Christoph Manszewski
2024-07-29 16:01 ` [PATCH 10/66] lib/xe_eudebug: Add support for dynamic debugger sysfs toggle Christoph Manszewski
2024-07-29 16:01 ` [PATCH 11/66] tests/xe_eudebug: Test open close events Christoph Manszewski
2024-07-29 16:01 ` [PATCH 12/66] tests/xe_eudebug: Exercise read_event ioctl Christoph Manszewski
2024-07-29 16:01 ` [PATCH 13/66] tests/xe_eudebug: Add vm events sanity check Christoph Manszewski
2024-07-29 16:01 ` [PATCH 14/66] tests/xe_eudebug: Race discovery against eudebug attach Christoph Manszewski
2024-07-29 16:01 ` [PATCH 15/66] tests/xe_eudebug: Add TEST/SUBTEST documentation Christoph Manszewski
2024-07-29 16:01 ` [PATCH 16/66] tests/xe_eudebug: Introduce basic exec_queue testing Christoph Manszewski
2024-07-29 16:01 ` [PATCH 17/66] tests/xe_eudebug: Include exec queues in discovery testing Christoph Manszewski
2024-07-29 16:01 ` [PATCH 18/66] tests/xe_eudebug: Add vm open/pread/pwrite basic tests Christoph Manszewski
2024-07-29 16:01 ` [PATCH 19/66] tests/xe_eudebug: Add basic vm-bind coverage Christoph Manszewski
2024-07-29 16:01 ` [PATCH 20/66] tests/xe_eudebug: Exercise debug metadata events sent to debugger Christoph Manszewski
2024-07-29 16:01 ` [PATCH 21/66] tests/xe_eudebug: Add support for dynamic debugger sysfs toggle Christoph Manszewski
2024-07-29 16:01 ` [PATCH 22/66] tests/xe_eudebug: Add coverage for sysfs debugger toggle Christoph Manszewski
2024-07-29 16:01 ` [PATCH 23/66] lib/xe_eudebug: Allow debugger to wait for client Christoph Manszewski
2024-07-29 16:01 ` [PATCH 24/66] tests/xe_eudebug: Add vm-bind discovery tests Christoph Manszewski
2024-07-29 16:01 ` [PATCH 25/66] tests/xe_eudebug: Add basic-vm-bind-metadata-discovery Christoph Manszewski
2024-07-29 16:01 ` [PATCH 26/66] tests/xe_eudebug: Add basic-vm-access-parameters test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 27/66] lib/xe_eudebug: Add mutex for log events write Christoph Manszewski
2024-07-29 16:01 ` [PATCH 28/66] tests/xe_eudebug: Add basic-client-th test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 29/66] tests/xe_eudebug: Added connect-user test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 30/66] tests/xe_eudebug: Add discovery-race-vmbind subtest Christoph Manszewski
2024-07-29 16:01 ` [PATCH 31/66] tests/xe_eudebug: Add userptr variant of basic-vm-access test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 32/66] tests/xe_eudebug: Add basic-vm-bind-ufence Christoph Manszewski
2024-07-29 16:01 ` [PATCH 33/66] tests/xe_eudebug: Add multigpu scenarios Christoph Manszewski
2024-07-29 16:01 ` [PATCH 34/66] tests/xe_eudebug: Add vm-bind-clear test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 35/66] tests/xe_eudebug: Exercise lseek Christoph Manszewski
2024-07-29 16:01 ` [PATCH 36/66] tests/xe_eudebug: Test multiple bo sizes Christoph Manszewski
2024-07-29 16:01 ` [PATCH 37/66] lib/gpgpu_shader: Extend shader building library Christoph Manszewski
2024-07-29 16:01 ` [PATCH 38/66] tests/xe_exec_sip: Port tests for shaders and sip Christoph Manszewski
2024-07-29 16:01 ` [PATCH 39/66] tests/xe_exec_sip: Check if we reset due to unhandled attention Christoph Manszewski
2024-07-29 16:01 ` [PATCH 40/66] tests/xe_exec_sip: Check usercoredump for attentions Christoph Manszewski
2024-07-29 16:01 ` [PATCH 41/66] tests/xe_exec_sip: Add support for dynamic debugger sysfs toggle Christoph Manszewski
2024-07-29 16:01 ` [PATCH 42/66] tests/xe_exec_sip: Add breakpoint-writesip-twice test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 43/66] tests/xe_exec_sip: Add sanity-after-timeout test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 44/66] tests/xe_exec_sip: Add breakpoint-waitsip-heavy test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 45/66] tests/xe_exec_sip: Add nodebug test cases Christoph Manszewski
2024-07-29 16:01 ` [PATCH 46/66] lib/gpgpu_shader: Add write_on_exception template Christoph Manszewski
2024-07-29 16:01 ` [PATCH 47/66] lib/gpgpu_shader: Add set/clear exception register (cr0.1) helpers Christoph Manszewski
2024-07-29 16:01 ` [PATCH 48/66] lib/intel_batchbuffer: Add helper to get pointer at specified offset Christoph Manszewski
2024-07-29 16:01 ` [PATCH 49/66] lib/gpgpu_shader: Allow enabling illegal opcode exceptions in shader Christoph Manszewski
2024-07-29 16:01 ` [PATCH 50/66] tests/xe_exec_sip: Rework invalid instruction tests Christoph Manszewski
2024-07-29 16:01 ` [PATCH 51/66] lib/intel_batchbuffer: Add support for long-running mode execution Christoph Manszewski
2024-07-29 16:01 ` [PATCH 52/66] tests/xe_eudebug_online: Debug client which runs workloads on EU Christoph Manszewski
2024-07-29 16:01 ` [PATCH 53/66] tests/xe_eudebug_online: Set dynamic breakpoint on interrupt-all Christoph Manszewski
2024-07-29 16:01 ` [PATCH 54/66] tests/xe_eudebug_online: Add support for dynamic debugger sysfs toggle Christoph Manszewski
2024-07-29 16:01 ` [PATCH 55/66] tests/xe_eudebug_online: Add tdctl-parameters test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 56/66] tests/xe_eudebug_online: Add reset-with-attention test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 57/66] lib/xe_eudebug: Expose xe_eudebug_connect Christoph Manszewski
2024-07-29 16:01 ` [PATCH 58/66] tests/xe_eudebug_online: Add interrupt-reconnect test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 59/66] tests/xe_eudebug_online: Add single-step and single-step-one tests Christoph Manszewski
2024-07-29 16:01 ` [PATCH 60/66] tests/xe_eudebug_online: What if user does not set debug mode? Christoph Manszewski
2024-07-29 16:01 ` [PATCH 61/66] tests/xe_eudebug_online: Adds debugger-reopen test Christoph Manszewski
2024-07-29 16:01 ` [PATCH 62/66] tests/xe_eudebug_online: Add caching tests Christoph Manszewski
2024-07-29 16:01 ` [PATCH 63/66] tests/xe_eudebug_online: Add subtests w/o long running mode Christoph Manszewski
2024-07-29 16:01 ` [PATCH 64/66] tests/xe_eudebug_online: Add multisession test cases Christoph Manszewski
2024-07-29 16:01 ` [PATCH 65/66] tests/xe_eudebug_online: Check if eu debugger disables preemption timeout Christoph Manszewski
2024-07-29 16:01 ` [PATCH 66/66] tests/xe_live_ktest: Add xe_eudebug live test Christoph Manszewski
2024-07-29 19:18 ` ✗ Fi.CI.BUILD: failure for Test coverage for GPU debug support Patchwork
2024-07-29 19:21 ` ✗ GitLab.Pipeline: warning " 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=20240729160159.37036-5-christoph.manszewski@intel.com \
--to=christoph.manszewski@intel.com \
--cc=andrzej.hajda@intel.com \
--cc=dominik.grzegorzek@intel.com \
--cc=dominik.karol.piatkowski@intel.com \
--cc=gwan-gyeong.mun@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=kolanupaka.naveena@intel.com \
--cc=maciej.patelczyk@intel.com \
--cc=mika.kuoppala@intel.com \
--cc=pawel.sikora@intel.com \
--cc=zbigniew.kempczynski@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox