read() on device file results in errno 512 “Unknown Error” - what does it mean?











up vote
-1
down vote

favorite












I have a x86 64bit (AMD A8-3870) based PC, running Ubuntu 14.04.
Connected to the PCI-e slot, there is a Xilinx FPGA eval board (AC701). The reference driver provided by Xilinx, XDMA, with its counterpart IP core being in the FPGA, was compiled against this kernel. It loads and claims to have found the connected XDMA-enabled FPGA.



Xilinx also provides some test programs/scripts with the driver.
On this system, they run, but terminate unsuccessfully, outputting "Unknown error 512" a few times.



My own test program also gets this error when attempting to read() from an open device file that's DMA enabled (/dev/xdma0_c2h0).
(output via perror() right after it failed).



What I found about this are some referenes in some forums claiming that 512 is not a valid error number, it's a kernel internal error and should not "leak" to userspace - indicating a kernel bug.



What could I do about that / how to find out the cause?



Some additional info:
My own program did not have this error on an ARM Cortex A15 based system, where I was able to read from the FPGA this way. (just that there were other problems, and since the xdma driver is spec'd for x86 systems only, I wanted to see if there's a difference in behavior on a x86 system - so there is, just not the way I imagined...)



Edit: Upgraded to Ubuntu 16 (4.4.0.-139-generic), same behavior. (I initially used Ubuntu 14.04 as it's closer to what I (need to) use on the mentioned ARM system I started out with).
Reading from / writing to the FPGA design's exposed registers via another device file provided by the xdma driver for single accesses without DMA, does work, and does set things in motion inside the FPGA as I expect.
So only the DMA-enabled device file has this mysterious error 512, so far - from my program, and still as well for the Xilinx provided test program.










share|improve this question
























  • You'll need to look at the driver source code. There's nothing magic about errno values, they're just integers. Ordinarily, a driver returns one of the pre-defined ones (that are #defined in <errno.h> and have a text translation in libc) but there's no requirement for that. The driver is free to return whatever error value it likes and AFAIK, the kernel does not restrict the range. Since 512 isn't one of the usual ones, there's no way to predict what that error value might mean. (And whether it constitutes a bug is a matter of opinion.)
    – Gil Hamilton
    yesterday










  • Try running the application with strace and see what error code is returned by the kernel. If it's "wrong", look in the driver source. Otherwise in the userspace side.
    – Luca Ceresoli
    23 hours ago










  • Ah, thanks for those hints, clear some things up. The driver code, alas, does not do anything with a 512 as an error number. Maybe I'll see with strace where it comes from. I wonder what the downvote was for. It's always great when people do that without explaining what's supposedly wrong with a question, a real help...
    – sktpin
    21 hours ago












  • Stack Overflow is a Question/Answer site. But... what would be an answer to your question? Fixes in the driver's code? - But you even don't show that code. Note, that Stack Overflow is not a forum, and it doesn't suited for long discussions. What you see in the comments, it is just an attempt to make the question clear, so it can be answered.
    – Tsyvarev
    10 hours ago















up vote
-1
down vote

favorite












I have a x86 64bit (AMD A8-3870) based PC, running Ubuntu 14.04.
Connected to the PCI-e slot, there is a Xilinx FPGA eval board (AC701). The reference driver provided by Xilinx, XDMA, with its counterpart IP core being in the FPGA, was compiled against this kernel. It loads and claims to have found the connected XDMA-enabled FPGA.



Xilinx also provides some test programs/scripts with the driver.
On this system, they run, but terminate unsuccessfully, outputting "Unknown error 512" a few times.



My own test program also gets this error when attempting to read() from an open device file that's DMA enabled (/dev/xdma0_c2h0).
(output via perror() right after it failed).



What I found about this are some referenes in some forums claiming that 512 is not a valid error number, it's a kernel internal error and should not "leak" to userspace - indicating a kernel bug.



What could I do about that / how to find out the cause?



Some additional info:
My own program did not have this error on an ARM Cortex A15 based system, where I was able to read from the FPGA this way. (just that there were other problems, and since the xdma driver is spec'd for x86 systems only, I wanted to see if there's a difference in behavior on a x86 system - so there is, just not the way I imagined...)



Edit: Upgraded to Ubuntu 16 (4.4.0.-139-generic), same behavior. (I initially used Ubuntu 14.04 as it's closer to what I (need to) use on the mentioned ARM system I started out with).
Reading from / writing to the FPGA design's exposed registers via another device file provided by the xdma driver for single accesses without DMA, does work, and does set things in motion inside the FPGA as I expect.
So only the DMA-enabled device file has this mysterious error 512, so far - from my program, and still as well for the Xilinx provided test program.










share|improve this question
























  • You'll need to look at the driver source code. There's nothing magic about errno values, they're just integers. Ordinarily, a driver returns one of the pre-defined ones (that are #defined in <errno.h> and have a text translation in libc) but there's no requirement for that. The driver is free to return whatever error value it likes and AFAIK, the kernel does not restrict the range. Since 512 isn't one of the usual ones, there's no way to predict what that error value might mean. (And whether it constitutes a bug is a matter of opinion.)
    – Gil Hamilton
    yesterday










  • Try running the application with strace and see what error code is returned by the kernel. If it's "wrong", look in the driver source. Otherwise in the userspace side.
    – Luca Ceresoli
    23 hours ago










  • Ah, thanks for those hints, clear some things up. The driver code, alas, does not do anything with a 512 as an error number. Maybe I'll see with strace where it comes from. I wonder what the downvote was for. It's always great when people do that without explaining what's supposedly wrong with a question, a real help...
    – sktpin
    21 hours ago












  • Stack Overflow is a Question/Answer site. But... what would be an answer to your question? Fixes in the driver's code? - But you even don't show that code. Note, that Stack Overflow is not a forum, and it doesn't suited for long discussions. What you see in the comments, it is just an attempt to make the question clear, so it can be answered.
    – Tsyvarev
    10 hours ago













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I have a x86 64bit (AMD A8-3870) based PC, running Ubuntu 14.04.
Connected to the PCI-e slot, there is a Xilinx FPGA eval board (AC701). The reference driver provided by Xilinx, XDMA, with its counterpart IP core being in the FPGA, was compiled against this kernel. It loads and claims to have found the connected XDMA-enabled FPGA.



Xilinx also provides some test programs/scripts with the driver.
On this system, they run, but terminate unsuccessfully, outputting "Unknown error 512" a few times.



My own test program also gets this error when attempting to read() from an open device file that's DMA enabled (/dev/xdma0_c2h0).
(output via perror() right after it failed).



What I found about this are some referenes in some forums claiming that 512 is not a valid error number, it's a kernel internal error and should not "leak" to userspace - indicating a kernel bug.



What could I do about that / how to find out the cause?



Some additional info:
My own program did not have this error on an ARM Cortex A15 based system, where I was able to read from the FPGA this way. (just that there were other problems, and since the xdma driver is spec'd for x86 systems only, I wanted to see if there's a difference in behavior on a x86 system - so there is, just not the way I imagined...)



Edit: Upgraded to Ubuntu 16 (4.4.0.-139-generic), same behavior. (I initially used Ubuntu 14.04 as it's closer to what I (need to) use on the mentioned ARM system I started out with).
Reading from / writing to the FPGA design's exposed registers via another device file provided by the xdma driver for single accesses without DMA, does work, and does set things in motion inside the FPGA as I expect.
So only the DMA-enabled device file has this mysterious error 512, so far - from my program, and still as well for the Xilinx provided test program.










share|improve this question















I have a x86 64bit (AMD A8-3870) based PC, running Ubuntu 14.04.
Connected to the PCI-e slot, there is a Xilinx FPGA eval board (AC701). The reference driver provided by Xilinx, XDMA, with its counterpart IP core being in the FPGA, was compiled against this kernel. It loads and claims to have found the connected XDMA-enabled FPGA.



Xilinx also provides some test programs/scripts with the driver.
On this system, they run, but terminate unsuccessfully, outputting "Unknown error 512" a few times.



My own test program also gets this error when attempting to read() from an open device file that's DMA enabled (/dev/xdma0_c2h0).
(output via perror() right after it failed).



What I found about this are some referenes in some forums claiming that 512 is not a valid error number, it's a kernel internal error and should not "leak" to userspace - indicating a kernel bug.



What could I do about that / how to find out the cause?



Some additional info:
My own program did not have this error on an ARM Cortex A15 based system, where I was able to read from the FPGA this way. (just that there were other problems, and since the xdma driver is spec'd for x86 systems only, I wanted to see if there's a difference in behavior on a x86 system - so there is, just not the way I imagined...)



Edit: Upgraded to Ubuntu 16 (4.4.0.-139-generic), same behavior. (I initially used Ubuntu 14.04 as it's closer to what I (need to) use on the mentioned ARM system I started out with).
Reading from / writing to the FPGA design's exposed registers via another device file provided by the xdma driver for single accesses without DMA, does work, and does set things in motion inside the FPGA as I expect.
So only the DMA-enabled device file has this mysterious error 512, so far - from my program, and still as well for the Xilinx provided test program.







linux-kernel linux-device-driver fpga xilinx pci-e






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday

























asked yesterday









sktpin

24




24












  • You'll need to look at the driver source code. There's nothing magic about errno values, they're just integers. Ordinarily, a driver returns one of the pre-defined ones (that are #defined in <errno.h> and have a text translation in libc) but there's no requirement for that. The driver is free to return whatever error value it likes and AFAIK, the kernel does not restrict the range. Since 512 isn't one of the usual ones, there's no way to predict what that error value might mean. (And whether it constitutes a bug is a matter of opinion.)
    – Gil Hamilton
    yesterday










  • Try running the application with strace and see what error code is returned by the kernel. If it's "wrong", look in the driver source. Otherwise in the userspace side.
    – Luca Ceresoli
    23 hours ago










  • Ah, thanks for those hints, clear some things up. The driver code, alas, does not do anything with a 512 as an error number. Maybe I'll see with strace where it comes from. I wonder what the downvote was for. It's always great when people do that without explaining what's supposedly wrong with a question, a real help...
    – sktpin
    21 hours ago












  • Stack Overflow is a Question/Answer site. But... what would be an answer to your question? Fixes in the driver's code? - But you even don't show that code. Note, that Stack Overflow is not a forum, and it doesn't suited for long discussions. What you see in the comments, it is just an attempt to make the question clear, so it can be answered.
    – Tsyvarev
    10 hours ago


















  • You'll need to look at the driver source code. There's nothing magic about errno values, they're just integers. Ordinarily, a driver returns one of the pre-defined ones (that are #defined in <errno.h> and have a text translation in libc) but there's no requirement for that. The driver is free to return whatever error value it likes and AFAIK, the kernel does not restrict the range. Since 512 isn't one of the usual ones, there's no way to predict what that error value might mean. (And whether it constitutes a bug is a matter of opinion.)
    – Gil Hamilton
    yesterday










  • Try running the application with strace and see what error code is returned by the kernel. If it's "wrong", look in the driver source. Otherwise in the userspace side.
    – Luca Ceresoli
    23 hours ago










  • Ah, thanks for those hints, clear some things up. The driver code, alas, does not do anything with a 512 as an error number. Maybe I'll see with strace where it comes from. I wonder what the downvote was for. It's always great when people do that without explaining what's supposedly wrong with a question, a real help...
    – sktpin
    21 hours ago












  • Stack Overflow is a Question/Answer site. But... what would be an answer to your question? Fixes in the driver's code? - But you even don't show that code. Note, that Stack Overflow is not a forum, and it doesn't suited for long discussions. What you see in the comments, it is just an attempt to make the question clear, so it can be answered.
    – Tsyvarev
    10 hours ago
















You'll need to look at the driver source code. There's nothing magic about errno values, they're just integers. Ordinarily, a driver returns one of the pre-defined ones (that are #defined in <errno.h> and have a text translation in libc) but there's no requirement for that. The driver is free to return whatever error value it likes and AFAIK, the kernel does not restrict the range. Since 512 isn't one of the usual ones, there's no way to predict what that error value might mean. (And whether it constitutes a bug is a matter of opinion.)
– Gil Hamilton
yesterday




You'll need to look at the driver source code. There's nothing magic about errno values, they're just integers. Ordinarily, a driver returns one of the pre-defined ones (that are #defined in <errno.h> and have a text translation in libc) but there's no requirement for that. The driver is free to return whatever error value it likes and AFAIK, the kernel does not restrict the range. Since 512 isn't one of the usual ones, there's no way to predict what that error value might mean. (And whether it constitutes a bug is a matter of opinion.)
– Gil Hamilton
yesterday












Try running the application with strace and see what error code is returned by the kernel. If it's "wrong", look in the driver source. Otherwise in the userspace side.
– Luca Ceresoli
23 hours ago




Try running the application with strace and see what error code is returned by the kernel. If it's "wrong", look in the driver source. Otherwise in the userspace side.
– Luca Ceresoli
23 hours ago












Ah, thanks for those hints, clear some things up. The driver code, alas, does not do anything with a 512 as an error number. Maybe I'll see with strace where it comes from. I wonder what the downvote was for. It's always great when people do that without explaining what's supposedly wrong with a question, a real help...
– sktpin
21 hours ago






Ah, thanks for those hints, clear some things up. The driver code, alas, does not do anything with a 512 as an error number. Maybe I'll see with strace where it comes from. I wonder what the downvote was for. It's always great when people do that without explaining what's supposedly wrong with a question, a real help...
– sktpin
21 hours ago














Stack Overflow is a Question/Answer site. But... what would be an answer to your question? Fixes in the driver's code? - But you even don't show that code. Note, that Stack Overflow is not a forum, and it doesn't suited for long discussions. What you see in the comments, it is just an attempt to make the question clear, so it can be answered.
– Tsyvarev
10 hours ago




Stack Overflow is a Question/Answer site. But... what would be an answer to your question? Fixes in the driver's code? - But you even don't show that code. Note, that Stack Overflow is not a forum, and it doesn't suited for long discussions. What you see in the comments, it is just an attempt to make the question clear, so it can be answered.
– Tsyvarev
10 hours ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417093%2fread-on-device-file-results-in-errno-512-unknown-error-what-does-it-mean%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417093%2fread-on-device-file-results-in-errno-512-unknown-error-what-does-it-mean%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

How to ignore python UserWarning in pytest?

Alexandru Averescu