add some debug messages and remove obsolete macros

This commit is contained in:
Stefan Lankes 2011-08-16 16:08:04 -07:00
parent a0bae35a88
commit 6e55a3a874
9 changed files with 32 additions and 48 deletions

View file

@ -42,7 +42,6 @@
#define _PAGE_BIT_PAT 7 /* on 4KB pages */
#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */
#define _PAGE_BIT_SVM 9 /* mark a virtual address range as used by the SVM system */
#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */
/// Page is present
#define PG_PRESENT (1 << _PAGE_BIT_PRESENT)
@ -68,8 +67,6 @@
#define PG_PAT (1 << _PAGE_BIT_PAT)
/// This virtual address range is used by SVM system as marked
#define PG_SVM (1 << _PAGE_BIT_SVM)
/// Large page pattern flag
#define PG_PAT_LARGE (1 << _PAGE_BIT_PAT_LARGE)
/// This is a whole set of flags (PRESENT,RW,ACCESSED,DIRTY) for kernelspace tables
#define KERN_TABLE (PG_PRESENT|PG_RW|PG_ACCESSED|PG_DIRTY)

View file

@ -626,14 +626,17 @@ static void pagefault_handler(struct state *s)
index1 = viraddr >> 22;
index2 = (viraddr >> 12) & 0x3FF;
kprintf("page fault: pgd 0x%p\n", pgd);
if (pgd)
pgt = (page_table_t*) (pgd->entries[index1] & 0xFFFFF000);
kprintf("page fault: pgt 0x%p\n", pgt);
if (!pgt)
goto default_handler;
if (pgt->entries[index2] & PG_SVM)
if (!svm_access_request(viraddr))
return;
kprintf("pgt->entries[%d] = 0x%x\n", index2, pgt->entries[index2]);
default_handler:
kprintf("PAGE FAULT: Task %u got page fault at %p (irq %d, cs:eip 0x%x:0x%x)\n", task->id, viraddr, s->int_no, s->cs, s->eip);

View file

@ -63,7 +63,9 @@ int svm_init(void)
if (BUILTIN_EXPECT(!phyaddr, 0))
return -ENOMEM;
page_owner = (uint8_t*) map_region(0, phyaddr, OWNER_SIZE >> PAGE_SHIFT, MAP_KERNEL_SPACE|MAP_NO_CACHE/*MAP_MPE*/|MAP_SVM);
kprintf("Shared memory starts at the physical address 0x%x\n", shmbegin);
page_owner = (uint8_t*) map_region(0, phyaddr, OWNER_SIZE >> PAGE_SHIFT, MAP_SVM|MAP_KERNEL_SPACE|MAP_NO_CACHE/*MAP_MPE*/);
if (BUILTIN_EXPECT(!page_owner, 0)) {
flags = irq_nested_disable();
RCCE_shfree((t_vcharp) phyaddr);
@ -94,6 +96,8 @@ int svm_access_request(size_t addr)
int remote_rank;
uint8_t payload[iRCCE_MAIL_HEADER_PAYLOAD];
kprintf("enter svm_access_request\n");
if (phyaddr < shmbegin)
return -EINVAL;
if (phyaddr >= shmbegin + RCCE_SHM_SIZE_MAX)
@ -104,14 +108,13 @@ int svm_access_request(size_t addr)
if (page_owner[pageid] == my_ue)
return 0;
kprintf("send access request to %d of 0x%x\n", remote_rank, phyaddr);
remote_rank = page_owner[pageid];
((size_t*) payload)[0] = my_ue;
((size_t*) payload)[1] = phyaddr;
kprintf("send access request to %d of 0x%x\n", remote_rank, phyaddr);
/* send ping request */
iRCCE_mail_send(sizeof(size_t), ICC_TAG_SVMREQUEST, 0, payload, remote_rank);
iRCCE_mail_send(2*sizeof(size_t), ICC_TAG_SVMREQUEST, 0, payload, remote_rank);
NOP8;
icc_send_irq(remote_rank);
@ -210,7 +213,7 @@ int svm_emit_page(size_t phyaddr, int ue)
((size_t*) payload)[1] = phyaddr;
/* send ping request */
iRCCE_mail_send(sizeof(size_t), ICC_TAG_SVMREQUEST, 0, payload, remote_rank);
iRCCE_mail_send(2*sizeof(size_t), ICC_TAG_SVMREQUEST, 0, payload, remote_rank);
NOP8;
icc_send_irq(remote_rank);
@ -219,7 +222,9 @@ int svm_emit_page(size_t phyaddr, int ue)
change_page_permissions(viraddr, viraddr+PAGE_SIZE, VMA_NOACCESS|VMA_READ|VMA_CACHEABLE);
invalidate_cl1();
page_owner[pageid] = ue;
mb();
invalidate_cl1();
}

View file

