mmap & cache area

kjhyun의 이미지

보통 mmap 를 하면 noncached 영역으로 maping 된 virtual address를 return 해주는것으로 알고 있는데요.
혹시 cached 영역에 maping된 virtual address 를 return 할 수 있는 방법이 있을까요.

mac040의 이미지

mmap를 하면 특정 프로세스에 등록(TLB를 통해)되지 않은 주소를 리턴해주는 것으로 알고 있습니다..

아닌가요?

자세히 아시는 분들 의견 좀...

bushi의 이미지

open() 때 O_SYNC(혹은 O_NONBLOCK)을 적어주거나 나중에라도 fcntl()로 바꿔주지 않았다면...
보통 mmap()을 하면 cached 속성을 가집니다.

OTL

kjhyun의 이미지

음 제가 원하는 것은 직접 physical memory 에 맵핑하는 것입니다.
예를 들어서 frame buffer에 접근할때 mmap 를 사용해서 접근하는데
이때 mmap에서 나오는 virtual address는 non cached 영역으로 맵핑이
되어서 나옵니다.
마찬가지로 /dev/mem 디바이스를 가지고 physical address 를 맵핑하면
역시 non cached 영역에 맵핑된 virtual address 가 나옵니다

즉 /dev/mem 이라든가 아니면 직접 driver를 제작 하더라도 mmap
(아니면 다른 방법이라도 ) physical memory 를 cached 영역에 맵핑된
virtual address(user area 에서 사용가능한) 를 얻을수 있는 방법을
찾고 있습니다.

감사합니다.

bushi의 이미지

본인이 알고있는 것만 계속 반추하실 생각이라면 질문 올리시는 게 의미없습니다.

드라이버에서 사용할 힌트를 찾고계신거라면,
pgprot_noncached() 혹은 pgprot_writecombine() 등의 함수 혹은 매크로를 알아보세요.

프레임버퍼는 cached 상태로 mmap 할 이유가 없기 때문에
범용 콜백인 fbmem.c 의 fb_mmap() 는 물론이고 자체 ,fb_mmap 콜백을 제공하는 드라이버들에서도
모두 noncahed 혹은 write-combine 으로 강제 지정됩니다.
(아주 옛날엔 어쨌는지 몰라도, 최소한 2001년의 리눅스 커널부턴 이랬습니다)

/dev/mem 에 대한 mmap() 은 fd 의 flag 에 따라 다릅니다.

Android 가 인기니 구체적인 예로 이놈을 들죠.
/dev/pmem 을 사용할 경우엔 fd 의 flag 에 따라 cached, noncached 가 자유롭지만
/dev/ashmem 을 사용할 경우엔 이런 거 없습니다. 모두 그냥 cached 죠.
주소 영역에 따라 저절로 이렇게 되는게 아니고 프로그래머가 의도적으로 이렇게 만들어서 그렇습니다.

OTL

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.