From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Alexis Berlemont <berlemont.hauw@domain.hid>
Cc: Xenomai core <Xenomai-core@domain.hid>
Subject: [Xenomai-core] Comedi buffer management.
Date: Sun, 12 Oct 2008 12:28:47 +0200 [thread overview]
Message-ID: <48F1D15F.3010902@domain.hid> (raw)
Hi Alex,
I commited in trunk a fix of Xenomai heap management for the highmem
case. What the patch does is essentially replacing __va_to_kva (which
does not work correctly with highmem) with vmalloc_to_page, which is
available on all linux versions Xenomai supports.
However, I found that comedi buffer management also uses __va_to_kva. We
can fix SetPageReserved and ClearPageReserved easily to use
vmalloc_to_page, however, I do not see what pg_list is used for, so do
not really know how to fix it. Here is a proposed patch:
Index: ksrc/drivers/comedi/buffer.c
===================================================================
--- ksrc/drivers/comedi/buffer.c (revision 4211)
+++ ksrc/drivers/comedi/buffer.c (working copy)
@@ -46,7 +46,7 @@ void comedi_free_buffer(comedi_buf_t * b
unsigned long vaddr, vabase = (unsigned long)buf_desc->buf;
for (vaddr = vabase; vaddr < vabase + buf_desc->size;
vaddr += PAGE_SIZE)
- ClearPageReserved(virt_to_page(__va_to_kva(vaddr)));
+ ClearPageReserved(vmalloc_to_page(vaddr));
vfree(buf_desc->buf);
buf_desc->buf = NULL;
}
@@ -73,7 +73,7 @@ int comedi_alloc_buffer(comedi_buf_t * b
for (vaddr = vabase; vaddr < vabase + buf_desc->size;
vaddr += PAGE_SIZE)
- SetPageReserved(virt_to_page(__va_to_kva(vaddr)));
+ SetPageReserved(vmalloc_to_page(vaddr));
buf_desc->pg_list = comedi_kmalloc(((buf_desc->size) >> PAGE_SHIFT) *
sizeof(unsigned long));
@@ -85,7 +85,7 @@ int comedi_alloc_buffer(comedi_buf_t * b
for (vaddr = vabase; vaddr < vabase + buf_desc->size;
vaddr += PAGE_SIZE)
buf_desc->pg_list[(vaddr - vabase) >> PAGE_SHIFT] =
- __va_to_kva(vaddr);
+ (unsigned long) vmalloc_to_page(vaddr);
out_virt_contig_alloc:
if (ret != 0)
Cheers.
--
Gilles.
next reply other threads:[~2008-10-12 10:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-12 10:28 Gilles Chanteperdrix [this message]
2008-10-12 12:51 ` [Xenomai-core] Comedi buffer management Gilles Chanteperdrix
2008-10-20 22:45 ` Alexis Berlemont
2008-10-21 15:58 ` Gilles Chanteperdrix
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=48F1D15F.3010902@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=Xenomai-core@domain.hid \
--cc=berlemont.hauw@domain.hid \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.