@ -42,7 +42,8 @@
void* iRCCE_memcpy_get(void *dest, const void *src, size_t count)
{
#ifdef COPPERRIDGE
return memcpy_from_mpb(dest, src, count);
return memcpy_get(dest, src, count);
//return memcpy_from_mpb(dest, src, count);
#else
return memcpy(dest, src, count);
#endif

View file

@ -42,7 +42,8 @@
void* iRCCE_memcpy_put(void *dest, const void *src, size_t count)
{
#ifdef COPPERRIDGE
return memcpy_to_mpb(dest, src, count);
return memcpy_put(dest, src, count);
//return memcpy_to_mpb(dest, src, count);
#else
return memcpy(dest, src, count);
#endif

View file

@ -263,12 +263,13 @@ int icc_mail_ping( void )
void icc_mail_check(void)
{
iRCCE_MAIL_HEADER* header = NULL;
int res;
uint64_t timer;
//char* recv_buffer;
// empty mailbox and interpret headers
while( (res = iRCCE_mail_recv( &header )) == iRCCE_SUCCESS ) {
while( iRCCE_mail_recv( &header ) == iRCCE_SUCCESS ) {
iRCCE_mailbox_print_header(header);
switch(header->tag)
{
case ICC_TAG_PINGREQUEST:

View file

@ -17,25 +17,10 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
/**
* @author Stefan Lankey, Carsten Clauss
* @file arch/x86/scc/scc_memcpy.h
* @brief Special memcpy related implementations for the Intel SCC
*
* This file contains special SCC-efficient memcpy implementations
* to get memory from the RAM into the on-die memory or from the
* on-die memory into the RAM.
*/
#ifndef __SCC_MEMCPY_H_
#define __SCC_MEMPCY_H_
#include <metalsvm/stddef.h>
#ifdef CONFIG_ROCKCREEK
/** @brief Fast procedure to get a byte range from RAM into on-die memory.
*
/*
* A write access, which cache line is not present, doesn't perform (on the
* current SCC architecture) a cache line fill. Therefore, the core writes
* in this case directly to the memory.
@ -43,14 +28,10 @@
* The following function copies from the on-die memory (MPB) to the off-die
* memory and prefetchs its destintation. Therefore, the function avoids the
* bad behavior of a "write miss".
*
* @param dest Destination address
* @param src Source address
* @param count Range size in bytes
*/
inline static void *memcpy_get(void *dest, const void *src, size_t count)
{
int32_t h, i, j, k, l, m;
int h, i, j, k, l, m;
asm volatile ("cld;\n\t"
"1: cmpl $0, %%eax ; je 2f\n\t"
@ -90,20 +71,15 @@ inline static void *memcpy_get(void *dest, const void *src, size_t count)
* In our kernel, we didn't want to use FPU registers.
* Therefore, we use standard memcpy routine
*/
#define memcpy_put memcpy
#define memcpy_put memcpy
#else
/** @brief Fast procedure to get a byte range from on-die memory into RAM.
*
/*
* If the destination is located on on-die memory (MPB), classical prefetching
* techniques will be used to increase the performance.
*
* @param dest Destination address
* @param src Source address
* @param count range size in bytes
*/
inline static void *memcpy_put(void *dest, const void *src, size_t count)
{
int32_t i, j, k, l;
int i, j, k, l;
/*
* We use the floating point registers to
@ -175,5 +151,3 @@ inline static void *memcpy_put(void *dest, const void *src, size_t count)
#endif
#endif
#endif

View file

@ -60,6 +60,7 @@ extern "C" {
// RCCE specific flags
#define SCC
#define COPPERRIDGE
#define MS_BAREMETAL
//#define GORY
#define SHMADD

View file

@ -161,15 +161,14 @@ static int svm_test(void *arg)
invalidate_cl1();
// Now, we need only read access on A and B
change_page_permissions((size_t) A[0], (size_t) (A[0]+2*N*N), VMA_CACHEABLE|VMA_READ);
//change_page_permissions((size_t) A[0], (size_t) (A[0]+2*N*N), VMA_CACHEABLE|VMA_READ);
// iRCCE is not thread save => disable interrupts
flags = irq_nested_disable();
RCCE_barrier(&RCCE_COMM_WORLD);
irq_nested_enable(flags);
if (!my_ue)
kprintf("Start calculation...\n");
kputs("Start calculation...\n");
// start calculation
for(i=my_ue*(N/num_ues); i<(my_ue+1)*(N/num_ues); i++)
@ -182,6 +181,8 @@ static int svm_test(void *arg)
RCCE_barrier(&RCCE_COMM_WORLD);
irq_nested_enable(flags);
kputs("Calculation finished...\n");
svmfree((void*) A[0], 3*N*sizeof(int));
return 0;
@ -352,8 +353,8 @@ int test_init(void)
//create_kernel_task(NULL, join_test, NULL);
//create_kernel_task(NULL, producer, NULL);
//create_kernel_task(NULL, consumer, NULL);
//create_kernel_task(NULL, mail_ping, NULL);
create_kernel_task(NULL, svm_test, NULL);
create_kernel_task(NULL, mail_ping, NULL);
//create_kernel_task(NULL, svm_test, NULL);
//create_user_task(NULL, "/bin/hello", argv);
//create_user_task(NULL, "/bin/tests", argv);
//create_user_task(NULL, "/bin/jacobi", argv);