diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2016-04-18 05:59:51 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2016-04-18 05:59:51 +0000 |
commit | 995f56ca3d6e0b6a1044260f9dfa192ae3034b48 (patch) | |
tree | 03b3c0c036ad5124ec165186070f4f9a4d42bd11 /sys/dev/ic | |
parent | 32622bd2941061235594b2ae27f7371d7e99bd58 (diff) |
allocate an array of entries, not pointers for the queues
this solves my memory corruption problem with a samsung sm951 in a
particular slot on a dell 2950.
hilariously, i had picked values which masked this problem on
sparc64. i randomly picked 128 as the number of entries on the
queues, and dmamem allocs get rounded up to PAGE_SIZE. on amd64 and
sparc64 this meant i was asking for 128 * 8 (sizeof pointer), or
1024 bytes, which got rounded up to 4096 and 8192 on each arch
respectively. 128 * 64 (the size of a submission queue entry) is
8192, so it worked fine on sparc64 for that reason, but randomly
blows up on amd64. the 2950 above allocated mbufs out of the page
after the submission queue, which i ended over overwriting.
anyway. let's move on.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/nvme.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index f18ae49e773..26271e778a8 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvme.c,v 1.48 2016/04/14 12:08:21 dlg Exp $ */ +/* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* * Copyright (c) 2014 David Gwynne <dlg@openbsd.org> @@ -1218,12 +1218,12 @@ nvme_q_alloc(struct nvme_softc *sc, u_int16_t id, u_int entries, u_int dstrd) return (NULL); q->q_sq_dmamem = nvme_dmamem_alloc(sc, - sizeof(struct nvme_sqe *) * entries); + sizeof(struct nvme_sqe) * entries); if (q->q_sq_dmamem == NULL) goto free; q->q_cq_dmamem = nvme_dmamem_alloc(sc, - sizeof(struct nvme_cqe *) * entries); + sizeof(struct nvme_cqe) * entries); if (q->q_sq_dmamem == NULL) goto free_sq; |