From 18e9bef878a09f50e07b8d9198760c671d144b27 Mon Sep 17 00:00:00 2001 From: Qizhen Zhang Date: Sun, 24 Dec 2023 09:22:23 +0000 Subject: [PATCH] Debugging --- DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c | 9 ++++++++- DPDPU/OffloadEngine/UDFSamples/OffloadFunc.c | 1 + DPDPU/OffloadEngine/UDFSamples/OffloadPred.c | 4 +++- .../DDSBackEndDPUService/Source/DPUBackEndStorage.c | 9 ++++++++- .../DDSBackEndDPUService/Source/DataPlaneHandlers.c | 8 ++++---- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c b/DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c index 2d268cb..36064a3 100644 --- a/DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c +++ b/DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c @@ -2813,10 +2813,16 @@ NetfeRxTxProcess( ); totalBytesOfDPUReqs += FeLcore->ReqsForDPU[i].Bytes; - readOp->ReadCtxt.DataBuffer.TotalSize = FeLcore->ReqsForDPU[i].Bytes; + readOp->ReadCtxt.DataBuffer.TotalSize = readOp->ReadCtxt.Request->Bytes; readOp->ReadCtxt.DataBuffer.FirstSize = readOp->ReadCtxt.DataBuffer.TotalSize; readOp->StreamCtxt = (ContextT)FeStream; + // TODO: DEBUG + printf("ReadCtxt DataBuffer total size: %u\n", readOp->ReadCtxt.DataBuffer.TotalSize); + printf("FeLcore->ReqsForDPU[i].Offset: %u\n", FeLcore->ReqsForDPU[i].Offset); + printf("ReadCtxt Request Offset: %u, Bytes: %u\n", readOp->ReadCtxt.Request->Offset, readOp->ReadCtxt.Request->Bytes); + // + SubmitDataPlaneRequest( FS, &readOp->ReadCtxt, @@ -3633,6 +3639,7 @@ PEPOLcoreMain( // // iov.iov_len = 1024; + // memset(readOp->RespBuf, 7, 1024);//sanity check on client recv data // // Debugging ends here // diff --git a/DPDPU/OffloadEngine/UDFSamples/OffloadFunc.c b/DPDPU/OffloadEngine/UDFSamples/OffloadFunc.c index 39e20ea..5232f00 100644 --- a/DPDPU/OffloadEngine/UDFSamples/OffloadFunc.c +++ b/DPDPU/OffloadEngine/UDFSamples/OffloadFunc.c @@ -20,4 +20,5 @@ void OffloadFunc( ReadOp->FileId = msg->FileId; ReadOp->Bytes = msg->Length; ReadOp->Offset = msg->Offset; + printf("OffloadFunc got offset: %lu, length: %d\n", msg->Offset, msg->Length); } diff --git a/DPDPU/OffloadEngine/UDFSamples/OffloadPred.c b/DPDPU/OffloadEngine/UDFSamples/OffloadPred.c index 4cf7524..b47d35f 100644 --- a/DPDPU/OffloadEngine/UDFSamples/OffloadPred.c +++ b/DPDPU/OffloadEngine/UDFSamples/OffloadPred.c @@ -19,8 +19,10 @@ void OffloadPred( uint8_t* NumReqsForHost, uint8_t* NumReqsForDPU ) { + printf("pred got bytes: %hu\n", Bytes); const uint16_t reqSize = sizeof(struct MessageHeader); const int numReqsForDPU = Bytes / reqSize; + printf("pred got no. reqs: %d\n", numReqsForDPU); *NumReqsForHost = 0; *NumReqsForDPU = numReqsForDPU; @@ -29,4 +31,4 @@ void OffloadPred( ReqsForDPU[i].Offset = i * reqSize; ReqsForDPU[i].Bytes = reqSize; } -} \ No newline at end of file +} diff --git a/DPDPU/StorageEngine/DDSBackEndDPUService/Source/DPUBackEndStorage.c b/DPDPU/StorageEngine/DDSBackEndDPUService/Source/DPUBackEndStorage.c index c245386..f02b608 100644 --- a/DPDPU/StorageEngine/DDSBackEndDPUService/Source/DPUBackEndStorage.c +++ b/DPDPU/StorageEngine/DDSBackEndDPUService/Source/DPUBackEndStorage.c @@ -375,6 +375,7 @@ void LoadFilesCallback( SPDK_NOTICELOG("Initializing file with ID %hu\n", Ctx->FileOnDisk->Id); Sto->AllFiles[Ctx->FileLoopIndex] = BackEndFileI(Ctx->FileOnDisk->Id, Ctx->FileOnDisk->FProperties.FileName, Ctx->FileOnDisk->FProperties.FileAttributes); + printf("********** Sto->AllFiles[%d] = %p\n", Ctx->FileOnDisk->Id, Sto->AllFiles[Ctx->FileLoopIndex]); if (Sto->AllFiles[Ctx->FileLoopIndex]) { memcpy(GetFileProperties(Sto->AllFiles[Ctx->FileLoopIndex]), Ctx->FileOnDisk, sizeof(DPUFilePropertiesT)); SetNumAllocatedSegments(Sto->AllFiles[Ctx->FileLoopIndex]); @@ -1149,7 +1150,8 @@ void CreateFileCallback2( // Finally, file is added // // - Sto->AllFiles[HandlerCtx->DirId] = HandlerCtx->File; + Sto->AllFiles[HandlerCtx->FileId] = HandlerCtx->File; + printf("*********************** Sto->AllFiles[%d] is updated to %p\n", HandlerCtx->FileId, HandlerCtx->File); pthread_mutex_lock(&Sto->SectorModificationMutex); @@ -1529,6 +1531,11 @@ ErrorCodeT ReadFile( struct PerSlotContext* SlotContext = (struct PerSlotContext*)Context; SlotContext->DestBuffer = DestBuffer; FileSizeT remainingBytes = GetSize(file) - Offset; + printf("Sto->AllFiles: %p\n", Sto->AllFiles); + printf("FileId: %d, file ptr: %p\n", FileId, file); + printf("file properties id: %d\n", file->Properties.Id); + printf("ReadFile: Offset: %u, GetSize(file): %d\n", Offset, GetSize(file)); + printf("DestBuffer->TotalSize: %u\n", DestBuffer->TotalSize); FileIOSizeT bytesLeftToRead = DestBuffer->TotalSize; FileSizeT fileSize = GetSize(file); diff --git a/DPDPU/StorageEngine/DDSBackEndDPUService/Source/DataPlaneHandlers.c b/DPDPU/StorageEngine/DDSBackEndDPUService/Source/DataPlaneHandlers.c index 55f93e8..8e0a15e 100644 --- a/DPDPU/StorageEngine/DDSBackEndDPUService/Source/DataPlaneHandlers.c +++ b/DPDPU/StorageEngine/DDSBackEndDPUService/Source/DataPlaneHandlers.c @@ -27,11 +27,11 @@ void ReadHandler( ErrorCodeT ret; #ifdef FILE_SERVICE_USE_ZERO_COPY - ret = ReadFile(Context->Request->FileId, Context->Request->Offset, &Context->DataBuffer, - ReadHandlerZCCallback, SlotContext, Sto, SlotContext->SPDKContext); + ret = ReadFile(Context->Request->FileId, Context->Request->Offset, &Context->DataBuffer, + ReadHandlerZCCallback, SlotContext, Sto, SlotContext->SPDKContext); #else - ret = ReadFile(Context->Request->FileId, Context->Request->Offset, &Context->DataBuffer, - ReadHandlerNonZCCallback, SlotContext, Sto, SlotContext->SPDKContext); + ret = ReadFile(Context->Request->FileId, Context->Request->Offset, &Context->DataBuffer, + ReadHandlerNonZCCallback, SlotContext, Sto, SlotContext->SPDKContext); #endif if (ret) {