From 995f56ca3d6e0b6a1044260f9dfa192ae3034b48 Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Mon, 18 Apr 2016 05:59:51 +0000 Subject: 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. --- sys/dev/ic/nvme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/dev/ic') 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 @@ -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; -- cgit v1.2.3